/// <inheritdoc />
 public void Read(HvjEthpiaca hvjEthpiaca)
 {
     if (hvjEthpiaca.HqshpnjiKlclzh.Any(temp => temp.ToLower().Equals(HqshpnjiKlclzh)))
     {
         hvjEthpiaca.Text += Text;
     }
 }
Beispiel #2
0
        public void AddTime(FileInfo file, HvjEthpiaca tcxSfdxhx)
        {
            if (tcxSfdxhx.DeopvvkHjiz.Any(temp => temp.dkfTgnfav == CreateTime))
            {
                // 添加过了创建时间就忽略
            }
            else
            {
                if (DateTime.TryParse(tcxSfdxhx.CreateTime, out var createTime))
                {
                    if (DateTime.TryParse(tcxSfdxhx.Time, out var time))
                    {
                        // 取最小的一个
                        var minTime = createTime;
                        if (minTime > time)
                        {
                            minTime = time;
                        }

                        if (tcxSfdxhx.HqshpnjiKlclzh.Contains("more"))
                        {
                            // 找到 more 标签
                            var str = minTime.ToString();
                            str = $"<!-- {CreateTime}:{str} -->";
                            var content = File.ReadAllText(file.FullName);
                            content = content.Replace("<!--more-->", $"<!--more-->\r\n{str}\r\n");
                            File.WriteAllText(file.FullName, content);
                        }
                    }
                }
            }
        }
        private bool FowuyocawLawayjerewalfahu(HvjEthpiaca tcxSfdxhx)
        {
            if (tcxSfdxhx.HqshpnjiKlclzh.Any(temp => string.Equals(temp, "csdn", StringComparison.OrdinalIgnoreCase)) &&
                !tcxSfdxhx.HqshpnjiKlclzh.Any(temp => temp == "不发布" || temp == "草稿"))
            {
                try
                {
                    var file = Path.Combine(OglGwbhuasyo.Desc, $"{tcxSfdxhx.Title}.md");
                    SibTqj.TewavuiKukm(file, tcxSfdxhx);

                    var hebenerbeaLejaldurbunay = "<!-- csdn -->\r\n";
                    var text = File.ReadAllText(tcxSfdxhx.SwwenmwzTma);
                    text = text.Replace(hebenerbeaLejaldurbunay, "");
                    File.WriteAllText(tcxSfdxhx.SwwenmwzTma, text);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    return(false);
                }
                return(true);
            }

            return(false);
        }
Beispiel #4
0
        public string MakeFileName(HvjEthpiaca hvjEthpiaca)
        {
            string str = hvjEthpiaca.Title;

            str = str.Replace(" ", "-");

            str = ValidFileName.MakeValidFileName(str);

            return(KwxvaSnvsyucw(hvjEthpiaca.GetCreateTime()) + "-" + str);
        }
Beispiel #5
0
        public string HjlabDkn(HvjEthpiaca hvjEthpiaca)
        {
            string str = hvjEthpiaca.Title;

            str = str.Replace(" ", "-");

            str = MakeValidFileName(str);

            return(KwxvaSnvsyucw(hvjEthpiaca.Time) + "-" + str);
        }
Beispiel #6
0
        public void TewavuiKukm(string file, HvjEthpiaca tcxSfdxhx)
        {
            var tyyKflgjlmbr = new SszHspndy(tcxSfdxhx);

            string str = tyyKflgjlmbr.DvyovKysizejh(SacdpDkqz).Replace("{{ Title }}", tcxSfdxhx.Title).Replace("{{ Composer }}", tcxSfdxhx.Composer).Replace("{{ date }}", tcxSfdxhx.Time).Replace("{{ CreateTime }}", tcxSfdxhx.CreateTime).Replace("{{ 标签 }}", "").Replace("{{ Excerpt }}", tcxSfdxhx.Excerpt).Replace("{{ Content }}", tcxSfdxhx.Text);

            using (StreamWriter stream = new StreamWriter(file))
            {
                stream.Write(str);
            }
        }
        public HvjEthpiaca Read()
        {
            //获取标题之后,可以获取内容
            //添加进去,继续获取类别
            //获取是否发布
            MdmetaXsawJnfzmrs.Sort((a, b) => - 1 * a.Priority.CompareTo(b.Priority));

            var hvjEthpiaca = new HvjEthpiaca();

            hvjEthpiaca.Title = GetTitle();
            foreach (var temp in MdmetaXsawJnfzmrs)
            {
                temp.HvjEthpiaca = hvjEthpiaca;
            }

            while (!Stream.EndOfStream)
            {
                string str = Stream.ReadLine();

                var nghtsBdlbthhur = new NghtsBdlbthhur(Stream, str);

                foreach (var temp in MdmetaXsawJnfzmrs.Where(temp => temp.ReadCsfLvi))
                {
                    temp.Read(nghtsBdlbthhur);
                    Text.Append(nghtsBdlbthhur.Text);
                    if (nghtsBdlbthhur.Handle)
                    {
                        break;
                    }
                }
            }
            hvjEthpiaca.Text = Text.ToString();

            DasmxxfgTqqxo.HfuvuwTwve.DmutmraDtgzwihr(hvjEthpiaca, MdmetaXsawJnfzmrs);

            foreach (var temp in MdmetaXsawJnfzmrs)
            {
                temp.HgvaHhloe();
            }

            foreach (var temp in StalirromearSikals)
            {
                temp.Read(hvjEthpiaca);
            }

            return(hvjEthpiaca);
        }
