diff --git a/CHANGELOG.md b/CHANGELOG.md index ff0d7126..f06cd045 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,12 @@ Discord support server: https://discord.gg/vBDzZAq3AF. Please always post your [KSP.log file](https://gist.github.com/JonnyOThan/04c2074b56f78e56d115621effee30f9) when reporting issues. +## Unreleased + +### Bug Fixes + +- Fixed AGMEMO system (did I even test this?) + ## 1.0.1 - 2024-09-13 ### New Features diff --git a/RasterPropMonitor/Core/RasterPropMonitorComputer.cs b/RasterPropMonitor/Core/RasterPropMonitorComputer.cs index 1468e55e..15a9a8b3 100644 --- a/RasterPropMonitor/Core/RasterPropMonitorComputer.cs +++ b/RasterPropMonitor/Core/RasterPropMonitorComputer.cs @@ -392,11 +392,11 @@ public void Start() string[] descriptionStrings = vesselDescription.UnMangleConfigText().Split(JUtil.LineSeparator, StringSplitOptions.None); for (int i = 0; i < descriptionStrings.Length; i++) { - var matches = x_agmemoRegex.Matches(descriptionStrings[i]); - if (matches.Count == 2 && uint.TryParse(matches[0].Value, out uint groupID) && groupID < actionGroupMemo.Length) + var match = x_agmemoRegex.Match(descriptionStrings[i]); + if (match.Success && match.Groups.Count == 3 && uint.TryParse(match.Groups[1].Value, out uint groupID) && groupID < actionGroupMemo.Length) { descriptionStrings[i] = string.Empty; - actionGroupMemo[groupID] = matches[1].Value; + actionGroupMemo[groupID] = match.Groups[2].Value; } } diff --git a/RasterPropMonitor/Core/UtilityFunctions.cs b/RasterPropMonitor/Core/UtilityFunctions.cs index 906172d8..24cf50ca 100644 --- a/RasterPropMonitor/Core/UtilityFunctions.cs +++ b/RasterPropMonitor/Core/UtilityFunctions.cs @@ -1357,12 +1357,19 @@ public static string EnforceSlashes(this string input) public static string UnMangleConfigText(this string input) { - return input.Replace("<=", "{").Replace("=>", "}").Replace("$$$", Environment.NewLine); + return input + .Replace("<=", "{") + .Replace("=>", "}") + .Replace("$$$", Environment.NewLine); } public static string MangleConfigText(this string input) { - return input.Replace("{", "<=").Replace("}", "=>").Replace(Environment.NewLine, "$$$"); + return input + .Replace("{", "<=") + .Replace("}", "=>") + .Replace("\n", "$$$") + .Replace("\r", string.Empty); } public static T Clamp(this T val, T min, T max) where T : IComparable