private static int FindSection(string config, string section) { TextPtr ptr = new TextPtr(config); if (!MatchesSection(ref ptr, section)) { while (!ptr.IsOutOfBounds()) { ptr = TextPtr.op_Increment(ptr.Find("\n")); if (ptr.Char == '[') { if (MatchesSection(ref ptr, section)) { return(ptr.Index); } } else if (ptr.StartsWith("---")) { ptr = (ptr + 3).SkipWhitespace(false); if (ptr.IsEndOfLine()) { break; } } } } else { return(ptr.Index); } return(-1); }