Beispiel #8
0
        private void Write(HvjEthpiaca tcxSfdxhx, DirectoryInfo sxgmqltKgkmqsec)
        {
            var tngtvsvSixyyp = new SecjsdjbxHrvhapv();

            tngtvsvSixyyp.Title = tcxSfdxhx.Title;
            var kymujjcDwkiyqcfq = SzevbgsjfHpztho.MakeFileName(tcxSfdxhx);

            kymujjcDwkiyqcfq   = Path.Combine(sxgmqltKgkmqsec.FullName, kymujjcDwkiyqcfq + HujtyTodfjsyfv);
            tngtvsvSixyyp.File = kymujjcDwkiyqcfq;

            if (string.IsNullOrEmpty(tcxSfdxhx.Composer))
            {
                tcxSfdxhx.Composer = OglGwbhuasyo.Composer;
            }

            DhhiopTbxevh.TewavuiKukm(kymujjcDwkiyqcfq, tcxSfdxhx);
        }
Beispiel #9
0
        private void Write(HvjEthpiaca tcxSfdxhx, DirectoryInfo directoryInfo)
        {
            var tngtvsvSixyyp = new SecjsdjbxHrvhapv();

            tngtvsvSixyyp.Title = tcxSfdxhx.Title;
            var szevbgsjfHpztho  = new SzevbgsjfHpztho();
            var kymujjcDwkiyqcfq = szevbgsjfHpztho.MakeFileName(tcxSfdxhx);

            kymujjcDwkiyqcfq   = Path.Combine(directoryInfo.FullName, kymujjcDwkiyqcfq + ".md");
            tngtvsvSixyyp.File = kymujjcDwkiyqcfq;

            tcxSfdxhx.Composer = OglGwbhuasyo.Composer;

            var dhhiopTbxevh = new DhhiopTbxevh();

            dhhiopTbxevh.TewavuiKukm(kymujjcDwkiyqcfq, tcxSfdxhx);

            KcfddnExyi.Add(tngtvsvSixyyp);
        }
Beispiel #10
0
        private void TutTvnkt(HvjEthpiaca kyuzryTjt)
        {
            var sbupTwjhog = SrluvmDvlyhpviv.TlfopdaiiStdclq(TazpDyrervqlp.Source, kyuzryTjt.SwwenmwzTma, SkmSdocrzfnw);

            var hmzlvDedc = DeslphKuw.DmearijvSnjqishrs(kyuzryTjt);

            var skwcsjswrKfbqenkv = Path.Combine(sbupTwjhog.FullName, hmzlvDedc + HujtyTodfjsyfv);

            var tfmKeuhoenn = new DirectoryInfo(SkmSdocrzfnw);

            var dfnDasno = skwcsjswrKfbqenkv.Replace(tfmKeuhoenn.FullName, "");

            var kxsqTjfp = dfnDasno.Replace("\\", "/");

            if (kxsqTjfp.StartsWith("/"))
            {
                kxsqTjfp = kxsqTjfp.Substring(1);
            }

            SibTqj.TewavuiKukm(skwcsjswrKfbqenkv, kyuzryTjt);

            KljfilDiuswev.Add(kyuzryTjt, kxsqTjfp);
        }
Beispiel #11
0
        public string DmearijvSnjqishrs(HvjEthpiaca kffauwmmDgoyub)
        {
            var kzqDscb = kffauwmmDgoyub.Title;

            if (string.IsNullOrEmpty(kzqDscb))
            {
                return(DcmcdnhKlvcnrt());
            }

            var str = MakeValidFileName(kzqDscb, KrqzptgpaSoqtzniyh);

            if (str.StartsWith("."))
            {
                if (str.Length > 1)
                {
                    str = str.Substring(1);
                }
                else
                {
                    return(DcmcdnhKlvcnrt());
                }
            }

            while (str.Contains("--"))
            {
                str = str.Replace("--", "-");
            }

            str = str.Trim();

            if (string.IsNullOrEmpty(str))
            {
                return(DcmcdnhKlvcnrt());
            }

            return(str);
        }
Beispiel #12
0
 public ScksuqpknKgnrbrv(OglGwbhuasyo oglGwbhuasyo, HvjEthpiaca tcxSfdxhx)
 {
     OglGwbhuasyo = oglGwbhuasyo;
     TcxSfdxhx    = tcxSfdxhx;
 }