Skip to content

Commit 39ac33e

Browse files
committed
Fix: Fixes based on copilot feedback
1 parent c48db9a commit 39ac33e

2 files changed

Lines changed: 6 additions & 6 deletions

File tree

‎Source/NETworkManager.Settings/SettingsInfo.cs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -112,10 +112,10 @@ public string Version
112112
/// <summary>
113113
/// Private field for the <see cref="LastBackup" /> property.
114114
/// </summary>
115-
private DateTime _lastBackup = DateTime.Now.Date;
115+
private DateTime _lastBackup = DateTime.MinValue;
116116

117117
/// <summary>
118-
/// Store the date and time of the last backup of the settings file.
118+
/// Stores the date of the last backup of the settings file.
119119
/// </summary>
120120
public DateTime LastBackup
121121
{

‎Source/NETworkManager.Settings/SettingsManager.cs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ private static void CreateDailyBackupIfNeeded()
303303
private static void CleanupBackups(string backupFolderPath, string settingsFileName, int maxBackupFiles)
304304
{
305305
var backupFiles = Directory.GetFiles(backupFolderPath)
306-
.Where(f => f.EndsWith(settingsFileName) || f.EndsWith(Path.Combine(GetLegacySettingsFileName())))
306+
.Where(f => f.EndsWith(settingsFileName) || f.EndsWith(GetLegacySettingsFileName()))
307307
.OrderByDescending(f => File.GetCreationTime(f))
308308
.ToList();
309309

@@ -325,10 +325,10 @@ private static void CleanupBackups(string backupFolderPath, string settingsFileN
325325
/// <summary>
326326
/// Creates a backup of the specified settings file in the given backup folder with the provided backup file name.
327327
/// </summary>
328-
/// <param name="setingsFilePath">The full path to the settings file to back up. Cannot be null or empty.</param>
328+
/// <param name="settingsFilePath">The full path to the settings file to back up. Cannot be null or empty.</param>
329329
/// <param name="backupFolderPath">The directory path where the backup file will be stored. If the directory does not exist, it will be created.</param>
330330
/// <param name="backupFileName">The name to use for the backup file within the backup folder. Cannot be null or empty.</param>
331-
private static void Backup(string setingsFilePath, string backupFolderPath, string backupFileName)
331+
private static void Backup(string settingsFilePath, string backupFolderPath, string backupFileName)
332332
{
333333
// Create the backup directory if it does not exist
334334
Directory.CreateDirectory(backupFolderPath);
@@ -337,7 +337,7 @@ private static void Backup(string setingsFilePath, string backupFolderPath, stri
337337
var backupFilePath = Path.Combine(backupFolderPath, backupFileName);
338338

339339
// Copy the current settings file to the backup location
340-
File.Copy(setingsFilePath, backupFilePath, true);
340+
File.Copy(settingsFilePath, backupFilePath, true);
341341

342342
Log.Info($"Backup created: {backupFilePath}");
343343
}

0 commit comments

Comments
 (0)