Esempio n. 1
0
 public static List<string> SubNames(Deli d)
 {
     List<string> result = new List<string>();
     foreach (Deli m in d.Subs) result.Add(m.Name);
     //d.Subs.ForEach(m => result.Add(m.Name));
     return result;
 }
Esempio n. 2
0
 public static Deli Load(TextReader r)
 {
     Deli result = new Deli();
     string line;
     while ((line = r.ReadLine()) != null) Parse(ref result, line);
     while (result.Parent != null) result = result.Parent;
     return result;
 }
Esempio n. 3
0
 public static void Parse(ref Deli deli, string line)
 {
     string ln;
     int d;
     ln = line.TrimStart();
     if ((d = ln.IndexOf("#")) == 0)
     {
         d++;
         while (d < ln.Length && ln[d] == '#') d++;
         if (d > (deli.Depth + 1)) throw new Exception("Structure Error. Too much '#' in line:" + line + ".");
         while (deli.Depth >= d) { deli = deli.Parent; }
         Deli tmp = new Deli();
         tmp.Name = ln.Substring(d).Trim();
         tmp.Parent = deli;
         deli = tmp;
         deli.Parent.Subs.Add(deli);
     }
     else
     {
         deli.List.Add(line);
     }
 }
Esempio n. 4
0
        public void SetUp()
        {
            #region master data
            Deli tmp = Deli.Load(@"
            #a
            a
            ##1
            a-1
            ###1
            a-1-1
            ###2
            a-1-2
            ###3
            a-1-3

            ##2
            a-2
            ###1
            a-2-1
            ###2
            a-2-2
            ###3
            a-2-3

            ##3
            a-3
            ###1
            a-3-1
            ###2
            a-3-2
            ###3
            a-3-3

            #b
            b
            ##1
            b-1
            ###1
            b-1-1
            ###2
            b-1-2
            ###3
            b-1-3

            ##2
            b-2
            ###1
            b-2-1
            ###2
            b-2-2
            ###3
            b-2-3

            ##3
            b-3
            ###1
            b-3-1
            ###2
            b-3-2
            ###3
            b-3-3

            #c
            c
            ##1
            c-1
            ###1
            c-1-1
            ###2
            c-1-2
            ###3
            c-1-3

            ##2
            c-2
            ###1
            c-2-1
            ###2
            c-2-2
            ###3
            c-2-3

            ##3
            c-3
            ###1
            c-3-1
            ###2
            c-3-2
            ###3
            c-3-3

            ");
            Master = tmp.Sub("#a#1");
            #endregion
        }
Esempio n. 5
0
 public void SetUp()
 {
     QuotesTest = Deli.Load(TestsText).Sub("QuotesTest");
 }