Exemplo n.º 1
0
        private static string IndentText(string text, int indent, ref bool startLine)
        {
            string          output  = "";
            Regex           reg     = new Regex("((.*" + Environment.NewLine + ")|.*$)");
            MatchCollection matches = reg.Matches(text);

            foreach (Match m in matches)
            {
                if (!String.IsNullOrEmpty(m.Groups[1].Value))
                {
                    if (!startLine)
                    {
                        if (m.Groups[1].Value.EndsWith(Environment.NewLine))
                        {
                            startLine = true;
                        }
                        output += m.Groups[1].Value;
                    }
                    else
                    {
                        if (!m.Groups[1].Value.EndsWith(Environment.NewLine))
                        {
                            startLine = false;
                        }
                        output += FinalFile.Indent(indent) + m.Groups[1].Value;
                    }
                }
            }
            return(output);
        }
Exemplo n.º 2
0
 public void WriteToFile(IProcessInstance proc, FinalFile file)
 {
     if (proc.CurrentScope.Exists(proc.DefaultWriter))
     {
         string writer = proc.CurrentScope.GetVariable(proc.DefaultWriter).ValueString;
         FinalFile.Indent(ref writer);
         proc.CurrentScope.GetVariable(proc.DefaultWriter).Value = writer;
     }
 }