Example #1
0
        public static EachBuilder <T> FormatLine <T>(this EachBuilder <T> code, string format, Func <T, string> args1, Func <T, string> args2, Func <T, string> args3)
        {
            var action = new Action <T>(t => code.Builder.FormatLine(format, args1(t), args2(t), args3(t)));

            code.Actions.Add(action);
            return(code);
        }
Example #2
0
        public static EachBuilder <T> Line <T>(this EachBuilder <T> code, string text, bool ignoreIndent = false)
        {
            var action = new Action <T>(t => code.Builder.Line(text, ignoreIndent));

            code.Actions.Add(action);
            return(code);
        }
Example #3
0
        public static EachBuilder <T> Line <T>(this EachBuilder <T> code)
        {
            var action = new Action <T>(t => code.Builder.Line());

            code.Actions.Add(action);
            return(code);
        }
Example #4
0
        public static EachBuilder <T> PopLine <T>(this EachBuilder <T> code, string text)
        {
            var action = new Action <T>(t => code.Builder.PopLine(text));

            code.Actions.Add(action);
            return(code);
        }
Example #5
0
 public static StringBuilder EndEach <T>(this EachBuilder <T> code)
 {
     foreach (var item in code.List)
     {
         foreach (var action in code.Actions)
         {
             action(item);
         }
     }
     return(code.Builder);
 }
Example #6
0
 public static EachBuilder <T> Include <T>(this EachBuilder <T> code, string header)
 {
     // TODO: Check File Exsist
     if (header.Trim().StartsWith("<"))
     {
         code.Line(string.Format("#include {0}", header), true);
     }
     else
     {
         code.Line(string.Format("#include \"{0}\"", header), true);
     }
     return(code);
 }
Example #7
0
 public static EachBuilder <T> Include <T>(this EachBuilder <T> code, string format, Func <T, string> args1, Func <T, string> args2, Func <T, string> args3)
 {
     // TODO: Check File Exsist
     if (format.Trim().StartsWith("<"))
     {
         var finalFormat = string.Format("#include {0}", format);
         code.FormatLine(finalFormat, args1, args2, args3);
     }
     else
     {
         var finalFormat = string.Format("#include \"{0}\"", format);
         code.FormatLine(finalFormat, args1, args2, args3);
     }
     return(code);
 }