示例#1
0
        private string GetContent(FeedEntity entity)
        {
            if (!feedService.GetContent(ref entity))
            {
                return(string.Empty);
            }

            string html = entity.Content;

            html = reg_br.Replace(html, "\n");
            html = reg_html.Replace(html, string.Empty);
            html = App.ToHtmlDecoded(html).Replace("\r", string.Empty).Replace("\n", "\r\n");

            return(html);
        }
示例#2
0
        private string GetContent(FeedEntity entity)
        {
            if (!feedService.GetContent(ref entity))
            {
                return(string.Empty);
            }

            string html = entity.Content;

            html = reg_code1.Replace(html, "\n[code_begin]\n");
            html = reg_code2.Replace(html, "\n[code_end]\n");
            html = reg_img.Replace(html, "\n[img]$1\n");
            html = reg_br.Replace(html, "\n");
            html = reg_html.Replace(html, string.Empty);
            html = App.ToHtmlDecoded(html);

            return(html);
        }
示例#3
0
        private void Build1()
        {
            string fn, content;

            fn      = baseDir + _fileName + ".hhp";
            content = string.Format(hhpString, _fileName, _title);
            CreateFile(fn, content);

            fn      = baseDir + _fileName + ".hhc";
            content = string.Format(hhcString, _title, GetItems(itemString));
            CreateFile(fn, content);

            fn      = baseDir + _fileName + ".hhk";
            content = string.Format(hhcString, _title, GetItems(hhkString));
            CreateFile(fn, content);

            fn      = baseDir + "html\\all.htm";
            content = htmString.Replace("{0}", GetItems(item2String));
            CreateFile(fn, content);

            int cnt = items.Count;

            for (int i = cnt - 1; i >= 0; i--)
            {
                var entity = items[i];
                if (!entity.IsDown)
                {
                    continue;
                }
                _callback("获取文章 " + (cnt - i) + "/" + cnt + ":" + entity.Title);

                if (feedService.GetContent(ref entity))
                {
                    string name = entity.Url.Substring(entity.Url.LastIndexOf("/") + 1);
                    fn = baseDir + "html\\" + name + ".htm";

                    content = htmString.Replace("{0}", entity.Content);

                    CreateFile(fn, content);
                }
            }
        }
示例#4
0
        private void Build1()
        {
            int cnt = items.Count;

            for (int i = cnt - 1; i >= 0; i--)
            {
                var entity = items[i];
                if (!entity.IsDown)
                {
                    continue;
                }
                _callback("获取文章 " + (cnt - i) + "/" + cnt + ":" + entity.Title);

                string fileName = "article_" + (cnt - i) + ".html";

                if (feedService.GetContent(ref entity))
                {
                    string content = strItem.Replace("{0}", entity.Title).Replace("\n{1}", entity.Content);
                    CreateFile(baseDir + fileName, content);
                }
            }
        }
示例#5
0
        public void Build()
        {
            if (artUrls != null)
            {
                Build2();
                return;
            }
            StringBuilder sb = new StringBuilder();

            sb.Append("<ol>");
            int cnt = items.Count;

            for (int i = cnt - 1; i >= 0; i--)
            {
                var entity = items[i];
                if (!entity.IsDown)
                {
                    continue;
                }
                _callback("获取文章 " + (cnt - i) + "/" + cnt + ":" + entity.Title);

                string fileName = GetFileName(entity.Title) + ".htm";

                sb.AppendFormat("<li><a href='{0}'>{1}</a></li>"
                                , fileName, entity.Title);

                if (feedService.GetContent(ref entity))
                {
                    string content = htmlString.Replace("{0}", entity.Title).Replace("\n{1}", entity.Content);
                    CreateFile(baseDir + fileName, content);
                }
            }
            sb.Append("</ol>");
            string content2 = htmlString.Replace("{0}", this._title).Replace("\n{1}", sb.ToString());

            CreateFile(baseDir + "_index.htm", content2);
        }