Exemplo n.º 1
0
        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);
            }
        }
Exemplo n.º 2
0
        /*
         * 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);
            }
        }
Exemplo n.º 3
0
        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);
        }
Exemplo n.º 4
0
        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);
                }
            }
        }