예제 #1
0
        static public void addNewNovelSetting(Novelsetting novelsetting, DataContext aConText)
        {
            var novelsettings = aConText.GetTable <Novelsetting>();

            novelsetting.Regdate = DateTime.Today.ToShortDateString() + " " + DateTime.Now.ToShortTimeString();
            novelsettings.InsertOnSubmit(novelsetting);
            aConText.SubmitChanges();
        }
예제 #2
0
        static public void addNewNovelSetting(int novelid, DataContext aConText)
        {
            var novelsetting = new Novelsetting();

            novelsetting.Novelid           = novelid;
            novelsetting.Subtitleheading   = true;
            novelsetting.Indentation       = true;
            novelsetting.Oneblanklinedel   = true;
            novelsetting.Multiblanklinedel = 3;
            novelsetting.Preface           = true;
            novelsetting.Trailer           = true;
            novelsetting.Replacestring     = false;
            addNewNovelSetting(novelsetting, aConText);
        }
예제 #3
0
        private static void outputText(string text, bool repflg
                                       , List <Replacesetting> replacesettings
                                       , Novelsetting novelsettings
                                       , StreamWriter sw)
        {
            var novelh     = repflg ? repNStr(text, replacesettings) : text;
            var novelsplit = novelh.Split('\n');

            for (var i = 0; i < novelsplit.Length; i++)
            {
                var s = "";
                var n = "";
                var u = getNovelSplitAddLine(novelsplit, i, -1);
                if (novelsettings.Multiblanklinedel == 0)
                {
                    s = getNovelSplitAddLine(novelsplit, i, 0);
                    n = getNovelSplitAddLine(novelsplit, i, 1);
                }
                else
                {
                    var mlflg = true;
                    var recs  = new string[novelsettings.Multiblanklinedel + 1];
                    for (var j = 0; j < recs.Length; j++)
                    {
                        recs[j] = getNovelSplitAddLine(novelsplit, i, j);

                        if (!String.IsNullOrWhiteSpace(recs[j]))
                        {
                            mlflg = false;
                        }
                    }
                    if (mlflg)
                    {
                        continue;
                    }
                    s = recs[0];
                    n = recs[1];
                }

                if (novelsettings.Oneblanklinedel &&
                    !String.IsNullOrWhiteSpace(u) &&
                    String.IsNullOrWhiteSpace(s) &&
                    !String.IsNullOrWhiteSpace(n))
                {
                    continue;
                }

                if (s.Trim().StartsWith("※"))
                {
                    s = s.Replace("※", ASTERISK);
                }

                if (s.Trim().StartsWith("《"))
                {
                    s = s.Replace("《", DOUBLE_BRACKETS.START)
                        .Replace("》", DOUBLE_BRACKETS.END);
                }

                if (novelsettings.Indentation &&
                    !String.IsNullOrWhiteSpace(s) &&
                    !s.StartsWith("「") &&
                    !s.StartsWith("『") &&
                    !s.StartsWith("〔") &&
                    !s.StartsWith("(") &&
                    !s.StartsWith("【") &&
                    !s.StartsWith("≪") &&
                    !s.StartsWith("※"))
                {
                    s = " " + s;
                }

                s = s.Replace("&quot;", @"""")
                    .Replace("&lt;", "<")
                    .Replace("&gt;", ">")
                    .Replace("&amp;", "&");

                sw.WriteLine(s);
            }
            sw.WriteLine("");
        }