示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
        }
示例#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);
 }
示例#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);
 }
示例#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);
 }