public static void DeleteSave(UserDataStateRelay toDelete) { try { Directory.Delete(toDelete.Location, true); if (toDelete.Location == ActiveSave?.Location) { Directory.CreateDirectory(toDelete.Location); } if (AllBackups.Contains(toDelete)) { AllBackups.Remove(toDelete); } else if (ActiveSave == toDelete) { ActiveSave = null; } } catch (IOException ioe) { Wood.WriteLine($"ERROR DELETING SAVE {toDelete.MyName}:"); Wood.Indent(); Wood.WriteLine(ioe); Wood.Unindent(); } }
public static void StashActiveSave() { if (!BlepOut.IsMyPathCorrect) { return; } UserDataStateRelay udsr = ActiveSave ?? new UserDataStateRelay(UserDataFolder); AllBackups.Add(udsr.CloneTo(PathForNewBackup)); }
public static void LoadBackupList() { bool flag = BlepOut.IsMyPathCorrect; if (!Directory.Exists(BackupFolderPath)) { Directory.CreateDirectory(BackupFolderPath); } if (flag) { ActiveSave = new UserDataStateRelay(UserDataFolder) { CreationTime = DateTime.Now }; } AllBackups.Clear(); foreach (DirectoryInfo dir in new DirectoryInfo(BackupFolderPath).GetDirectories()) { AllBackups.Add(new UserDataStateRelay(dir) { }); } }