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); } }
public void BackupToMod() { restoreFromOriginal.Clear(); DirectorySynchronizer synchronizer = new DirectorySynchronizer { // from working set SourceAccessor = WorkingSetAccessor, // to mod backup directory TargetAccessor = ModAccessor, // only if file was edited and there isn't a recent backup already CopyFile = BackupIfEdited }; foreach (string dir in WorkingSetAccessor.GetDirectories("")) { if (BackupDir(dir)) { synchronizer.Synchronize(dir); } } // remember all files that were backed up restoreFromOriginal.AddRange(synchronizer.SynchronizedFiles); }
public void SynchronizeFromMod() { DirectorySynchronizer synchronizer = new DirectorySynchronizer { // from mod SourceAccessor = ModAccessor, // to working set TargetAccessor = WorkingSetAccessor, // all files CopyFile = DirectorySynchronizer.AlwaysCopy, // don't delete any files that are already there... // we assume the target directory is in its original state // and we need all files that weren't included in the backup DeleteAdditionalFiles = false }; foreach (string dir in ModAccessor.GetDirectories("")) { if (BackupDir(dir)) { synchronizer.Synchronize(dir); } } }