protected void writeInterface(FileStreamWriter text, WcfCleanerOptions options, CodeInterface codeInterface) { text.WriteLine(codeInterface.Headings) .WriteLine(codeInterface.Text); }
protected List<CodeInterface> parseInterfaces(string src, int namespaceIndex, HashSet<string> usingNamespaces, WcfCleanerOptions options) { var interfaces = new List<CodeInterface>(); var interfaceMatches = RegexHelper.MatchesGeneric(@"\s+public interface ([^ ]+) {", src.Substring(namespaceIndex)); int index = namespaceIndex; foreach(var interfaceMatch in interfaceMatches) { int prevIndex = index; index = interfaceMatch.Index + namespaceIndex; string headings = gatherHeadings(src, index + 1, prevIndex, usingNamespaces, options); // Count open/closing curly braces until end of interface int startInterface = 0; int endInterface = 0; countCodeBraces(src, index, out startInterface, out endInterface); string interfaceText = src.Substring(index + 1, endInterface - index); var codeInterface = new CodeInterface { Headings = headings, Text = interfaceText }; interfaces.Add(codeInterface); index = endInterface + 1; } return interfaces; }