/// <summary> /// Processes the queried character's factional warfare statistic information. /// </summary> /// <param name="result"></param> private void OnFactionalWarfareStatsUpdated(EsiResult <EsiAPIFactionalWarfareStats> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.FactionalWarfareStats)) { EveMonClient.Notifications.NotifyCharacterFactionalWarfareStatsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { // Update the enlisted in factional warfare flag m_ccpCharacter.IsFactionalWarfareNotEnlisted = true; // Fires the event regarding factional warfare stats update EveMonClient.OnCharacterFactionalWarfareStatsUpdated(m_ccpCharacter); return; } // Update the enlisted in factional warfare flag m_ccpCharacter.IsFactionalWarfareNotEnlisted = false; // Import the data m_ccpCharacter.FactionalWarfareStats = new FactionalWarfareStats(result.Result.ToXMLItem()); // Fires the event regarding factional warfare stats update EveMonClient.OnCharacterFactionalWarfareStatsUpdated(m_ccpCharacter); }
private void OnKillMailDownloaded(EsiResult <EsiAPIKillMail> result, object hashValue) { var target = m_ccpCharacter; string hash = hashValue?.ToString() ?? EveMonConstants.UnknownText; // Synchronization is required here since multiple requests can finish at once lock (m_pendingItems) { // If character is still around and monitored if (target != null && target.Monitored) { if (target.ShouldNotifyError(result, ESIAPICharacterMethods.KillLog)) { EveMonClient.Notifications.NotifyKillMailError(result, hash); } if (!result.HasError && result.HasData) { // Add data inside synchronization m_pendingItems.Add(new KillLog(target, result.Result.ToXMLItem())); } } m_killMailCounter = Math.Max(0, m_killMailCounter - 1); if (m_killMailCounter == 0) { // All kills fetched Items.Clear(); Items.AddRange(m_pendingItems); m_pendingItems.Clear(); ExportToCacheFile(); } } }
/// <summary> /// Processes the faction war list. /// </summary> private static void OnFactionWarsUpdated(EsiResult <EsiAPIEveFactionWars> result, object ignore) { s_warsResponse = result.Response; if (result.HasError) { // Was there an error ? s_queryPending = false; EveMonClient.Notifications.NotifyEveFactionWarsError(result); } if (EsiErrors.IsErrorCountExceeded) { s_queryPending = false; // If error count is exceeded (success or fail), retry when it resets s_nextCheckTime = EsiErrors.ErrorCountResetTime; } else if (!result.HasError) { // Stage two request for factional warfare stats EveMonClient.Notifications.InvalidateAPIError(); EveMonClient.APIProviders.CurrentProvider.QueryEsi <EsiAPIEveFactionalWarfareStats>(ESIAPIGenericMethods. EVEFactionalWarfareStats, OnWarStatsUpdated, new ESIParams( s_statsResponse), result.HasData ? result.Result : null); } }
/// <summary> /// Asynchronously queries this method with the provided ID and HTTP POST data. /// </summary> /// <typeparam name="T">The subtype to deserialize (the deserialized type being /// <see cref="CCPAPIResult{T}" />).</typeparam> /// <param name="method">The method to query</param> /// <param name="callback">The callback to invoke once the query has been completed. /// </param> /// <param name="data">The parameters to use for the request, including the token, /// arguments, and POST data.</param> /// <param name="state">State to be passed to the callback when it is used.</param> /// <exception cref="System.ArgumentNullException">callback; The callback cannot be /// null.</exception> public void QueryEsi <T>(Enum method, ESIRequestCallback <T> callback, ESIParams data, object state = null) where T : class { var response = data.LastResponse; // Check callback not null callback.ThrowIfNull(nameof(callback), "The callback cannot be null."); Uri url = GetESIUrl(method, data.ParamOne, data.ParamTwo, data.GetData); Util.DownloadJsonAsync <T>(url, new RequestParams(data.PostData) { Authentication = data.Token, AcceptEncoded = SupportsCompressedResponse, ETag = response?.ETag, IfModifiedSince = response?.Expires }).ContinueWith(task => { var esiResult = new EsiResult <T>(task.Result); // Sync clock on the answer if necessary and provided var sync = esiResult.Result as ISynchronizableWithLocalClock; DateTime?when = esiResult.CurrentTime; if (sync != null && when != null) { sync.SynchronizeWithLocalClock(DateTime.UtcNow - (DateTime)when); } // Invokes the callback Dispatcher.Invoke(() => callback.Invoke(esiResult, state)); }); }
/// <summary> /// Processes the queried character's corporation contract bids. /// </summary> private void OnContractBidsUpdated(EsiResult <EsiAPIContractBids> result, object apiMethod) { var methodEnum = (apiMethod as Enum) ?? ESIAPICharacterMethods.ContractBids; var target = Character; // Notify if an error occured if (target.ShouldNotifyError(result, methodEnum)) { EveMonClient.Notifications.NotifyContractBidsError(Character, result); } if (!result.HasError) { EveMonClient.Notifications.InvalidateCharacterAPIError(target); Import(result.Result.ToXMLItem(ID).ContractBids); // Fires the event regarding contract bids downloaded if (methodEnum == (Enum)ESIAPICharacterMethods.ContractBids) { EveMonClient.OnCharacterContractBidsDownloaded(target); } else { EveMonClient.OnCorporationContractBidsDownloaded(target); } } }
private void OnQueryStationUpdated(EsiResult <EsiAPIStation> result, object ignore) { // Bail if there is an error if (result.HasError) { EveMonClient.Notifications.NotifyStationQueryError(result); m_queryPending = false; return; } EveMonClient.Notifications.InvalidateAPIError(); lock (s_cacheList) { // Add resulting names to the cache; duplicates should not occur, but // guard against them defensively var station = result.Result.ToSerializableOutpost(); long id = station.StationID; if (s_cacheList.ContainsKey(id)) { s_cacheList[id] = station; } else { s_cacheList.Add(id, station); } m_requested.Add(id); } OnLookupComplete(); }
/// <summary> /// Processes the contract bids. /// </summary> private void OnContractBidsUpdated(EsiResult <EsiAPIContractBids> result, object apiMethod) { var methodEnum = (apiMethod as Enum) ?? ESIAPICharacterMethods.ContractBids; var target = Character; m_bidsResponse = result.Response; // Notify if an error occured if (target.ShouldNotifyError(result, methodEnum)) { EveMonClient.Notifications.NotifyContractBidsError(Character, result); } if (!result.HasError) { EveMonClient.Notifications.InvalidateCharacterAPIError(target); Import(result.Result); // Fire correct event type if (methodEnum is ESIAPICharacterMethods) { EveMonClient.OnCharacterContractBidsDownloaded(target); } else { EveMonClient.OnCorporationContractBidsDownloaded(target); } } m_bidsPending = false; }
private void OnQueryAPICharacterNameUpdated(EsiResult <EsiAPICharacterNames> result, object ignore) { // Bail if there is an error if (result.HasError) { EveMonClient.Notifications.NotifyCharacterNameError(result); m_queryPending = false; return; } EveMonClient.Notifications.InvalidateAPIError(); lock (s_cacheList) { // Add resulting names to the cache; duplicates should not occur, but // guard against them defensively foreach (var namePair in result.Result) { long id = namePair.ID; if (s_cacheList.ContainsKey(id)) { s_cacheList[id] = namePair.Name; } else { s_cacheList.Add(id, namePair.Name); } m_requested.Add(id); } } OnLookupComplete(); }
private void OnQueryStationUpdated(Task <JsonResult <HammertimeStructureList> > result, CitadelIDInfo info) { var jsonResult = result.Result; // Bail if there is an error if (result.IsFaulted || jsonResult == null) { EveMonClient.Notifications.NotifyCitadelQueryError(null); } else if (jsonResult.HasError) { // Provide some more debugging info with the actual failed response var fakeResult = new EsiResult <EsiAPIStructure>(jsonResult.Response); EveMonClient.Notifications.NotifyCitadelQueryError(fakeResult); } else { EveMonClient.Notifications.InvalidateAPIError(); // Should only have one result, with an integer key var hammerData = jsonResult.Result; if (hammerData.Count == 1) { info.OnRequestComplete(hammerData.Values.First().ToXMLItem(info.ID)); } else { EveMonClient.Trace("Citadel Hunt failed for {0:D}", info.ID); info.OnRequestComplete(null); } } OnLookupComplete(); }
/// <summary> /// Processes the queried character's EVE mail messages. /// </summary> /// <param name="result"></param> private void OnEVEMailMessagesUpdated(EsiResult <EsiAPIMailMessages> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occured if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.MailMessages)) { EveMonClient.Notifications.NotifyEVEMailMessagesError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Each time we import a new batch of EVE mail messages, // query the mailing lists so that we are always up to date QueryCharacterData <EsiAPIMailingLists>(ESIAPICharacterMethods.MailingLists, OnMailingListsUpdated); // Import the data m_ccpCharacter.EVEMailMessages.Import(result.Result.ToXMLItem().Messages); // Notify on new messages if (m_ccpCharacter.EVEMailMessages.NewMessages != 0) { EveMonClient.Notifications.NotifyNewEVEMailMessages(m_ccpCharacter, m_ccpCharacter.EVEMailMessages.NewMessages); } }
/// <summary> /// Processes the queried character's EVE notifications. /// </summary> /// <param name="result">The result.</param> private void OnEVENotificationsUpdated(EsiResult <EsiAPINotifications> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occured if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.Notifications)) { EveMonClient.Notifications.NotifyEVENotificationsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data m_ccpCharacter.EVENotifications.Import(result.Result); // Notify on new notifications if (m_ccpCharacter.EVENotifications.NewNotifications != 0) { EveMonClient.Notifications.NotifyNewEVENotifications(m_ccpCharacter, m_ccpCharacter.EVENotifications.NewNotifications); } }
/// <summary> /// Processes the queried character's research points. /// </summary> /// <param name="result"></param> private void OnResearchPointsUpdated(EsiResult <EsiAPIResearchPoints> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occured if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.ResearchPoints)) { EveMonClient.Notifications.NotifyResearchPointsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data m_ccpCharacter.ResearchPoints.Import(result.Result.ToXMLItem().ResearchPoints); // Fires the event regarding research points update EveMonClient.OnCharacterResearchPointsUpdated(m_ccpCharacter); }
/// <summary> /// Processes the queried character's wallet journal information. /// </summary> /// <param name="result"></param> private void OnWalletJournalUpdated(EsiResult <EsiAPIWalletJournal> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.WalletJournal)) { EveMonClient.Notifications.NotifyCharacterWalletJournalError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data m_ccpCharacter.WalletJournal.Import(result.Result.ToXMLItem().WalletJournal); // Fires the event regarding wallet journal update EveMonClient.OnCharacterWalletJournalUpdated(m_ccpCharacter); }
/// <summary> /// Processes the queried character's assets information. /// </summary> /// <param name="result"></param> private void OnAssetsUpdated(EsiResult <EsiAPIAssetList> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.AssetList)) { EveMonClient.Notifications.NotifyCharacterAssetsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data TaskHelper.RunCPUBoundTaskAsync(() => m_ccpCharacter.Assets.Import(result.Result.ToXMLItem().Assets)) .ContinueWith(_ => { // Fires the event regarding assets update EveMonClient.OnCharacterAssetsUpdated(m_ccpCharacter); }, EveMonClient.CurrentSynchronizationContext); }
private void OnQueryStationUpdatedEsi(EsiResult <EsiAPIStructure> result, object reqInfo) { var info = reqInfo as CitadelIDInfo; if (info == null) { throw new ArgumentException("Invalid argument for citadel ID info"); } // Try hammertime if there is an error if (result.HasError) { #if HAMMERTIME LoadCitadelInformationFromHammertimeAPI(info); #else if (result.ResponseCode != (int)HttpStatusCode.NotFound) { EveMonClient.Notifications.NotifyCitadelQueryError(result); } info.OnRequestComplete(null); #endif } else { EveMonClient.Notifications.InvalidateAPIError(); info.OnRequestComplete(result.Result.ToXMLItem(info.ID)); } OnLookupComplete(); }
/// <summary> /// Processes the queried character's market orders. Called from the history fetch on /// success or failure, but merges the original orders too. /// </summary> /// <param name="result"></param> /// <remarks>This method is sensitive to which "issued for" orders gets queried first</remarks> private void OnMarketOrdersCompleted(EsiResult <EsiAPIMarketOrders> result, object regularOrders) { var target = m_ccpCharacter; // Character may have been deleted since we queried if (target != null && regularOrders is EsiAPIMarketOrders orders) { var endedOrders = new LinkedList <MarketOrder>(); var allOrders = new EsiAPIMarketOrders(); // Add normal orders first if (orders != null) { allOrders.AddRange(orders); } // Add result second if (result != null && !result.HasError && result.Result != null) { allOrders.AddRange(result.Result); } allOrders.SetAllIssuedBy(target.CharacterID); target.CharacterMarketOrders.Import(allOrders, IssuedFor.Character, endedOrders); EveMonClient.OnCharacterMarketOrdersUpdated(target, endedOrders); allOrders.Clear(); // Notify if either one failed if (result != null && result.HasError) { EveMonClient.Notifications.NotifyCharacterMarketOrdersError(target, result); } } }
private void OnQueryAPICharacterNameUpdated(EsiResult <EsiAPICharacterNames> result, object ignore) { StringIDInfo info; // Bail if there is an error if (result.HasError) { EveMonClient.Notifications.NotifyCharacterNameError(result); } else { EveMonClient.Notifications.InvalidateAPIError(); // This probably will never be false since we did not provide an etag if (result.HasData) { lock (m_cache) { // Add resulting names to the cache; duplicates should not occur, // but guard against them defensively foreach (var namePair in result.Result) { m_cache.TryGetValue(namePair.ID, out info); info?.OnRequestComplete(namePair.Name); } } } } OnLookupComplete(); }
/// <summary> /// Processes the queried calendar event attendees. /// </summary> /// <param name="result">The result.</param> private void OnCalendarEventAttendeesDownloaded(EsiResult <EsiAPICalendarEventAttendees> result, object ignore) { m_queryPending = false; // Notify an error occured if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.CalendarEventAttendees)) { EveMonClient.Notifications.NotifyCharacterCalendarEventAttendeesError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Quit if there are no attendees if (result.Result.Count < 1) { return; } var attendees = result.Result.ToXMLItem().EventAttendees.Select(attendee => new CalendarEventAttendee(attendee)); // Import the data m_eventAttendees.Clear(); m_eventAttendees.AddRange(attendees); EveMonClient.OnCharacterCalendarEventAttendeesDownloaded(m_ccpCharacter); }
private void OnQueryStationUpdated(EsiResult <EsiAPIStructure> result, object idObject) { long id = (idObject as long?) ?? 0L; // Bail if there is an error if (result.HasError || id == 0L) { EveMonClient.Notifications.NotifyCitadelQueryError(result); m_queryPending = false; return; } EveMonClient.Notifications.InvalidateAPIError(); lock (s_cacheList) { // Add resulting names to the cache; duplicates should not occur, but // guard against them defensively var station = result.Result.ToXMLItem(id); if (s_cacheList.ContainsKey(id)) { s_cacheList[id] = station; } else { s_cacheList.Add(id, station); } m_requested.Add(id); } OnLookupComplete(); }
private void OnKillMailDownloaded(EsiResult <EsiAPIKillMail> result, object hashValue) { var target = m_ccpCharacter; string hash = hashValue?.ToString() ?? EveMonConstants.UnknownText; // If character is still around and monitored if (target != null && target.Monitored) { if (result.HasError) { EveMonClient.Notifications.NotifyKillMailError(result, hash); } else { Items.Add(new KillLog(target, result.Result.ToXMLItem())); } } // Synchronization is required here since multiple requests can finish at once lock (m_counterLock) { m_killMailCounter = Math.Max(0, m_killMailCounter - 1); if (m_killMailCounter == 0) { ExportToCacheFile(); } } }
private void OnCalendarEventDownloaded(EsiResult <EsiAPICalendarEvent> result, object forID) { var target = m_character; long id = (forID as long?) ?? 0L; // If character is still around and monitored if (target != null && target.Monitored) { if (target.ShouldNotifyError(result, ESIAPICharacterMethods. UpcomingCalendarEventDetails)) { EveMonClient.Notifications.NotifyCharacterUpcomingCalendarEventDetailsError( m_character, result); } if (!result.HasError && result.HasData) { Items.Add(new UpcomingCalendarEvent(target, result.Result)); } } // Synchronization is required here since multiple requests can finish at once lock (m_counterLock) { m_eventCounter = Math.Max(0, m_eventCounter - 1); } }
/// <summary> /// Processes the queried character's corporation medals. /// </summary> /// <param name="result"></param> private void OnMedalsUpdated(EsiResult <EsiAPIMedals> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, CCPAPICorporationMethods.CorporationMedals)) { EveMonClient.Notifications.NotifyCorporationMedalsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data m_ccpCharacter.CorporationMedals.Import(result.Result.ToXMLItem().CorporationMedals); // Fires the event regarding corporation medals update EveMonClient.OnCorporationMedalsUpdated(m_ccpCharacter); }
/// <summary> /// Called when contract items downloaded. /// </summary> /// <param name="result">The result.</param> private void OnContractItemsDownloaded(EsiResult <EsiAPIContractItems> result, object apiMethod) { var methodEnum = (apiMethod as Enum) ?? ESIAPICharacterMethods.ContractItems; var target = Character; // Notify if an error occured if (target.ShouldNotifyError(result, methodEnum)) { EveMonClient.Notifications.NotifyContractItemsError(target, result); } if (!result.HasError) { EveMonClient.Notifications.InvalidateCharacterAPIError(target); /* * if (!result.Result.Any()) * { * GetContractItems(); * return; * } */ Import(result.Result.ToXMLItem().ContractItems); // Fires the event regarding contract items downloaded if (methodEnum == (Enum)ESIAPICharacterMethods.ContractItems) { EveMonClient.OnCharacterContractItemsDownloaded(target); } else { EveMonClient.OnCorporationContractItemsDownloaded(target); } } }
/// <summary> /// Processes the queried character's corporation market orders. /// </summary> /// <param name="result"></param> /// <remarks>This method is sensitive to which market orders gets queried first</remarks> private void OnMarketOrdersUpdated(EsiResult <EsiAPIMarketOrders> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, CCPAPICorporationMethods.CorporationMarketOrders)) { EveMonClient.Notifications.NotifyCorporationMarketOrdersError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } var orders = result.Result.ToXMLItem(m_ccpCharacter.CorporationID).Orders; foreach (var order in orders) { order.IssuedFor = IssuedFor.Corporation; } // Import the data List <MarketOrder> endedOrders = new List <MarketOrder>(); m_ccpCharacter.CorporationMarketOrders.Import(orders, endedOrders); // Fires the event regarding corporation market orders update EveMonClient.OnCorporationMarketOrdersUpdated(m_ccpCharacter, endedOrders); }
/// <summary> /// Asynchronously queries this method with the provided ID and HTTP POST data. /// </summary> /// <typeparam name="T">The subtype to deserialize (the deserialized type being <see cref="CCPAPIResult{T}" />).</typeparam> /// <param name="method">The method to query</param> /// <param name="callback">The callback to invoke once the query has been completed.</param> /// <param name="state">State to be passed to the callback when it is used.</param> /// <param name="data">The parameters to use for the request, including the token, arguments, and POST data.</param> /// <exception cref="System.ArgumentNullException">callback; The callback cannot be null.</exception> private void QueryEsiAsync <T>(Enum method, ESIRequestCallback <T> callback, object state, EsiParams data) where T : class { // Check callback not null callback.ThrowIfNull(nameof(callback), "The callback cannot be null."); // Lazy download Uri url = GetESIUrl(method, data.ParamOne, data.ParamTwo, data.GetData); Util.DownloadJsonAsync <T>(url, data.Token, SupportsCompressedResponse, data.PostData) .ContinueWith(task => { var esiResult = new EsiResult <T>(task.Result); // Sync clock on the answer if necessary var sync = esiResult.Result as ISynchronizableWithLocalClock; if (sync != null) { sync.SynchronizeWithLocalClock(DateTime.UtcNow - esiResult.CurrentTime); } // Invokes the callback Dispatcher.Invoke(() => callback.Invoke(esiResult, state)); }); }
/// <summary> /// Processes the queried character's corporation contract bids. /// </summary> private void OnCorporationContractBidsUpdated(EsiResult <EsiAPIContractBids> result, object forContract) { long contractID = (forContract as long?) ?? 0L; // Character may have been deleted or set to not be monitored since we queried if (contractID == 0L || m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occured if (m_ccpCharacter.ShouldNotifyError(result, CCPAPICorporationMethods.CorporationContractBids)) { EveMonClient.Notifications.NotifyCorporationContractBidsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data m_ccpCharacter.CorporationContractBids.Import(result.Result.ToXMLItem(contractID).ContractBids); // Fires the event regarding corporation contract bids update EveMonClient.OnCorporationContractBidsUpdated(m_ccpCharacter); }
/// <summary> /// Processes the queried EVE mail message mail body. /// </summary> /// <param name="result">The result.</param> private void OnEVEMailBodyDownloaded(EsiResult <EsiAPIMailBody> result, object forMessage) { long messageID = (forMessage as long?) ?? 0L; m_queryPending = false; // Notify an error occured if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.MailBodies)) { EveMonClient.Notifications.NotifyEVEMailBodiesError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError || messageID == 0L) { return; } // Quit if for any reason there is no text if (string.IsNullOrEmpty(result.Result.Body)) { return; } // Import the data EVEMailBody = new EveMailBody(messageID, result.Result); EveMonClient.OnCharacterEVEMailBodyDownloaded(m_ccpCharacter); }
/// <summary> /// Processes the queried character's corporation industry jobs. /// </summary> /// <param name="result"></param> /// <remarks>This method is sensitive to which "issued for" jobs gets queried first</remarks> private void OnIndustryJobsUpdated(EsiResult <EsiAPIIndustryJobs> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, CCPAPICorporationMethods.CorporationIndustryJobs)) { EveMonClient.Notifications.NotifyCorporationIndustryJobsError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } var jobs = result.Result.ToXMLItem().Jobs; foreach (var job in jobs) { job.IssuedFor = IssuedFor.Corporation; } // Import the data m_ccpCharacter.CorporationIndustryJobs.Import(jobs); // Fires the event regarding corporation industry jobs update EveMonClient.OnCorporationIndustryJobsUpdated(m_ccpCharacter); }
/// <summary> /// Processes the faction war statistics list. /// </summary> private static void OnUpdated(EsiResult <EsiAPIEveFactionalWarfareStats> result, object wars) { var factionWars = wars as EsiAPIEveFactionWars; // Was there an error ? if (result.HasError) { // Reset query pending flag s_queryPending = false; EveMonClient.Notifications.NotifyEveFactionalWarfareStatsError(result); return; } EveMonClient.Notifications.InvalidateAPIError(); // Deserialize the result var fwStats = result.Result.ToXMLItem(factionWars); Import(fwStats); // Set the next update to be after downtime s_nextCheckTime = DateTime.Today.AddHours(EveConstants.DowntimeHour).AddMinutes( EveConstants.DowntimeDuration); s_queryPending = false; // Notify the subscribers EveMonClient.OnEveFactionalWarfareStatsUpdated(); // Save the file to our cache LocalXmlCache.SaveAsync(Filename, Util.SerializeToXmlDocument(fwStats)).ConfigureAwait(false); }
/// <summary> /// Processes the queried character's skill queue information. /// </summary> /// <param name="result"></param> private void OnSkillQueueUpdated(EsiResult <EsiAPISkillQueue> result) { // Character may have been deleted or set to not be monitored since we queried if (m_ccpCharacter == null || !m_ccpCharacter.Monitored) { return; } // Notify an error occurred if (m_ccpCharacter.ShouldNotifyError(result, ESIAPICharacterMethods.SkillQueue)) { EveMonClient.Notifications.NotifySkillQueueError(m_ccpCharacter, result); } // Quits if there is an error if (result.HasError) { return; } // Import the data m_ccpCharacter.SkillQueue.Import(result.Result.ToXMLItem().Queue); // Check the character has less than a day of training in skill queue if (m_ccpCharacter.IsTraining && m_ccpCharacter.SkillQueue.LessThanWarningThreshold) { EveMonClient.Notifications.NotifySkillQueueLessThanADay(m_ccpCharacter); return; } EveMonClient.Notifications.InvalidateSkillQueueLessThanADay(m_ccpCharacter); }