Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Processes the queried character's kill log.
        /// </summary>
        /// <param name="result"></param>
        private void OnKillLogUpdated(EsiResult <EsiAPIKillLog> 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.KillLog))
            {
                EveMonClient.Notifications.NotifyCharacterKillLogError(m_ccpCharacter, result);
            }

            // Quits if there is an error
            if (result.HasError)
            {
                return;
            }

            // Import the data
            var kills = result.Result;

            // TODO m_ccpCharacter.KillLog.Import(kills.Kills);

            // Fires the event regarding kill log update
            EveMonClient.OnCharacterKillLogUpdated(m_ccpCharacter);

            // Save the file to our cache
            string filename = $"{m_ccpCharacter.Name}-{ESIAPICharacterMethods.KillLog}";

            LocalXmlCache.SaveAsync(filename, Util.SerializeToXmlDocument(kills)).ConfigureAwait(false);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Processes the conquerable station list.
        /// </summary>
        private static void OnUpdated(CCPAPIResult <SerializableAPIConquerableStationList> result)
        {
            // Checks if EVE database is out of service
            if (result.EVEDatabaseError)
            {
                // Reset query pending flag
                s_queryPending = false;
                return;
            }

            // Was there an error ?
            if (result.HasError)
            {
                // Reset query pending flag
                s_queryPending = false;

                EveMonClient.Notifications.NotifyConquerableStationListError(result);
                return;
            }

            EveMonClient.Notifications.InvalidateAPIError();

            // Import the list
            Import(result.Result.Outposts);

            // Reset query pending flag
            s_queryPending = false;

            // Notify the subscribers
            EveMonClient.OnConquerableStationListUpdated();

            // Save the file to our cache
            LocalXmlCache.SaveAsync(Filename, result.XmlDocument).ConfigureAwait(false);
        }
Exemplo n.º 4
0
        /// <summary>
        /// Processed the queried character's skill queue information.
        /// </summary>
        /// <param name="result"></param>
        private void OnCharacterSheetUpdated(CCPAPIResult <SerializableAPICharacterSheet> 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, CCPAPICharacterMethods.CharacterSheet))
            {
                EveMonClient.Notifications.NotifyCharacterSheetError(m_ccpCharacter, result);
            }

            // Quits if there is an error
            if (result.HasError)
            {
                return;
            }

            // Query the Character's info
            QueryCharacterInfo();

            // Imports the data
            m_ccpCharacter.Import(result);

            // Notify for insufficient balance
            m_ccpCharacter.NotifyInsufficientBalance();

            // Save the file to our cache
            LocalXmlCache.SaveAsync(result.Result.Name, result.XmlDocument).ConfigureAwait(false);
        }
Exemplo n.º 5
0
        /// <summary>
        /// Processes the queried character's kill log.
        /// </summary>
        /// <param name="result"></param>
        private void OnKillLogUpdated(EsiAPIKillLog result)
        {
            var target = m_ccpCharacter;

            // Character may have been deleted since we queried
            if (target != null)
            {
                target.KillLog.Import(result);
                EveMonClient.OnCharacterKillLogUpdated(m_ccpCharacter);
                // Save the file to the cache
                string filename = $"{target.Name}-{ESIAPICharacterMethods.KillLog}";
                LocalXmlCache.SaveAsync(filename, Util.SerializeToXmlDocument(result)).
                ConfigureAwait(false);
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Exports the kill logs to the cached file.
        /// </summary>
        public void ExportToCacheFile()
        {
            // Save the file to the cache
            string filename = m_ccpCharacter.Name + "-" + ESIAPICharacterMethods.KillLog;
            var    exported = new SerializableAPIKillLog();

            foreach (KillLog killMail in Items)
            {
                exported.Kills.Add(killMail.Export());
            }
            LocalXmlCache.SaveAsync(filename, Util.SerializeToXmlDocument(exported)).
            ConfigureAwait(false);
            // Fire event to update the UI
            EveMonClient.OnCharacterKillLogUpdated(m_ccpCharacter);
        }
Exemplo n.º 7
0
        /// <summary>
        /// Exports the WalletTransactions to the cached file.
        /// </summary>
        internal void ExportToCacheFile()
        {
            // Save the file to the cache
            string filename = m_character.Name + "-" + ESIAPICharacterMethods.WalletTransactions;
            var    exported = new SerializableAPIWalletTransactions();

            foreach (WalletTransaction tx in Items)
            {
                exported.WalletTransactions.Add(tx.Export());
            }

            LocalXmlCache.SaveAsync(filename, Util.SerializeToXmlDocument(exported)).
            ConfigureAwait(false);

            // TODO Fire event to update the UI ?
            // EveMonClient.OnCharacterKillLogUpdated(m_ccpCharacter);
        }
Exemplo n.º 8
0
        /// <summary>
        /// Processed the queried character's character sheet information.
        /// </summary>
        /// <param name="result"></param>
        private void OnCharacterSheetUpdated(EsiResult <EsiAPICharacterSheet> 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.CharacterSheet))
            {
                EveMonClient.Notifications.NotifyCharacterSheetError(m_ccpCharacter, result);
            }

            // Quits if there is an error
            if (result.HasError)
            {
                return;
            }

            // Query the Character's data
            QueryCharacterData <EsiAPILocation>(ESIAPICharacterMethods.Location,
                                                OnCharacterLocationUpdated);
            QueryCharacterData <EsiAPIClones>(ESIAPICharacterMethods.Clones,
                                              OnCharacterClonesUpdated);
            QueryCharacterData <EsiAPIJumpFatigue>(ESIAPICharacterMethods.JumpFatigue,
                                                   OnCharacterFatigueUpdated);
            QueryCharacterData <EsiAPIAttributes>(ESIAPICharacterMethods.Attributes,
                                                  OnCharacterAttributesUpdated);
            QueryCharacterData <EsiAPIShip>(ESIAPICharacterMethods.Ship,
                                            OnCharacterShipUpdated);
            QueryCharacterData <EsiAPISkills>(ESIAPICharacterMethods.Skills,
                                              OnCharacterSkillsUpdated);
            QueryCharacterData <List <int> >(ESIAPICharacterMethods.Implants,
                                             OnCharacterImplantsUpdated);

            // Imports the data
            m_ccpCharacter.Import(result);

            // Notify for insufficient balance
            m_ccpCharacter.NotifyInsufficientBalance();

            // Save the file to our cache
            LocalXmlCache.SaveAsync(result.Result.Name, Util.SerializeToXmlDocument(result.Result)).ConfigureAwait(false);
        }
