diff --git a/Code/IO/Config.cs b/Code/IO/Config.cs index 3c5fff6..47b6275 100644 --- a/Code/IO/Config.cs +++ b/Code/IO/Config.cs @@ -47,7 +47,13 @@ namespace Flowframes.IO List list = lines.ToList(); list.Add(key + "|" + value); list = list.OrderBy(p => p).ToList(); - File.WriteAllLines(configPath, list.ToArray()); + + string newFileContent = ""; + foreach(string line in list) + newFileContent += line + "\n"; + + File.WriteAllText(configPath, newFileContent.Trim()); + cachedLines = list.ToArray(); } @@ -155,7 +161,14 @@ namespace Flowframes.IO private static void Reload() { - cachedLines = File.ReadAllLines(configPath); + List validLines = new List(); + string[] lines = File.ReadAllLines(configPath); + foreach (string line in lines) + { + if(line != null && !string.IsNullOrWhiteSpace(line) && line.Length > 3) + validLines.Add(line); + } + cachedLines = validLines.ToArray(); } } }