private void ProcessResults(WaitableTask <Dictionary <int, EncounterBasicStatus> > result, List <WaitableTask <Dictionary <int, EncounterBasicStatus> > > listResults) { if (result.IsCompleted()) { return; } foreach (var statusesResult in listResults) { if (!statusesResult.IsCompleted()) { return; } } var statuses = new Dictionary <int, EncounterBasicStatus>();; for (int i = 0; i < listResults.Count; i++) { if (listResults[i].Result.HasValue()) { statuses = CombineStatuses(statuses, listResults[i].Result.Value); } } result.SetResult(statuses); }
protected void ProcessResults(WaitableTask task, WaitableTask serverTask, WaitableTask localTask) { if (task.IsCompleted() || !serverTask.IsCompleted() || !localTask.IsCompleted()) { return; } task.SetCompleted(); }
protected void SetEncounters(TaskResult <string> serverResult) { if (demoEncounters == null || demoEncounters.IsCompleted() || serverResult.IsError()) { demoEncounters.SetError(new Exception("Could not get demo encounters from file.")); return; } var splitChars = new char[] { '\n', '\r' }; var encounters = serverResult.Value.Split(splitChars, StringSplitOptions.RemoveEmptyEntries); demoEncounters.SetResult(encounters); }
private void ProcessResult(WaitableTask <Dictionary <int, Dictionary <SaveType, EncounterMetadata> > > result, Dictionary <SaveType, WaitableTask <List <EncounterMetadata> > > metadatasResults) { if (result.IsCompleted()) { return; } foreach (var metadatasResult in metadatasResults) { if (!metadatasResult.Value.IsCompleted()) { return; } } var metadataGroups = new Dictionary <int, Dictionary <SaveType, EncounterMetadata> >(); foreach (var metadatasResult in metadatasResults) { if (!metadatasResult.Value.Result.HasValue()) { continue; } foreach (var metadata in metadatasResult.Value.Result.Value) { AddMetadata(metadataGroups, metadatasResult.Key, metadata); } } // Server metadata filename should be changed to match the local filename // This ensures that the old files are properly renamed if using the server version foreach (var metadataGroup in metadataGroups) { var group = metadataGroup.Value; if (!group.ContainsKey(SaveType.Local) || !group.ContainsKey(SaveType.Server)) { continue; } group[SaveType.Server].Filename = group[SaveType.Local].Filename; } result.SetResult(metadataGroups); }
protected void ProcessResults(User user, WaitableTask <UserEncounter> result, WaitableTask <Encounter> encounterData, WaitableTask <EncounterStatus> detailedStatus) { if (result.IsCompleted() || !encounterData.IsCompleted() || !detailedStatus.IsCompleted()) { return; } encounterData.Result.Value.Content.NonImageContent.Sections[0].Value.Tabs.Insert(0, "TOC", new Tab("Table Of Contents", "Table of Contents")); var encounter = new UserEncounter(user, encounterData.Result.Value, detailedStatus.Result.Value); SetEncounterStart(encounter); result.SetResult(encounter); }
protected virtual void ProcessResults(WaitableTask <List <MenuEncounter> > result, WaitableTask <Dictionary <int, Dictionary <SaveType, EncounterMetadata> > > metadataGroups, WaitableTask <Dictionary <int, EncounterEditLock> > locks, WaitableTask <Dictionary <int, EncounterBasicStatus> > statuses) { if (result.IsCompleted() || !metadataGroups.IsCompleted() || !statuses.IsCompleted() || !locks.IsCompleted()) { return; } if (metadataGroups.Result.Value == null) { result.SetError(null); return; } var menuEncounters = new List <MenuEncounter>(); foreach (var metadataGroup in metadataGroups.Result.Value) { menuEncounters.Add(GetMenuEncounter(metadataGroup, locks, statuses)); } result.SetResult(menuEncounters); }