From 27ec90a5795f487cbc8a67bf22c5f7ce9ae7c1e5 Mon Sep 17 00:00:00 2001 From: Mentrillum <42941613+Mentrillum@users.noreply.github.com> Date: Fri, 30 Sep 2022 15:05:22 -0700 Subject: [PATCH] Version 1.02 --- Program.cs | 120 ++++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 115 insertions(+), 5 deletions(-) diff --git a/Program.cs b/Program.cs index 9e995b5..c24e2b8 100644 --- a/Program.cs +++ b/Program.cs @@ -2093,7 +2093,29 @@ static void RewriteConfig(string fileName) } else { - rewriteSections = true; + int bracketIndex = 0, bracketLine = i; + while (bracketLine < globalLine.Count && !globalLine[bracketLine].Contains('{')) + { + bracketLine++; + } + bracketLine++; + while (bracketIndex >= 0 && bracketLine < globalLine.Count) + { + if (globalLine[bracketLine].Contains('{')) + { + bracketIndex++; + } + else if (globalLine[bracketLine].Contains('}')) + { + bracketIndex--; + } + bracketLine++; + } + bracketLine--; + if (bracketCheck != bracketLine) + { + rewriteSections = true; + } } } } @@ -2180,7 +2202,29 @@ static void RewriteConfig(string fileName) } else { - rewriteSections = true; + int bracketIndex = 0, bracketLine = i; + while (bracketLine < globalLine.Count && !globalLine[bracketLine].Contains('{')) + { + bracketLine++; + } + bracketLine++; + while (bracketIndex >= 0 && bracketLine < globalLine.Count) + { + if (globalLine[bracketLine].Contains('{')) + { + bracketIndex++; + } + else if (globalLine[bracketLine].Contains('}')) + { + bracketIndex--; + } + bracketLine++; + } + bracketLine--; + if (bracketCheck != bracketLine) + { + rewriteSections = true; + } } } } @@ -2267,7 +2311,29 @@ static void RewriteConfig(string fileName) } else { - rewriteSections = true; + int bracketIndex = 0, bracketLine = i; + while (bracketLine < globalLine.Count && !globalLine[bracketLine].Contains('{')) + { + bracketLine++; + } + bracketLine++; + while (bracketIndex >= 0 && bracketLine < globalLine.Count) + { + if (globalLine[bracketLine].Contains('{')) + { + bracketIndex++; + } + else if (globalLine[bracketLine].Contains('}')) + { + bracketIndex--; + } + bracketLine++; + } + bracketLine--; + if (bracketCheck != bracketLine) + { + rewriteSections = true; + } } } } @@ -2354,7 +2420,29 @@ static void RewriteConfig(string fileName) } else { - rewriteSections = true; + int bracketIndex = 0, bracketLine = i; + while (bracketLine < globalLine.Count && !globalLine[bracketLine].Contains('{')) + { + bracketLine++; + } + bracketLine++; + while (bracketIndex >= 0 && bracketLine < globalLine.Count) + { + if (globalLine[bracketLine].Contains('{')) + { + bracketIndex++; + } + else if (globalLine[bracketLine].Contains('}')) + { + bracketIndex--; + } + bracketLine++; + } + bracketLine--; + if (bracketCheck != bracketLine) + { + rewriteSections = true; + } } } } @@ -2441,7 +2529,29 @@ static void RewriteConfig(string fileName) } else { - rewriteSections = true; + int bracketIndex = 0, bracketLine = i; + while (bracketLine < globalLine.Count && !globalLine[bracketLine].Contains('{')) + { + bracketLine++; + } + bracketLine++; + while (bracketIndex >= 0 && bracketLine < globalLine.Count) + { + if (globalLine[bracketLine].Contains('{')) + { + bracketIndex++; + } + else if (globalLine[bracketLine].Contains('}')) + { + bracketIndex--; + } + bracketLine++; + } + bracketLine--; + if (bracketCheck != bracketLine) + { + rewriteSections = true; + } } } }