private void QueueDownload(ExtendedMod mod) { var matchingModObject = MissingMods.First(x => x.FileId == mod.FileId && x.ModId == mod.ModId); MissingMods.First(x => x == matchingModObject).IsIndeterminateProcess = true; _downloadClient.QueueDownload(mod, string.Empty); }
private void QueueDownload(ExtendedMod mod) { lock (MissingMods) { MissingMods.ToList().Where(x => x.Md5 == mod.Md5 && x.FileName == mod.FileName).ToList() .ForEach(x => x.IsIndeterminateProcess = true); } _downloadClient.QueueDownload(mod, string.Empty); }
private void OpenNexusLink(ExtendedMod mod) { if (mod.Repository == "NexusMods") { Process.Start($"https://nexusmods.com/{mod.TargetGame.ToLower()}/mods/{mod.ModId}?tab=files"); } else { Process.Start($"https://www.google.com/search?q={Path.GetFileNameWithoutExtension(mod.FileName)}"); } }
private void DownloadUpdate(object sender, ExtendedMod e) { if (e.CurrentDownloadProgress == 100) { _installBase.ModpackMods.Where(x => x.Md5 == e.Md5).ToList() .ForEach(x => x.FilePath = e.FilePath); var matchingMods = MissingMods.Where(x => x.Md5 == e.Md5).ToList(); foreach (var matchingMod in matchingMods) { Application.Current.Dispatcher.BeginInvoke((Action) delegate { _missingModsLocked = true; if (MissingMods.IndexOf(matchingMod) != -1) { MissingMods.RemoveAt(MissingMods.IndexOf(matchingMod)); RemainingMissingModCount--; } _missingModsLocked = false; }); } } else { var missingMods = MissingMods.ToList(); foreach (var matchingMissingMod in missingMods.Where(x => x.Md5 == e.Md5).ToList()) { Application.Current.Dispatcher.BeginInvoke((Action) delegate { _missingModsLocked = true; var index = MissingMods.IndexOf(matchingMissingMod); if (index == -1) { return; } MissingMods[MissingMods.IndexOf(matchingMissingMod)].CurrentDownloadProgress = e.CurrentDownloadProgress; _missingModsLocked = false; }); } } }
public async Task <string> GenerateModDownloadLinkAsync(ExtendedMod mod) { _logger.WriteLine($"GenerateModDownloadLink()"); if (mod.ModId == null || mod.FileId == null) { return(null); } var url = $"/v1/games/{mod.TargetGame.ToLower()}/mods/{mod.ModId}/files/{mod.FileId}/download_link"; var apiResult = await MakeGenericApiCall(url); if (apiResult == null) { _logger.WriteLine($"Failed to generate download link: {mod.ModName},{mod.ModId},{mod.FileId}"); return(null); } return(JArray.Parse(apiResult)[0]["URI"].ToString()); }
private async void FindAndValidateMod(ExtendedMod mod) { var possibleArchiveMatch = await _fileSystemBrowser.OpenFileBrowserAsync($"{mod.ModName}|{mod.FileName}|All Matching Extensions|*{Path.GetExtension(mod.FileName)}|All Files|*.*", $"Please select the matching mod archive: {mod.FileName}"); if (string.IsNullOrEmpty(possibleArchiveMatch)) { return; } var filteredMissingMods = _validate.ValidateTargetModArchive(possibleArchiveMatch, MissingMods.ToList()); RemainingMissingModCount = filteredMissingMods.Count; await Application.Current.Dispatcher.BeginInvoke((Action) delegate { _missingModsLocked = true; MissingMods = new RangeObservableCollection <ExtendedMod>(); MissingMods.AddRange(filteredMissingMods); _missingModsLocked = false; }); }