From b0d0fef5b04b451ade04d6cb87ae897ced3bcad4 Mon Sep 17 00:00:00 2001 From: Miepee <38186597+Miepee@users.noreply.github.com> Date: Sat, 21 Aug 2021 08:42:09 +0200 Subject: [PATCH] Fix RecursiveRollover with non-log files. --- AM2RLauncher/AM2RLauncher/MainForm/HelperMethods.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/AM2RLauncher/AM2RLauncher/MainForm/HelperMethods.cs b/AM2RLauncher/AM2RLauncher/MainForm/HelperMethods.cs index bc8f920..e55f0af 100644 --- a/AM2RLauncher/AM2RLauncher/MainForm/HelperMethods.cs +++ b/AM2RLauncher/AM2RLauncher/MainForm/HelperMethods.cs @@ -106,15 +106,15 @@ namespace AM2RLauncher.Helpers /// Performs recursive rollover on a set of log files. /// /// The log file to begin the rollover from. - /// The maximum amount of log files to retain. Default is int.MaxValue, in other words, never delete files. - public static void RecursiveRollover(string logFile, int max = int.MaxValue) + /// The maximum amount of log files to retain. Default is 9, as that's the highest digit. + public static void RecursiveRollover(string logFile, int max = 9) { int index = 1; char endChar = logFile[logFile.Length - 1]; string fileName; // If not the original file, set the new index and get the new fileName. - if (endChar != 't') + if (char.IsNumber(endChar)) { index = int.Parse(endChar.ToString()) + 1; fileName = logFile.Remove(logFile.Length - 1) + index;