protected string Indent(string test) { test = test ?? string.Empty; if (!Indents.ContainsKey(test)) { return(test); } else { return(test.Indent(2 * Indents[test])); } }
private string ExtractIndent(string test, bool setIndent) { test = test ?? string.Empty; string trimmedTest = test.TrimStart(' '); int indent = (test.Length - trimmedTest.Length) / 2; int oldIndent = 0; if (Indents.ContainsKey(trimmedTest)) { oldIndent = Indents[trimmedTest]; } if (setIndent && oldIndent < indent) { Indents[trimmedTest] = indent; } return(trimmedTest); }