您好,欢迎访问三七文档
当前位置:首页 > 商业/管理/HR > 项目/工程管理 > 免费的文库下载器源代码
百度文库下载器源代码文件结构Zlib用于豆丁文档的解压缩,自己网上找开源代码,我也网上下载的,由于文件较多,所以没有贴出来,如果需要,跟帖我可以给链接,DOCIN.CS是支持豆丁网的下载类,由于还不支持V2版本,所以暂时不公开Global.csusingSystem;usingSystem.Text;usingSystem.Xml;usingSystem.IO;usingzlib;namespaceDocDown{publicclassGlobal{publicclass_DATA_REGEXS{publicstaticreadonlystringURL=@^(({8}\.html)|([0-9a-z]{24}\.html))$;publicstaticreadonlystringDOCIN_DOC_INFO=@^[\s\S]*playcontent=(\{.*?})[\s\S]*$;publicstaticreadonlystringBAIDU_DOC_INFO=@^[\s\S]*DOC_INFO=(\{.*?})[\s\S]*$;publicstaticreadonlystringBAIDU_DATA=@^(\{[\s\S]+?\})[\s\S]*?((CWS|FWS)\t[\s\S]*?)+$;publicstaticreadonlystringBAIDU_DATA_HEADER=@^(\{[\s\S]+?\})([\s\S]+)$;publicstaticreadonlystringBAIDU_DATA_SWF=@(CWS|FWS)\t[\s\S]*?(?=(CWS|FWS)\t|$);}publicclass_DATA_URL_FROMAT{publicstaticreadonlystringBAIDU_DATA_URL_TXT=@{0}?pn={1}&rn={2};publicstaticreadonlystringBAIDU_DATA_URL_NOT_TXT=@{0}?pn={1}&rn={2};publicstaticreadonlystringDOCIN_DATA_URL_ONE=@{0}.docin;publicstaticreadonlystringDOCIN_DATA_URL_Next=@{0}_{1}.docin;}publicclass_FILE_PATH{publicstaticreadonlystringTEMP_SMALL_PATH=@TEMP;publicstaticreadonlystringTEMP_FULL_PATH=@{0}\TEMP;publicstaticreadonlystringSWF_SMALL_PATH=@TEMP\{0}.SWF;publicstaticreadonlystringSWF_FULL_PATH=@{0}\TEMP\{1}.SWF;publicstaticreadonlystringJPG_SMALL_PATH=@TEMP\{0}.JPG;publicstaticreadonlystringJPG_FULL_PATH=@{0}\TEMP\{1}.JPG;publicstaticreadonlystringPDF_FULL_PATH=@{0}\{1}.PDF;publicstaticreadonlystringTXT_FULL_PATH=@{0}\{1}.TXT;publicstaticreadonlystringDOCIN_PATH=@TEMP\{0}.DOCIN;publicstaticreadonlystringDOCIN_HEADER=@TEMP\HEAD.DATA;publicstaticreadonlystringDOCIN_SWF=@TEMP\SWF.DATA;}publicclass_FILE_ENCODING{publicstaticreadonlyEncodingEN=Encoding.GetEncoding(Windows-1252);publicstaticreadonlyEncodingCN=Encoding.GetEncoding(GB2312);publicstaticreadonlyEncodingFTF8=Encoding.UTF8;}publicclass_JPG_SIZE{publicstaticreadonlyintW=1190;publicstaticreadonlyintH=1684;}publicclass_WORK_STATUS_INFO{publicstaticreadonlystringSTART_WORK=正在下载文库资源文件。。。;publicstaticreadonlystringCREATE_SWF=正在生成SWF文件。。。;publicstaticreadonlystringCONVERT_JPG=正在转换资源文件。。。;publicstaticreadonlystringCREATE_PDF=正在生成PDF文件。。。;publicstaticreadonlystringDOWN_ERROR=下载资源失败,请重新提交任务。;publicstaticreadonlystringSUCCESS=任务已完成。;publicstaticreadonlystringBUSY=处理中。。。;publicstaticreadonlystringSTART=开始;publicstaticreadonlystringURL_ERROR=文库地址解析错误,请确认文库地址的正确性。;publicstaticreadonlystringDOCIN_DOWN=正在下载第{0}个资源;publicstaticreadonlystringDOCIN_DOWN_ERROR=下载第{0}个资源失败,豆丁服务器异常,请重新尝试下载。;}publicclass_WEB_DOMAIN{publicstaticreadonlystringBAIDU=BAIDU;publicstaticreadonlystringDOCIN=DOCIN;}publicenumDOC_TYPE{DOC,PDF,PPT,XLS,TXT}publicstaticvoidClear(){if(Directory.Exists(temp))Directory.Delete(temp,true);}publicstaticvoidDecompress(stringinFile,stringoutFile){System.IO.FileStreamoutFileStream=newSystem.IO.FileStream(outFile,System.IO.FileMode.Create);ZOutputStreamoutZStream=newZOutputStream(outFileStream);System.IO.FileStreaminFileStream=newSystem.IO.FileStream(inFile,System.IO.FileMode.Open);try{byte[]buffer=newbyte[2000];intlen;while((len=inFileStream.Read(buffer,0,2000))0){outZStream.Write(buffer,0,len);}outZStream.Flush();}finally{outZStream.Close();outFileStream.Close();inFileStream.Close();}}publicstaticvoidDecompress(StreaminStream,longlength,stringoutFile){FileStreamoutFileStream=newFileStream(outFile,FileMode.Create);ZOutputStreamoutZStream=newZOutputStream(outFileStream);try{byte[]buffer=newbyte[2000];while(length0){if(length=2000){inStream.Read(buffer,0,2000);outZStream.Write(buffer,0,2000);length-=2000;}else{inStream.Read(buffer,0,(int)length);outZStream.Write(buffer,0,(int)length);break;}}outZStream.Flush();}finally{outZStream.Close();outFileStream.Close();}}}}Iwork.csusingSystem;usingSystem.Collections.Generic;usingSystem.Text;namespaceDocDown{interfaceIwork{voidRun();}}Work.csusingSystem;usingSystem.Text;usingSWFToImage;usingiTextSharp.text;usingiTextSharp.text.pdf;usingSystem.IO;namespaceDocDown{publicabstractclassWork:Iwork{protectedfrmMain_frmMain;protectedboolflag=false;protectedinttotalPage;publicWork(frmMain_frmMain){this._frmMain=_frmMain;}protectedvoidGetJPG(){_frmMain.ChangelblMsgText(Global._WORK_STATUS_INFO.CONVERT_JPG);_frmMain.ChangepbarMainState(0);SWFToImageObjectobj=newSWFToImageObject();obj.ImageWidth=Global._JPG_SIZE.W;obj.ImageHeight=Global._JPG_SIZE.H;obj.ImageOutputType=SWFToImage.TImageOutputType.iotJPG;for(inti=1;i=totalPage;i++){obj.InputSWFFileName=string.Format(Global._FILE_PATH.SWF_FULL_PATH,AppDomain.CurrentDomain.BaseDirectory,i);obj.Execute();obj.SaveToFile(string.Format(Global._FILE_PATH.JPG_SMALL_PATH,i));_frmMain.ChangepbarMainState(100*i/totalPage);}}protectedvoidGetPDF(){_frmMain.ChangelblMsgText(Global._WORK_STATUS_INFO.CREATE_PDF);Documentdoc=newDocument(PageSize.A2,30,30,5,5);PdfWriter.GetInstance(doc,newFileStream(string.Format(Global._FILE_PATH.PDF_FULL_PA
本文标题:免费的文库下载器源代码
链接地址:https://www.777doc.com/doc-6145303 .html