コード例 #1
0
 public CnblogProcess()
 {
     //set UseDefaultCookiesParser as false if a website returns invalid cookies format
     //browser.UseDefaultCookiesParser = false;
     web = new WebUtility();
     web.Encode=Encoding.UTF8;
 }
コード例 #2
0
        private async Task Init(string fileName, IProgress<DownloadStringTaskAsyncExProgress> progress)
        {
            baseDir = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, @"Temp\Epub\" + fileName);
            if (Directory.Exists(baseDir))
            {
                Directory.Delete(baseDir, true);
            }
            Directory.CreateDirectory(baseDir);
            baseDir += "\\";

            if (progress != null)
            {
                progress.Report(new DownloadStringTaskAsyncExProgress() { Text = "正在准备EPUB必须文件" });
            }

            Directory.CreateDirectory(baseDir + "META-INF");
            CreateFile(baseDir + "META-INF\\container.xml", strContainer);
            CreateFile(baseDir + "mimetype", strMimetype);
            WebUtility web = new WebUtility();
            web.URL = strCover;
            web.DownloadFile(baseDir + "cover.png");
            CreateFile(baseDir + "stylesheet.css", strStyle);
            CreateFile(baseDir + "titlepage.xhtml", strTitlepage);
        }