From dac281c91c83557bff74247ac8e9f382c0ac6bd1 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 22:52:52 +0000 Subject: [PATCH 1/2] Initial plan From 50fc49a59fa412b4d7bd41103d40743b65324ffe Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Wed, 4 Mar 2026 22:58:47 +0000 Subject: [PATCH 2/2] Include current version in backup file names Co-authored-by: BornToBeRoot <16019165+BornToBeRoot@users.noreply.github.com> --- .../NETworkManager.Profiles/ProfileManager.cs | 2 +- .../SettingsManager.cs | 2 +- .../TimestampHelper.cs | 19 +++++++++++++++---- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/Source/NETworkManager.Profiles/ProfileManager.cs b/Source/NETworkManager.Profiles/ProfileManager.cs index c32ae88977..89024424a3 100644 --- a/Source/NETworkManager.Profiles/ProfileManager.cs +++ b/Source/NETworkManager.Profiles/ProfileManager.cs @@ -1317,7 +1317,7 @@ private static void CreateDailyBackupIfNeeded() // Create backup Backup(LoadedProfileFile.Path, GetProfilesBackupFolderLocation(), - TimestampHelper.GetTimestampFilename(profileFileName)); + TimestampHelper.GetTimestampFilename(profileFileName, AssemblyManager.Current.Version.ToString())); // Cleanup old backups CleanupBackups(GetProfilesBackupFolderLocation(), diff --git a/Source/NETworkManager.Settings/SettingsManager.cs b/Source/NETworkManager.Settings/SettingsManager.cs index d3b7809284..15d51967d2 100644 --- a/Source/NETworkManager.Settings/SettingsManager.cs +++ b/Source/NETworkManager.Settings/SettingsManager.cs @@ -366,7 +366,7 @@ private static void CreateDailyBackupIfNeeded() // Create backup Backup(GetSettingsFilePath(), GetSettingsBackupFolderLocation(), - TimestampHelper.GetTimestampFilename(GetSettingsFileName())); + TimestampHelper.GetTimestampFilename(GetSettingsFileName(), AssemblyManager.Current.Version.ToString())); // Cleanup old backups CleanupBackups(GetSettingsBackupFolderLocation(), diff --git a/Source/NETworkManager.Utilities/TimestampHelper.cs b/Source/NETworkManager.Utilities/TimestampHelper.cs index 6ee5e83c09..4565d22523 100644 --- a/Source/NETworkManager.Utilities/TimestampHelper.cs +++ b/Source/NETworkManager.Utilities/TimestampHelper.cs @@ -12,13 +12,24 @@ public static string GetTimestamp() } /// - /// Generates a filename by prefixing the specified filename with a timestamp string. + /// Generates a filename by prefixing the specified filename with a timestamp string and an optional version string. /// /// The original filename to be prefixed with a timestamp. Cannot be null or empty. - /// A string containing the timestamp followed by an underscore and the original filename. - public static string GetTimestampFilename(string fileName) + /// + /// An optional version string to include between the timestamp and the filename. If provided, dots in the + /// version are replaced with dashes (e.g., "2026.3.4.0" becomes "2026-3-4-0"). + /// + /// + /// A string in the format <timestamp>_<version>_<fileName> when a version is + /// provided, or <timestamp>_<fileName> otherwise. + /// + public static string GetTimestampFilename(string fileName, string version = null) { - return $"{GetTimestamp()}_{fileName}"; + var versionSegment = string.IsNullOrWhiteSpace(version) + ? string.Empty + : $"_{version.Replace('.', '-')}"; + + return $"{GetTimestamp()}{versionSegment}_{fileName}"; } ///