예제 #1
0
        public void PopulateModifiedBasegameFiles(Func <string, bool> restoreBasegamefileConfirmationCallback,
                                                  Func <string, bool> restoreSfarConfirmationCallback,
                                                  Action notifySFARRestoringCallback,
                                                  Action notifyFileRestoringCallback,
                                                  Action <object> notifyRestoredCallback)
        {
            ModifiedBasegameFiles.ClearEx();
            ModifiedSFARFiles.ClearEx();

            List <string> modifiedSfars = new List <string>();
            List <string> modifiedFiles = new List <string>();

            void failedCallback(string file)
            {
                if (file.EndsWith(@".sfar"))
                {
                    modifiedSfars.Add(file);
                    return;
                }

                if (file == getALOTMarkerFilePath())
                {
                    return; //Do not report this file as modified or user will desync game state with texture state
                }
                modifiedFiles.Add(file);
            }

            VanillaDatabaseService.ValidateTargetAgainstVanilla(this, failedCallback);

            ModifiedSFARFiles.AddRange(modifiedSfars.Select(file => new SFARObject(file, this, restoreSfarConfirmationCallback, notifySFARRestoringCallback, notifyRestoredCallback)));
            ModifiedBasegameFiles.AddRange(modifiedFiles.Select(file => new ModifiedFileObject(file.Substring(TargetPath.Length + 1), this,
                                                                                               restoreBasegamefileConfirmationCallback,
                                                                                               notifyFileRestoringCallback,
                                                                                               notifyRestoredCallback)));
        }
예제 #2
0
 /// <summary>
 /// Call this when the modified object lists are no longer necessary
 /// </summary>
 public void DumpModifiedFilesFromMemory()
 {
     ModifiedBasegameFiles.ClearEx();
     ModifiedSFARFiles.ClearEx();
     foreach (var uiInstalledDlcMod in UIInstalledDLCMods)
     {
         uiInstalledDlcMod.ClearHandlers();
     }
     UIInstalledDLCMods.ClearEx();
 }
예제 #3
0
        /// <summary>
        /// Call this when the modified object lists are no longer necessary
        /// </summary>
        public void DumpModifiedFilesFromMemory()
        {
            //Some commands are made from a background thread, which means this might not be called from dispatcher
            App.Current.Dispatcher.Invoke(delegate
            {
                ModifiedBasegameFiles.ClearEx();
                ModifiedSFARFiles.ClearEx();
                foreach (var uiInstalledDlcMod in UIInstalledDLCMods)
                {
                    uiInstalledDlcMod.ClearHandlers();
                }

                UIInstalledDLCMods.ClearEx();
            });
        }
예제 #4
0
        public void PopulateModifiedBasegameFiles(Func <string, bool> restoreBasegamefileConfirmationCallback,
                                                  Func <string, bool> restoreSfarConfirmationCallback,
                                                  Action notifySFARRestoringCallback,
                                                  Action notifyFileRestoringCallback,
                                                  Action <object> notifyRestoredCallback)
        {
            ModifiedBasegameFiles.ClearEx();
            ModifiedSFARFiles.ClearEx();

            List <string> modifiedSfars = new List <string>();
            List <string> modifiedFiles = new List <string>();

            void failedCallback(string file)
            {
                if (file.EndsWith(@".sfar"))
                {
                    modifiedSfars.Add(file);
                    return;
                }

                if (file == getALOTMarkerFilePath())
                {
                    return; //Do not report this file as modified or user will desync game state with texture state
                }
                modifiedFiles.Add(file);
            }

            VanillaDatabaseService.ValidateTargetAgainstVanilla(this, failedCallback);

            List <string> inconsistentDLC = new List <string>();

            VanillaDatabaseService.ValidateTargetDLCConsistency(this, x => inconsistentDLC.Add(x));

            modifiedSfars.AddRange(inconsistentDLC.Select(x => Path.Combine(x, "CookedPCConsole", "Default.sfar")));
            modifiedSfars = modifiedSfars.Distinct().ToList(); //filter out if modified + inconsistent

            ModifiedSFARFiles.AddRange(modifiedSfars.Select(file => new SFARObject(file, this, restoreSfarConfirmationCallback, notifySFARRestoringCallback, notifyRestoredCallback)));
            ModifiedBasegameFiles.AddRange(modifiedFiles.Select(file => new ModifiedFileObject(file.Substring(TargetPath.Length + 1), this,
                                                                                               restoreBasegamefileConfirmationCallback,
                                                                                               notifyFileRestoringCallback,
                                                                                               notifyRestoredCallback)));
        }
예제 #5
0
        public void PopulateModifiedBasegameFiles(Func <string, bool> restoreBasegamefileConfirmationCallback,
                                                  Func <string, bool> restoreSfarConfirmationCallback,
                                                  Action notifySFARRestoringCallback,
                                                  Action notifyFileRestoringCallback,
                                                  Action <object> notifyRestoredCallback)
        {
            ModifiedBasegameFiles.ClearEx();
            ModifiedSFARFiles.ClearEx();
            void failedCallback(string file)
            {
                //todo: Filter out SFARs?
                if (file.EndsWith(@".sfar"))
                {
                    ModifiedSFARFiles.Add(new SFARObject(file, this, restoreSfarConfirmationCallback, notifySFARRestoringCallback, notifyRestoredCallback));
                    return;
                }
                ModifiedBasegameFiles.Add(new ModifiedFileObject(file.Substring(TargetPath.Length + 1), this,
                                                                 restoreBasegamefileConfirmationCallback,
                                                                 notifyFileRestoringCallback,
                                                                 notifyRestoredCallback));
            }

            VanillaDatabaseService.ValidateTargetAgainstVanilla(this, failedCallback);
        }