예제 #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);
        }