Exemplo n.º 9
0
        /// <summary>
        /// Processes the queried character's wallet balance.
        /// </summary>
        /// <param name="result"></param>
        private void OnWalletBalanceUpdated(string result)
        {
            var target = m_ccpCharacter;

            // Character may have been deleted since we queried
            if (target != null)
            {
                target.Import(result);
                // Notify for insufficient balance
                target.NotifyInsufficientBalance();
                // Finally all done!
                EveMonClient.Notifications.InvalidateCharacterAPIError(target);
                EveMonClient.OnCharacterUpdated(target);
                EveMonClient.OnCharacterInfoUpdated(target);
                // Save character information locally
                var doc = Util.SerializeToXmlDocument(target.Export());
                LocalXmlCache.SaveAsync(target.Name, doc).ConfigureAwait(false);
            }
        }
Exemplo n.º 10
0
        /// <summary>
        /// Processes the queried character's character sheet information.
        /// </summary>
        /// <param name="result"></param>
        private void OnCharacterSheetUpdated(EsiAPICharacterSheet result)
        {
            var target = m_ccpCharacter;

            // Character may have been deleted since we queried
            if (target != null)
            {
                var notifiers = EveMonClient.Notifications;

                // Query remaining character data
                QueryCharacterData <EsiAPILocation>(ESIAPICharacterMethods.Location,
                                                    notifiers.NotifyCharacterLocationError, target.Import);
                QueryCharacterData <EsiAPIClones>(ESIAPICharacterMethods.Clones,
                                                  notifiers.NotifyCharacterClonesError, target.Import);
                QueryCharacterData <EsiAPIJumpFatigue>(ESIAPICharacterMethods.JumpFatigue,
                                                       notifiers.NotifyCharacterFatigueError, target.Import);
                QueryCharacterData <EsiAPIAttributes>(ESIAPICharacterMethods.Attributes,
                                                      notifiers.NotifyCharacterAttributesError, target.Import);
                QueryCharacterData <EsiAPIShip>(ESIAPICharacterMethods.Ship,
                                                notifiers.NotifyCharacterShipError, target.Import);
                QueryCharacterData <EsiAPISkills>(ESIAPICharacterMethods.Skills,
                                                  notifiers.NotifyCharacterSkillsError, target.Import);
                QueryCharacterData <List <int> >(ESIAPICharacterMethods.Implants,
                                                 notifiers.NotifyCharacterImplantsError, target.Import);
                QueryCharacterData <EsiAPIEmploymentHistory>(ESIAPICharacterMethods.EmploymentHistory,
                                                             notifiers.NotifyCharacterEmploymentError, target.Import);
                QueryCharacterData <string>(ESIAPICharacterMethods.AccountBalance,
                                            notifiers.NotifyCharacterBalanceError, target.Import);

                target.Import(result);
                // Notify for insufficient balance
                target.NotifyInsufficientBalance();
                // Save results to XML cache
                var doc = Util.SerializeToXmlDocument(result);
                LocalXmlCache.SaveAsync(result.Name, doc).ConfigureAwait(false);
            }
        }
Exemplo n.º 11
0
 /// <summary>
 /// Check if any character sheet related query monitors are still running, and trigger
 /// events if they are all completed.
 /// </summary>
 private void FinishCharacterSheetUpdated()
 {
     // Check if all CharacterSheet related query monitors have completed
     if (!m_characterQueryMonitors.Any(monitor => (ESIAPICharacterMethods.
                                                   CharacterSheet.Equals(monitor.Method) || monitor.Method.HasParent(
                                                       ESIAPICharacterMethods.CharacterSheet)) && monitor.Status == QueryStatus.
                                       Updating))
     {
         m_characterSheetUpdating = false;
         var target = m_ccpCharacter;
         // Character may have been deleted since we queried
         if (target != null)
         {
             // Finally all done!
             EveMonClient.Notifications.InvalidateCharacterAPIError(target);
             EveMonClient.OnCharacterUpdated(target);
             EveMonClient.OnCharacterInfoUpdated(target);
             EveMonClient.OnCharacterImplantSetCollectionChanged(target);
             // Save character information locally
             var doc = Util.SerializeToXmlDocument(target.Export());
             LocalXmlCache.SaveAsync(target.Name, doc).ConfigureAwait(false);
         }
     }
 }
Exemplo n.º 12
0
 /// <summary>
 /// Saves the xml document to the specified filename.
 /// </summary>
 /// <param name="filename">The filename.</param>
 /// <param name="xdoc">The xdoc.</param>
 protected static Task SaveAsync(string filename, IXPathNavigable xdoc)
 => LocalXmlCache.SaveAsync(filename, xdoc);