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}"; } ///