| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773 |
- #include "numbercheck.h"
- #include "wsnumchk.h"
- #include "numberreg.h"
- #include "unzip.h"
- #include "zip.h"
- #include "filesplitter.h"
- #include "resppackmerge.h"
- #include "resppacktran.h"
- #include "respforecastseg.h"
- #include "respsubminpnum.h"
- #include "respchkuserfeestatus.h"
- #include "respchkuserfcfeestatus.h"
- #include "sncdatabase.h"
- NumberCheck::NumberCheck(QString fileName, QString fileType,QString submitWay, QString memo,
- NumberCheckMethod method,QString host,QString port, QString userHash)
- {
- this->fileName = fileName;
- this->fileType = fileType;
- this->submitWay = submitWay;
- this->memo = memo;
- this->method = method;
- this->host = host;
- this->port = port;
- this->userHash = userHash;
- this->submitOK = false;
- this->forecastOK = false;
- }
- NumberCheck::~NumberCheck()
- {
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"NumberCheck Destroyed.";
- }
- void NumberCheck::run()
- {
- QTime time;
- time.start();
- emit msgUpdated("N/A","numbercount");
- emit msgUpdated("N/A","rtnmsg");
- emit msgUpdated("实号N/A,空号N/A,停机N/A,关机N/A","chkresult");
- switch(this->method)
- {
- case JustForeCast:
- forecast();
- break;
- case JustSubmit:
- submit();
- break;
- case SubmitByPack:
- submitPack();
- break;
- default:
- break;
- }
- emit chkFinished();
- this->segments.clear();
- this->numbers.clear();
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"number chk elapse time:"<<time.elapsed();
- }
- bool NumberCheck::preChkFile()
- {
- emit msgUpdated("正在验证文件有效性","label");
- if(!chkFileInfo())
- return false;
- return chkNumCount();
- }
- bool NumberCheck::chkFileInfo()
- {
- QTime time;
- time.start();
- QString msg;
- int txtFileSize = 13;
- int zipFileSize = 4;
- QFileInfo fileInfo(this->fileName);
- QString suffix = fileInfo.suffix().toLower();
- int fileSize = fileInfo.size()/1024/1024;
- bool isPass = true;
- if(this->fileType == "1")
- {
- if(suffix!="txt"&&suffix!="zip"&&suffix!="7z"&&suffix!="rar")
- {
- msg = QString("<font color=red>号码文件必须是压缩包格式或者TXT格式</font>");
- isPass = false;
- }
- }
- else
- {
- if(suffix!="txt")
- {
- msg = QString("<font color=red>号段文件必须是TXT格式</font>");
- isPass = false;
- }
- }
- if(!isPass)
- {
- emit msgUpdated(msg,"rtnmsg");
- return isPass;
- }
- if(suffix=="txt")
- {
- if(fileSize>txtFileSize)
- {
- isPass = false;
- msg = QString("<font color=red>TXT格式的文件大小不能大于%1M</font>").arg(txtFileSize);
- }
- }
- else if(suffix=="zip" || suffix=="7z" || suffix=="rar")
- {
- if(fileSize>zipFileSize)
- {
- isPass = false;
- msg = QString("<font color=red>压缩包格式的文件大小不能大于%1M</font>").arg(zipFileSize);
- }
- }
- if(!isPass)
- {
- emit msgUpdated(msg,"rtnmsg");
- }
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"chkFileInfo time is " <<time.elapsed();
- return isPass;
- }
- bool NumberCheck::chkNumCount()
- {
- QTime time;
- time.start();
- QString msg;
- int minNumbers = 1000;
- int maxNumbers = 500000;
- bool isPass = true;
- if(this->fileType=="1")// "单子类型:号码文件" ;
- {
- QFileInfo fileinfo(this->fileName);
- QString suffix = fileinfo.suffix().toLower();
- this->isSegment = false;
- if(suffix == "txt" )
- {
- QStringList fileList;
- fileList << this->fileName;
- QMap<int,int> map = extractNumberFromTxtFile(fileList);
- if(map.size()==0)
- {
- numCount = 0;
- }
- else
- {
- numCount = map.value(0);
- }
- }
- else if(suffix == "zip" || suffix=="7z" || suffix=="rar")
- {
- QMap<int,int> map = extractTxtFileFromZip(fileName);
- if(map.size()==0)
- {
- this->numCount = 0;
- }
- else
- {
- int total = 0;
- foreach(int key,map.keys())
- {
- total += map.value(key);
- if(map.value(key)<minNumbers || map.value(key)>maxNumbers)
- {
- isPass = false;
- }
- }
- this->numCount = total;
- }
- }
- }
- else// "单子类型:号段文件" ;
- {
- this->isSegment = true;
- int size = extractSegmentFromTxtFile(this->fileName);
- this->numCount = size*10000;
- }
- if(this->numCount<minNumbers || this->numCount>maxNumbers)
- {
- msg = QString("<font color=red>文件中的号码总数最少要包含%1个号码,最多包含%2个号码。</font>").arg(minNumbers).arg(maxNumbers);
- isPass = false;
- }
- emit msgUpdated(QString::number(this->numCount),"numbercount");
- if(!isPass)
- emit msgUpdated(msg,"rtnmsg");
- else
- {
- emit msgUpdated("文件有效性通过验证","rtnmsg");
- }
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"chkNumCount time is " <<time.elapsed();
- return isPass;
- }
- bool NumberCheck::chkFee()
- {
- QTime time;
- time.start();
- WSNumChk *client = new WSNumChk(this->host,this->port);
- emit msgUpdated("正在检测是否有足够的余额","label");
- QString json = client->chkUserFeeStatus(QString::number(numCount),this->userHash);
- qDebug()<<json;
- bool pass = false;
- if(!json.isEmpty()){
- RespChkUserFeeStatus *response = new RespChkUserFeeStatus(json);
- if(response->getRtnCode()==1)
- {
- emit msgUpdated(response->getRtnMemo(),"rtnmsg");
- pass = true;
- }
- else if(response->getRtnCode()==-1)
- {
- emit msgUpdated("<font color=red>登录超时,请重新登录!</font>","rtnmsg");
- }
- else
- {
- emit msgUpdated("<font color=red>"+response->getRtnMemo()+"</font>","rtnmsg");
- }
- delete response;
- }
- else
- {
- emit msgUpdated("网络无法连接,请稍候再试!","rtnmsg");
- }
- delete client;
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"chkFee time is"<<time.elapsed();
- return pass;
- }
- bool NumberCheck::chkFcFee()
- {
- QTime time;
- time.start();
- WSNumChk *client = new WSNumChk(this->host,this->port);
- emit msgUpdated("正在检测是否有足够的余额","label");
- QString json = client->chkUserFcFeeStatus(QString::number(numCount),this->userHash);
- bool pass = false;
- if(!json.isEmpty()){
- RespChkUserFcFeeStatus *response = new RespChkUserFcFeeStatus(json);
- if(response->getRtnCode()==1)
- {
- emit msgUpdated(response->getRtnMemo(),"rtnmsg");
- pass = true;
- }
- else if(response->getRtnCode()==-1)
- {
- emit msgUpdated("<font color=red>登录超时,请重新登录!</font>","rtnmsg");
- }
- else
- {
- emit msgUpdated("<font color=red>"+response->getRtnMemo()+"</font>","rtnmsg");
- }
- delete response;
- }
- else
- {
- emit msgUpdated("网络无法连接,请稍候再试!","rtnmsg");
- }
- delete client;
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"chkFcFee time is "<<time.elapsed();
- return pass;
- }
- void NumberCheck::forecast()
- {
- this->submitOK = false;
- this->forecastOK = false;
- if(!preChkFile())
- return ;
- if(!chkFcFee())
- return ;
- QTime time;
- time.start();
- emit msgUpdated("正在进行预检测","label");
- QString segdata="";
- int segLen = 0;
- if(isSegment)
- {
- for(int i=0;i<segments.size();i++)
- {
- segdata += segments.at(i)+",10000;";
- }
- segdata += "END";
- segLen = 7;
- }
- else
- {
- QString str;
- for(int i=7;i>=3;i--)
- {
- str = createSegData(i);
- if(str.isEmpty())
- {
- continue;
- }
- else
- {
- segLen = i;
- break;
- }
- }
- if(!str.isEmpty())
- {
- segdata = str + "END";
- }
- }
- if(segdata.isEmpty())
- {
- emit msgUpdated("<font color=red>号码数量太少,无法预测。</font>","rtnmsg");
- return ;
- }
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"segdata get time is "<<time.elapsed();
- time.start();
- WSNumChk *client = new WSNumChk(this->host,this->port);
- QString json = client->forecastSeg(segdata,QString::number(segLen),"BASE64",this->userHash);
- if(!json.isEmpty()){
- RespForeCastSeg *response = new RespForeCastSeg(json);
- if(response->getRtnCode()==1)
- {
- emit msgUpdated(response->getRtnMemo(),"rtnmsg");
- QStringList list = response->getFcResult().split(",");
- QString str ;
- str += "实号" + list.at(0);
- str += ",空号" + list.at(1);
- str += ",停机" + list.at(2);
- str += ",关机" + list.at(3);
- str += "。<font color=\"#af0000\">参考度" + list.at(4) + "</font>";
- this->forecastOK = true;
- emit msgUpdated(str,"chkresult");
- }
- else if(response->getRtnCode()==-1)
- {
- emit msgUpdated("<font color=red>登录超时,请重新登录!</font>","rtnmsg");
- }
- else
- {
- emit msgUpdated("<font color=red>"+response->getRtnMemo()+"</font>","rtnmsg");
- }
- delete response;
- }
- else
- {
- emit msgUpdated("网络无法连接,请稍候再试!","rtnmsg");
- }
- delete client;
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"forecast time is "<<time.elapsed();
- }
- QString NumberCheck::createSegData(int len)
- {
- QString lastseg;
- QString data;
- int total = 0;
- int count = 0;
- for(int i=0;i<model.getSegments().size();i++)
- {
- QString segment = model.getSegments().at(i);
- for(int j=0;j<model.getNumbers().at(i).size();j++)
- {
- QString num = segment+model.getNumbers().at(i).at(j);
- QString curseg = num.left(len);
- if(lastseg.isEmpty())
- {
- lastseg = curseg;
- count = 1;
- }
- else
- {
- if(curseg != lastseg)
- {
- if(count>=500)
- {
- data += lastseg + "," + QString::number(count) + ";";
- total += count;
- }
- lastseg = curseg;
- count = 1;
- }
- else
- {
- count++;
- }
- if((i == model.getSegments().size()-1) && j == model.getNumbers().at(i).size() - 1)
- {
- if(count>=500)
- {
- data += lastseg + "," + QString::number(count) + ";";
- total += count;
- }
- }
- }
- }
- }
- //qDebug()<<data;
- if(total < model.getCount()*0.7)
- data = "";
- return data;
- }
- void NumberCheck::submit()
- {
- this->submitOK = false;
- this->forecastOK = false;
- if(!preChkFile())
- return ;
- if(!chkFee())
- return ;
- QString zip = zipTxtFile(this->fileName);
- if(!zip.isEmpty())
- {
- this->fileName = zip;
- this->zipFileName = zip;
- }
- else
- {
- if(!this->zipFileName.isEmpty())
- this->fileName = this->zipFileName;
- }
- QTime time;
- time.start();
- WSNumChk *client = new WSNumChk(this->host,this->port);
- emit msgUpdated("正在提交,请稍候","label");
- QString json = client->submitPnumFile(this->fileName,this->fileType,this->submitWay,this->memo,this->userHash);
- if(!json.isEmpty()){
- RespSubminPNum *response = new RespSubminPNum(json);
- if(response->getRtnCode()==2)
- {
- emit msgUpdated("上传成功,号码全部接收。","rtnmsg");
- emit msgUpdated(response->getRtnMemo(),"tooltipok");
- this->submitOK = true;
- }
- else if(response->getRtnCode()==1)
- {
- emit msgUpdated("上传成功,文件中含有部分非法数据。","rtnmsg");
- emit msgUpdated(response->getRtnMemo(),"tooltipwarning");
- this->submitOK = true;
- }
- else if(response->getRtnCode()==-1)
- {
- emit msgUpdated("<font color=red>登录超时,请重新登录。</font>","rtnmsg");
- }
- else
- {
- emit msgUpdated("<font color=red>"+response->getRtnMemo()+"</font>","rtnmsg");
- }
- delete response;
- }
- else
- {
- emit msgUpdated("网络无法连接,请稍候再试!","rtnmsg");
- }
- delete client;
- // if(!this->zipFileName.isEmpty())
- // QFile::remove(this->zipFileName);
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"upload time "<<time.elapsed();
- }
- void NumberCheck::submitPack()
- {
- this->submitOK = false;
- this->forecastOK = false;
- if(!preChkFile())
- return ;
- emit msgUpdated("1","progress");
- if(!chkFee())
- return ;
- emit msgUpdated("2","progress");
- QString zip = zipTxtFile(this->fileName);
- if(!zip.isEmpty())
- {
- this->fileName = zip;
- this->zipFileName = zip;
- }
- else
- {
- if(!this->zipFileName.isEmpty())
- this->fileName = this->zipFileName;
- }
- QTime time;
- time.start();
- emit msgUpdated("3","progress");
- emit msgUpdated("正在分批提交,请稍候","label");
- FileSplitter splitter(fileName);
- QStringList list = splitter.getSplitResult();
- WSNumChk numchk(this->host,this->port);
- bool allupload = true;
- QString packName;
- for(int i=0;i<list.size();i++)
- {
- //emit msgUpdated(QString("第%1/%2正在提交").arg(i+1).arg(list.size()),"label");
- packName = list.at(i);
- QString json = numchk.PackTran(packName,this->userHash);
- RespPackTran response(json);
- if(response.getRtnCode()==1)
- {
- //emit msgUpdated(QString("第%1/%2提交成功").arg(i+1).arg(list.size()),"label");
- QFile::remove(packName);
- }
- else
- {
- allupload = false;
- //emit msgUpdated(QString("第%1/%2提交失败,请稍候重试").arg(i+1).arg(list.size()),"label");
- }
- emit msgUpdated(QString::number(3+90*(i+1)/list.size()),"progress");
- }
- if(allupload)
- {
- splitter.cleanup();
- emit msgUpdated(QString::number(94),"progress");
- QString json = numchk.PackMerge(packName,this->userHash);
- emit msgUpdated(QString::number(95),"progress");
- RespPackMerge response(json);
- if(response.getRtnCode()==1)
- {
- QFileInfo fileinfo(fileName);
- emit msgUpdated(QString::number(96),"progress");
- json = numchk.submitPnumFile(fileinfo.fileName(),response.getFileHash(),fileType,submitWay,memo,userHash);
- RespSubminPNum response(json);
- if(response.getRtnCode()==2)
- {
- emit msgUpdated("上传成功,号码全部接收。","rtnmsg");
- emit msgUpdated(response.getRtnMemo(),"tooltipok");
- this->submitOK = true;
- }
- else if(response.getRtnCode()==1)
- {
- emit msgUpdated("上传成功,文件中含有部分非法数据。","rtnmsg");
- emit msgUpdated(response.getRtnMemo(),"tooltipwarning");
- this->submitOK = true;
- }
- else if(response.getRtnCode()==-1)
- {
- emit msgUpdated("<font color=red>登录超时,请重新登录。</font>","rtnmsg");
- }
- else
- {
- emit msgUpdated("<font color=red>"+response.getRtnMemo()+"</font>","rtnmsg");
- }
- }
- else
- {
- emit msgUpdated("<font color=red>"+response.getRtnMemo()+"</font>","rtnmsg");
- }
- }
- else
- {
- emit msgUpdated("<font color=red>未能提交,请再次尝试上传(支持断点续传)。</font>","rtnmsg");
- }
- emit msgUpdated(QString::number(100),"progress");
- msleep(500);
- qDebug()<<QDateTime::currentDateTime().toString("yyyy-MM-dd HH:mm:ss")\
- <<"upload time "<<time.elapsed();
- }
- int NumberCheck::extractSegmentFromTxtFile(QString fileName)
- {
- QFile file(fileName);
- if(!file.open(QIODevice::ReadOnly))
- {
- return -1;
- }
- QTextStream in(&file);
- segments.clear();
- while(!in.atEnd())
- {
- QString line = in.readLine().trimmed();
- if(NumberReg::getSegmentReg().exactMatch(line))
- segments<<line;
- }
- file.close();
- return segments.size();
- }
- //QMap<int,int> NumberCheck::extractTxtFileFromZip(QString zipFile)
- //{
- // UnZip::ErrorCode ec;
- // UnZip uz;
- // QDir dir;
- // QMap<int,int> map;
- // QStringList fileList;
- // if(!dir.exists(QDir::tempPath()+"/SNCUnzipFile"))
- // {
- // dir.mkdir(QDir::tempPath()+"/SNCUnzipFile");
- // }
- // ec = uz.openArchive(zipFile);
- // if (ec != UnZip::Ok) {
- // qDebug() << "openArchive:zip包文件格式损坏!";
- // return map ;
- // }
- // QDir d(QDir::tempPath()+"/SNCUnzipFile");
- // QFileInfoList list = d.entryInfoList();
- // for(int i=0;i<list.size();i++)
- // {
- // if(list.at(i).isFile())
- // QFile::remove(list.at(i).absoluteFilePath());
- // }
- // ec = uz.extractAll(QDir::tempPath()+"/SNCUnzipFile");
- // if (ec != UnZip::Ok) {
- // qDebug() << "extractAll:zip包文件格式损坏!";
- // uz.closeArchive();
- // return map ;
- // }
- //// QTime dieTime = QTime::currentTime().addMSecs(6000);
- //// while( QTime::currentTime() < dieTime )
- //// QCoreApplication::processEvents(QEventLoop::AllEvents, 100);
- // QDir d2(QDir::tempPath()+"/SNCUnzipFile");
- // list = d2.entryInfoList();
- // for(int i=0;i<list.size();i++)
- // {
- // if(list.at(i).isFile())
- // {
- // if(list.at(i).suffix().toLower()=="txt")
- // fileList<<list.at(i).absoluteFilePath();
- // }
- // }
- // map = extractNumberFromTxtFile(fileList);
- // return map;
- //}
- QMap<int,int> NumberCheck::extractTxtFileFromZip(QString zipFile)
- {
- QDir dir;
- QMap<int,int> map;
- QStringList fileList;
- if(!dir.exists(QDir::tempPath()+"/SNCUnzipFile"))
- {
- dir.mkdir(QDir::tempPath()+"/SNCUnzipFile");
- }
- QDir d(QDir::tempPath()+"/SNCUnzipFile");
- QFileInfoList list = d.entryInfoList();
- for(int i=0;i<list.size();i++)
- {
- if(list.at(i).isFile())
- QFile::remove(list.at(i).absoluteFilePath());
- }
- QProcess process;
- process.setStandardOutputFile(QDir::tempPath()+"/SNCUnzipFile/output.log");
- process.setWorkingDirectory(QCoreApplication::applicationDirPath());
- process.start("\"" + QCoreApplication::applicationDirPath() + "/7ze.exe\" e \"" + zipFile + "\" -o\"" + QDir::tempPath()+"/SNCUnzipFile\" ");
- process.waitForFinished();
- QDir d2(QDir::tempPath()+"/SNCUnzipFile");
- list = d2.entryInfoList();
- for(int i=0;i<list.size();i++)
- {
- if(list.at(i).isFile())
- {
- if(list.at(i).suffix().toLower()=="txt")
- fileList<<list.at(i).absoluteFilePath();
- }
- }
- map = extractNumberFromTxtFile(fileList);
- QFileInfo fileinfo(zipFile);
- QString newZipfiles = QDir::tempPath()+"/SNCUnzipFile/" + fileinfo.baseName() + ".zip";
- QProcess process2;
- process2.setWorkingDirectory(QCoreApplication::applicationDirPath());
- process2.start("\"" + QCoreApplication::applicationDirPath() + "/7ze.exe\" a \"" + newZipfiles + "\" \"" + QDir::tempPath()+"/SNCUnzipFile/*.txt\"");
- process2.waitForFinished();
- this->zipFileName = newZipfiles;
- return map;
- }
- QMap<int,int> NumberCheck::extractNumberFromTxtFile(QStringList fileNames)
- {
- QMap<int,int> map;
- segments.clear();
- numbers.clear();
- for(int i=0;i<fileNames.size();i++)
- {
- QString fileName = fileNames.at(i);
- QFile file(fileName);
- if(!file.open(QIODevice::ReadOnly))
- {
- map.clear();
- return map;
- }
- QTextStream in(&file);
- QStringList nums;
- while(!in.atEnd())
- {
- QString line = in.readLine().trimmed();
- if(NumberReg::getCellPhoneReg().exactMatch(line))
- {
- nums<<line;
- QString segment = line.left(7);
- QString tail = line.mid(7,4);
- QStringList list;
- list<<tail;
- segments.append(segment);
- numbers.append(list);
- }
- }
- map.insert(i,nums.size());
- }
- model.setNumberList(segments,numbers);
- model.mergeSegment();
- return map;
- }
- QString NumberCheck::zipTxtFile(QString fileName)
- {
- Zip::ErrorCode ec;
- Zip uz;
- QDir dir;
- QFileInfo fileInfo(fileName);
- if(fileInfo.suffix().toLower()!="txt")
- return "";
- if(fileType=="2")
- return "";
- if(!dir.exists(QDir::tempPath()+"/speednumcube"))
- {
- dir.mkdir(QDir::tempPath()+"/speednumcube");
- }
- if(!dir.exists(QDir::tempPath()+"/speednumcube/tmpzip"))
- {
- dir.mkdir(QDir::tempPath()+"/speednumcube/tmpzip");
- }
- QString path = QDir::tempPath()+"/speednumcube/tmpzip";
- QString zip = path+"/"+fileInfo.completeBaseName()+".zip";
- QFile file(zip);
- if(!file.open(QIODevice::WriteOnly)){
- return "" ;
- }
- file.close();
- ec = uz.createArchive(zip);
- if (ec != Zip::Ok) {
- qDebug() << "Unable to create archive: " << uz.formatError(ec).toAscii().data() << endl << endl;
- return "";
- }
- ec = uz.addFile(fileName);
- if (ec != Zip::Ok) {
- qDebug() << "Unable to add directory: " << uz.formatError(ec).toAscii().data() << endl << endl;
- return "";
- }
- if (uz.closeArchive() != Zip::Ok) {
- qDebug() << "Unable to close the archive: " << uz.formatError(ec).toAscii().data() << endl << endl;
- return "";
- }
- return zip;
- }
|