Пример #1
0
 public ModUpdateInformation(List <OnlineContent.ModUpdateInfo> modsWithUpdates)
 {
     DataContext = this;
     modsWithUpdates.ForEach(x =>
     {
         x.ApplyUpdateCommand = new RelayCommand(ApplyUpdateToMod, CanApplyUpdateToMod);
         x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdate);
     });
     UpdatableMods.AddRange(modsWithUpdates);
     LoadCommands();
     InitializeComponent();
 }
Пример #2
0
 public ModUpdateInformation(List <OnlineContent.ModUpdateInfo> modsWithUpdates)
 {
     DataContext = this;
     modsWithUpdates.ForEach(x =>
     {
         x.ApplyUpdateCommand = new RelayCommand(ApplyUpdateToMod, CanApplyUpdateToMod);
         if (x.mod.ModModMakerID > 0 && BackupService.GetGameBackupPath(x.mod.Game) == null)
         {
             x.DownloadButtonText = M3L.GetString(M3L.string_requiresBackup);
         }
         else
         {
             x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdate);
         }
     });
     UpdatableMods.AddRange(modsWithUpdates);
     LoadCommands();
     InitializeComponent();
 }
        private void DownloadAll()
        {
            var updates = UpdatableMods.Where(x => x.CanUpdate && (x.mod.ModClassicUpdateCode > 0 || x.mod.ModModMakerID > 0)).ToList();

            OperationInProgress = true;
            CommandManager.InvalidateRequerySuggested();

            Task.Run(() =>
            {
                object syncObj = new object();

                void updateDone()
                {
                    lock (syncObj)
                    {
                        Monitor.Pulse(syncObj);
                    }
                }

                foreach (var update in updates)
                {
                    if (update is OnlineContent.ModMakerModUpdateInfo mui)
                    {
                        UpdateModMakerMod(mui, updateDone);
                        lock (syncObj)
                        {
                            Monitor.Wait(syncObj);
                        }
                    }
                    else if (update.mod.ModClassicUpdateCode > 0)
                    {
                        UpdateClassicMod(update, updateDone);
                        lock (syncObj)
                        {
                            Monitor.Wait(syncObj);
                        }
                    }
                }
            });
        }
 public ModUpdateInformation(List <OnlineContent.ModUpdateInfo> modsWithUpdates)
 {
     modsWithUpdates.ForEach(x =>
     {
         x.ApplyUpdateCommand = new RelayCommand(ApplyUpdateToMod, CanApplyUpdateToMod);
         if (x.mod.ModModMakerID > 0 && BackupService.GetGameBackupPath(x.mod.Game) == null)
         {
             x.DownloadButtonText = M3L.GetString(M3L.string_requiresBackup);
         }
         else if (x.mod.ModClassicUpdateCode > 0 || x.mod.ModModMakerID > 0)
         {
             x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdate);
         }
         else
         {
             x.DownloadButtonText = M3L.GetString(M3L.string_downloadUpdateFromNexusMods);
         }
     });
     UpdatableMods.ReplaceAll(modsWithUpdates);
     LoadCommands();
     InitializeComponent();
 }
Пример #5
0
 private bool TaskNotRunning() => UpdatableMods.All(x => !x.UpdateInProgress);
 private bool CanDownloadAll() => !OperationInProgress && UpdatableMods.Any(x => x.CanUpdate && (x.mod.ModClassicUpdateCode > 0 || x.mod.ModModMakerID > 0));