public void Backup(bool restoreOriginal = false) { // backup files from raw data path to the mod directory ModDataSynchronizer synchronizer = DataSynchronizer; synchronizer.BackupToMod(); if (restoreOriginal) { ModTools.RestoreOriginalData(synchronizer.ChangedFiles); } }
private void RestoreOriginalData(object sender, EventArgs e) { if (SelectedMod != null) { if (MessageBox.Show("This will undo all changes for the currently set mod.\nContinue?", "Really restore data?", MessageBoxButtons.OKCancel) == DialogResult.Cancel) { return; } } ModTools.RestoreOriginalData(); }
public static void RestoreOriginalData(List <string> restoreCandidates) { // restore edited files from original raw data DirectorySynchronizer synchronizer = RestoreSynchronizer; foreach (string file in restoreCandidates) { synchronizer.SynchronizeFile(file); } ModTools.SetBobRulePackName("mod"); if (Directory.Exists(Instance.RetailPath)) { Directory.Delete(Instance.RetailPath, true); } }
/* * Restore raw_data from backup and clean working_data directory. */ public static void RestoreOriginalData() { // restore edited files from original raw data DirectorySynchronizer synchronizer = RestoreSynchronizer; foreach (string directory in Instance.OriginalDataAccessor.GetDirectories("")) { synchronizer.Synchronize(directory); } ModTools.SetBobRulePackName("mod"); if (Directory.Exists(Instance.RetailPath)) { Directory.Delete(Instance.RetailPath, true); } }
/* * Remove the given mod from the list. */ public void DeleteMod(Mod mod) { if (mods.Remove(mod)) { if (mod == CurrentMod) { // prevent the mod from backing up its data upon deactivation // if it is the current mod currentMod = null; ModTools.RestoreOriginalData(); if (CurrentModSet != null) { CurrentModSet(); } } ModListChanged(); Directory.Delete(mod.ModDirectory, true); } }