Example #1
0
        public TxtPackage(string fileName, string title, FeedService fs, string[] urls, Action<string> callback)
        {
            this._fileName = fileName;
            this._title = title;
            this.feedService = fs;
            this.artUrls = urls;
            this._callback = callback;

            Init(urls == null);
        }
Example #2
0
        public HtmlPackage(string fileName, string title, FeedService fs, string[] urls, Action <string> callback)
        {
            this._fileName   = fileName;
            this._title      = title;
            this.feedService = fs;
            this.artUrls     = urls;
            this._callback   = callback;

            Init(urls == null);
        }
Example #3
0
        public ChmPackage(string fileName, string title, FeedService fs, string[] urls, Action <string> callback)
        {
            this._fileName   = fileName.Replace(".chm", string.Empty);
            this._title      = title;
            this.feedService = fs;
            this.artUrls     = urls;
            this._callback   = callback;

            Init(urls == null);
        }
Example #4
0
        public ChmPackage(string fileName, string title, FeedService fs, string[] urls, Action<string> callback)
        {
            this._fileName = fileName.Replace(".chm", string.Empty);
            this._title = title;
            this.feedService = fs;
            this.artUrls = urls;
            this._callback = callback;

            Init(urls == null);
        }
Example #5
0
        private void StartExport()
        {
            var put = GetInput();
            if (!put.Status) return;

            Source src = Source.csdn;
            switch (put.Type)
            {
                case Type.Blog:
                    src = (Source)(comboBox1.SelectedIndex + 1);
                    break;
                case Type.Url:
                    src = GetSourceByDomain();
                    break;
                case Type.Column:
                    src = Source.csdn;
                    break;
            }
            string user = put.Text;
            if (put.Type == Type.Url) user = src.ToString();
            string title = App.GetDescription(src);

            FeedService fs = new FeedService(src, user);

            if (put.Type == Type.Blog)
            {
                ArticleListForm frm = new ArticleListForm(fs);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            button1.Enabled = false;

            Thread thd = new Thread(() =>
            {
                string[] urls = null;
                if (put.Type == Type.Url)
                {
                    urls = put.Text.Replace("\r", "").Split(new char[] { '\n', ',', ',', ';', ';' }, StringSplitOptions.RemoveEmptyEntries);
                }
                else if (put.Type == Type.Column)
                {//抓取URL 
                    urls = GetColumnUrls(put.Text);
                }
                if ((put.Format & Format.CHM) != 0)
                {
                    SetLbText("开始生成CHM文档");
                    ChmPackage chm = new ChmPackage(user, title, fs, urls, SetLbText);
                    if (chm.Build())
                        SetLbText("CHM文档生成成功!");
                }
                if ((put.Format & Format.PDF) != 0)
                {
                    SetLbText("开始生成PDF文档");
                    PdfPackage pdf = new PdfPackage(user, title, fs, urls, SetLbText);
                    pdf.Build();
                    SetLbText("PDF文档生成成功!");
                }
                if ((put.Format & Format.HTML) != 0)
                {
                    SetLbText("开始生成HTML文档");
                    HtmlPackage htm = new HtmlPackage(user, title, fs, urls, SetLbText);
                    htm.Build();
                    SetLbText("HTML文档生成成功!");
                }
                if ((put.Format & Format.TXT) != 0)
                {
                    SetLbText("开始生成TXT文档");
                    TxtPackage txt = new TxtPackage(user, title, fs, urls, SetLbText);
                    txt.Build();
                    SetLbText("TXT文档生成成功!");
                }
                if ((put.Format & Format.EPUB) != 0)
                {
                    SetLbText("开始生成EPUB文档");
                    EpubPackage epub = new EpubPackage(user, title, fs, urls, SetLbText);
                    epub.Build();
                    SetLbText("EPUB文档生成成功!");
                }
                MessageBox.Show("全部导出完成!");

                button1.Invoke(new SetText(delegate(string s)
                {
                    button1.Enabled = true;
                }), string.Empty);
            });
            thd.Start(); 
        }
Example #6
0
        private void StartExport()
        {
            var put = GetInput();

            if (!put.Status)
            {
                return;
            }

            Source src = Source.csdn;

            switch (put.Type)
            {
            case Type.Blog:
                src = (Source)(comboBox1.SelectedIndex + 1);
                break;

            case Type.Url:
                src = GetSourceByDomain();
                break;

            case Type.Column:
                src = Source.csdn;
                break;
            }
            string user = put.Text;

            if (put.Type == Type.Url)
            {
                user = src.ToString();
            }
            string title = App.GetDescription(src);

            FeedService fs = new FeedService(src, user);

            if (put.Type == Type.Blog)
            {
                ArticleListForm frm = new ArticleListForm(fs);
                if (frm.ShowDialog() != DialogResult.OK)
                {
                    return;
                }
            }
            button1.Enabled = false;

            Thread thd = new Thread(() =>
            {
                string[] urls = null;
                if (put.Type == Type.Url)
                {
                    urls = put.Text.Replace("\r", "").Split(new char[] { '\n', ',', ',', ';', ';' }, StringSplitOptions.RemoveEmptyEntries);
                }
                else if (put.Type == Type.Column)
                {//抓取URL
                    urls = GetColumnUrls(put.Text);
                }
                if ((put.Format & Format.CHM) != 0)
                {
                    SetLbText("开始生成CHM文档");
                    ChmPackage chm = new ChmPackage(user, title, fs, urls, SetLbText);
                    if (chm.Build())
                    {
                        SetLbText("CHM文档生成成功!");
                    }
                }
                if ((put.Format & Format.PDF) != 0)
                {
                    SetLbText("开始生成PDF文档");
                    PdfPackage pdf = new PdfPackage(user, title, fs, urls, SetLbText);
                    pdf.Build();
                    SetLbText("PDF文档生成成功!");
                }
                if ((put.Format & Format.HTML) != 0)
                {
                    SetLbText("开始生成HTML文档");
                    HtmlPackage htm = new HtmlPackage(user, title, fs, urls, SetLbText);
                    htm.Build();
                    SetLbText("HTML文档生成成功!");
                }
                if ((put.Format & Format.TXT) != 0)
                {
                    SetLbText("开始生成TXT文档");
                    TxtPackage txt = new TxtPackage(user, title, fs, urls, SetLbText);
                    txt.Build();
                    SetLbText("TXT文档生成成功!");
                }
                if ((put.Format & Format.EPUB) != 0)
                {
                    SetLbText("开始生成EPUB文档");
                    EpubPackage epub = new EpubPackage(user, title, fs, urls, SetLbText);
                    epub.Build();
                    SetLbText("EPUB文档生成成功!");
                }
                MessageBox.Show("全部导出完成!");

                button1.Invoke(new SetText(delegate(string s)
                {
                    button1.Enabled = true;
                }), string.Empty);
            });

            thd.Start();
        }
Example #7
0
 public ArticleListForm(FeedService feedService)
 {
     this.feedService = feedService;
     InitializeComponent();
 }
Example #8
0
 public ArticleListForm(FeedService feedService)
 {
     this.feedService = feedService;
     InitializeComponent();
 }