diff --git a/apps/server-net/FormatFixer/FormatFixer.csproj b/apps/server-net/FormatFixer/FormatFixer.csproj deleted file mode 100644 index ed9781c..0000000 --- a/apps/server-net/FormatFixer/FormatFixer.csproj +++ /dev/null @@ -1,10 +0,0 @@ - - - - Exe - net10.0 - enable - enable - - - diff --git a/apps/server-net/FormatFixer/Program.cs b/apps/server-net/FormatFixer/Program.cs deleted file mode 100644 index 0fedeb3..0000000 --- a/apps/server-net/FormatFixer/Program.cs +++ /dev/null @@ -1,80 +0,0 @@ -using System; -using System.IO; - -namespace FormatFixer -{ - class Program - { - static void Main(string[] args) - { - var srcPath = @"e:\GIT\forkmessager\apps\server-net\src"; - var files = Directory.GetFiles(srcPath, "*.cs", SearchOption.AllDirectories); - foreach (var file in files) - { - var lines = File.ReadAllLines(file); - bool changed = false; - for (int i = 0; i < lines.Length; i++) - { - var line = lines[i]; - var stripped = line.TrimStart(); - if ((stripped.StartsWith("if (") || stripped.StartsWith("if(") || - stripped.StartsWith("foreach (") || stripped.StartsWith("foreach(")) - && stripped.EndsWith(";")) - { - // Check if it's already a block - if (stripped.Contains("{")) continue; - - int parenCount = 0; - bool inString = false; - int firstParenIdx = line.IndexOf('('); - int condEndIdx = -1; - - for (int j = firstParenIdx; j < line.Length; j++) - { - char c = line[j]; - if (c == '"' && line[j - 1] != '\\') - { - inString = !inString; - } - else if (!inString) - { - if (c == '(') parenCount++; - else if (c == ')') - { - parenCount--; - if (parenCount == 0) - { - condEndIdx = j; - break; - } - } - } - } - - if (condEndIdx != -1) - { - var statement = line.Substring(condEndIdx + 1).Trim(); - if (!string.IsNullOrEmpty(statement) && !statement.StartsWith("{") && statement.EndsWith(";")) - { - var indent = line.Substring(0, line.Length - line.TrimStart().Length); - var newLine1 = line.Substring(0, condEndIdx + 1); - var newLine2 = indent + "{"; - var newLine3 = indent + " " + statement; - var newLine4 = indent + "}"; - - lines[i] = newLine1 + Environment.NewLine + newLine2 + Environment.NewLine + newLine3 + Environment.NewLine + newLine4; - changed = true; - } - } - } - } - if (changed) - { - File.WriteAllText(file, string.Join(Environment.NewLine, lines)); - Console.WriteLine("Fixed: " + file); - } - } - Console.WriteLine("Formatting complete."); - } - } -}