예제 #1
0
        private void  DisplayRestoreWindow()
        {
            var restoreWindow = new RestoreWindow();

            restoreWindow.Show();
            Messenger.Default.Send <List <string> >(UnfixerWorker.GetBackupList(_gameDataPath), "Restore");
        }
예제 #2
0
        public void AllUnfixedDllsHaveABackupCreated()
        {
            //Arrange
            SetupFolders();
            UnfixerWorker.Setup(KspTestPath);
            var unfixerWorker = new UnfixerWorker();
            var logicalCores  = Environment.ProcessorCount;


            //Act
            var unfixerWorkers = new UnfixerWorker[logicalCores];
            var unfixerTasks   = new Task[logicalCores];


            for (var i = 0; i < logicalCores; i++)
            {
                unfixerWorkers[i] = new UnfixerWorker();
                unfixerTasks[i]   = unfixerWorkers[i].StartUnfixing(null);
            }

            Task.WaitAll(unfixerTasks);
            var totalUnfixed = UnfixerWorker.UnfixingResultsDictionary.Values.Count(x => x == UnfixState.Unfixed);

            var totalBackups = UnfixerWorker.GetBackupList(Path.Combine(KspTestPath, Resources.GameData)).Count();

            Assert.AreEqual(totalBackups, totalUnfixed);
        }
예제 #3
0
 /// <summary>
 /// Initializes a new instance of the MainViewModel class.
 /// </summary>
 public MainViewModel()
 {
     if (IsInDesignMode)
     {
         _gameDataPath   = Path.Combine(Resources.KSPDirectory, Resources.GameData);
         _filesProcessed = 50;
         _numberOfDlls   = 100;
     }
     _filesProcessed = 0;
     _numberOfDlls   = 100;
     DisplayFolderBrowserDialogCommand = new RelayCommand(DisplayFolderBrowserDialog, () => true);
     UnfixCommand = new RelayCommand(UnfixerRunAsyncTask,
                                     () => (_gameDataPath != string.Empty));
     RestoreCommand = new RelayCommand(DisplayRestoreWindow, () => (_gameDataPath != string.Empty && UnfixerWorker.GetBackupList(_gameDataPath).Count > 0));
 }