/// <summary> /// Analyzes the mods asynchronous. /// </summary> /// <param name="id">The identifier.</param> /// <param name="mode">The mode.</param> /// <returns>Task.</returns> protected virtual async Task AnalyzeModsAsync(long id, PatchStateMode mode) { SubscribeToProgressReport(id, Disposables); var overlayProgress = Smart.Format(localizationManager.GetResource(LocalizationResources.Mod_Actions.Overlay_Conflict_Solver_Progress), new { PercentDone = 0.ToLocalizedPercentage(), Count = 1, TotalCount = 4 }); var message = localizationManager.GetResource(LocalizationResources.Mod_Actions.Overlay_Conflict_Solver_Loading_Definitions); await TriggerOverlayAsync(id, true, message, overlayProgress); modPatchCollectionService.InvalidatePatchModState(CollectionMods.SelectedModCollection.Name); modPatchCollectionService.ResetPatchStateCache(); var definitions = await Task.Run(async() => { return(await modPatchCollectionService.GetModObjectsAsync(gameService.GetSelected(), CollectionMods.SelectedMods, CollectionMods.SelectedModCollection.Name).ConfigureAwait(false)); }).ConfigureAwait(false); var conflicts = await Task.Run(() => { if (definitions != null) { return(modPatchCollectionService.FindConflicts(definitions, CollectionMods.SelectedMods.Select(p => p.Name).ToList(), mode)); } return(null); }).ConfigureAwait(false); var syncedConflicts = await Task.Run(async() => { return(await modPatchCollectionService.SyncPatchStateAsync(conflicts, CollectionMods.SelectedModCollection.Name).ConfigureAwait(false)); }).ConfigureAwait(false); if (syncedConflicts != null) { conflicts = syncedConflicts; } var args = new NavigationEventArgs() { SelectedCollection = CollectionMods.SelectedModCollection, Results = conflicts, State = NavigationState.ConflictSolver, SelectedMods = CollectionMods.SelectedMods.Select(p => p.Name).ToList() }; ReactiveUI.MessageBus.Current.SendMessage(args); await TriggerOverlayAsync(id, false); definitionAnalyzeLoadHandler?.Dispose(); definitionLoadHandler?.Dispose(); definitionSyncHandler?.Dispose(); }