/// <summary> /// Process the selected character skill queue into the selected calendar. /// </summary> /// <param name="character">The character.</param> /// <exception cref="System.ArgumentNullException">character</exception> public static async Task UpdateCalendar(CCPCharacter character) { character.ThrowIfNull(nameof(character)); SkillQueue skillQueue = character.SkillQueue; foreach (QueuedSkill queuedSkill in skillQueue) { bool lastSkillInQueue = queuedSkill == skillQueue.Last(); int queuePosition = skillQueue.IndexOf(queuedSkill) + 1; // Continue if user has selected 'Last Queued Skill Only' if (Settings.Calendar.LastQueuedSkillOnly && !lastSkillInQueue) continue; try { if (Settings.Calendar.Provider == CalendarProvider.Outlook && OutlookInstalled) await DoOutlookAppointmentAsync(queuedSkill, queuePosition, lastSkillInQueue); if (Settings.Calendar.Provider == CalendarProvider.Google) await DoGoogleAppointmentAsync(queuedSkill, queuePosition, lastSkillInQueue); } catch (Exception ex) { ExceptionHandler.LogRethrowException(ex); throw; } } }
internal CorporationDataQuerying(CCPCharacter ccpCharacter) { m_ccpCharacter = ccpCharacter; m_corporationQueryMonitors = new List<IQueryMonitorEx>(); // Initializes the query monitors m_corpMedalsMonitor = new CorporationQueryMonitor<SerializableAPIMedals>(ccpCharacter, CCPAPICorporationMethods.CorporationMedals, OnMedalsUpdated) { QueryOnStartup = true }; m_corpMarketOrdersMonitor = new CorporationQueryMonitor<SerializableAPIMarketOrders>(ccpCharacter, CCPAPICorporationMethods.CorporationMarketOrders, OnMarketOrdersUpdated) { QueryOnStartup = true }; m_corpContractsMonitor = new CorporationQueryMonitor<SerializableAPIContracts>(ccpCharacter, CCPAPICorporationMethods.CorporationContracts, OnContractsUpdated) { QueryOnStartup = true }; m_corpIndustryJobsMonitor = new CorporationQueryMonitor<SerializableAPIIndustryJobs>(ccpCharacter, CCPAPICorporationMethods.CorporationIndustryJobs, OnIndustryJobsUpdated) { QueryOnStartup = true }; // Add the monitors in an order as they will appear in the throbber menu m_corporationQueryMonitors.AddRange(new IQueryMonitorEx[] { m_corpMedalsMonitor, m_corpMarketOrdersMonitor, m_corpContractsMonitor, m_corpIndustryJobsMonitor }); m_corporationQueryMonitors.ForEach(monitor => ccpCharacter.QueryMonitors.Add(monitor)); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> /// <exception cref="System.ArgumentNullException">src</exception> internal Contract(CCPCharacter ccpCharacter, SerializableContractListItem src) { src.ThrowIfNull(nameof(src)); Character = ccpCharacter; PopulateContractInfo(src); m_state = GetState(src); }
/// <summary> /// Constructor from an object deserialized from the settings file. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal Contract(CCPCharacter ccpCharacter, SerializableContract src) { Character = ccpCharacter; ID = src.ContractID; IssuedFor = src.IssuedFor; if (IssuedFor == IssuedFor.Corporation) IssuerID = Character.CharacterID; m_state = src.ContractState; }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal UpcomingCalendarEvent(CCPCharacter ccpCharacter, SerializableUpcomingCalendarEventsListItem src) { m_ccpCharacter = ccpCharacter; m_eventID = src.EventID; OwnerID = src.OwnerID; OwnerName = src.OwnerName; EventTitle = src.EventTitle; EventText = src.EventText; Duration = src.Duration; Importance = src.Importance; Response = src.Response; EventDate = src.EventDate; m_eventAttendees = new List<CalendarEventAttendee>(); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal EveNotification(CCPCharacter ccpCharacter, SerializableNotificationsListItem src) { m_ccpCharacter = ccpCharacter; NotificationID = src.NotificationID; TypeID = src.TypeID; m_typeName = EveNotificationType.GetName(src.TypeID); SenderName = src.SenderName; SentDate = src.SentDate; Recipient = new List<string> { ccpCharacter.Name }; EVENotificationText = new EveNotificationText(this, new SerializableNotificationTextsListItem { NotificationID = 0, NotificationText = String.Empty, }); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> /// <param name="src">The source.</param> internal Medal(CCPCharacter ccpCharacter, SerializableMedalsListItem src) { m_ccpCharacter = ccpCharacter; ID = src.MedalID; Reason = src.Reason; Status = src.Status; IssuerID = src.IssuerID; CorporationID = src.CorporationID; Description = src.Description; Title = src.Title; Issued = src.Issued; Group = src.Group; m_issuer = EveIDToName.GetIDToName(src.IssuerID); m_corporationName = EveIDToName.GetIDToName(CorporationID); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="ccpCharacter"></param> /// <param name="src"></param> internal EveMailMessage(CCPCharacter ccpCharacter, SerializableMailMessagesListItem src) { m_ccpCharacter = ccpCharacter; m_source = src; State = src.SenderID != ccpCharacter.CharacterID ? EveMailState.Inbox : EveMailState.SentItem; MessageID = src.MessageID; SentDate = src.SentDate; Title = src.Title.HtmlDecode(); SenderName = src.SenderName; m_toCharacters = GetIDsToNames(src.ToCharacterIDs); m_mailingLists = GetMailingListIDsToNames(src.ToListID); m_toCorpOrAlliance = GetCorpOrAlliance(src.ToCorpOrAllianceID); EVEMailBody = new EveMailBody(new SerializableMailBodiesListItem { MessageID = 0, MessageText = String.Empty }); }
/// <summary> /// Updates the installation. /// </summary> public void UpdateInstallation(CCPCharacter character) { Installation = GetInstallation(m_installedItemLocationID, character); }
/// <summary> /// Gets the station. /// </summary> /// <param name="id">The ID of the installation.</param> /// <returns>Name of the installation.</returns> private string GetInstallation(long id, CCPCharacter character) { return(EveIDToStation.GetIDToStation(id, character)?.Name ?? EveMonConstants. UnknownText); }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src"></param> internal BuyOrder(SerializableOrderListItem src, CCPCharacter character) : base(src, character) { Escrow = src.Escrow; Range = src.Range; }
/// <summary> /// Default constructor, only used by <see cref="Character"/> /// </summary> /// <param name="character">The character this collection is bound to.</param> internal SkillQueue(CCPCharacter character) { m_character = character; EveMonClient.TimerTick += EveMonClient_TimerTick; }
/// <summary> /// Initializes a new instance of the <see cref="CharacterDataQuerying"/> class. /// </summary> /// <param name="ccpCharacter">The CCP character.</param> internal CharacterDataQuerying(CCPCharacter ccpCharacter) { // Initializes the query monitors m_ccpCharacter = ccpCharacter; m_characterQueryMonitors = new List<IQueryMonitorEx>(); m_charSheetMonitor = new CharacterQueryMonitor<SerializableAPICharacterSheet>(ccpCharacter, CCPAPICharacterMethods.CharacterSheet, OnCharacterSheetUpdated); IQueryMonitorEx skillQueueMonitor = new CharacterQueryMonitor<SerializableAPISkillQueue>(ccpCharacter, CCPAPICharacterMethods.SkillQueue, OnSkillQueueUpdated); IQueryMonitorEx charStandingsMonitor = new CharacterQueryMonitor<SerializableAPIStandings>(ccpCharacter, CCPAPICharacterMethods.Standings, OnStandingsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charContactsMonitor = new CharacterQueryMonitor<SerializableAPIContactList>(ccpCharacter, CCPAPICharacterMethods.ContactList, OnContactsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charFacWarStatsMonitor = new CharacterQueryMonitor<SerializableAPIFactionalWarfareStats>(ccpCharacter, CCPAPICharacterMethods.FactionalWarfareStats, OnFactionalWarfareStatsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charMedalsMonitor = new CharacterQueryMonitor<SerializableAPIMedals>(ccpCharacter, CCPAPICharacterMethods.Medals, OnMedalsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charKillLogMonitor = new CharacterQueryMonitor<SerializableAPIKillLog>(ccpCharacter, CCPAPICharacterMethods.KillLog, OnKillLogUpdated) { QueryOnStartup = true }; IQueryMonitorEx charAssetsMonitor = new CharacterQueryMonitor<SerializableAPIAssetList>(ccpCharacter, CCPAPICharacterMethods.AssetList, OnAssetsUpdated) { QueryOnStartup = true }; m_charMarketOrdersMonitor = new CharacterQueryMonitor<SerializableAPIMarketOrders>(ccpCharacter, CCPAPICharacterMethods.MarketOrders, OnMarketOrdersUpdated) { QueryOnStartup = true }; m_charContractsMonitor = new CharacterQueryMonitor<SerializableAPIContracts>(ccpCharacter, CCPAPICharacterMethods.Contracts, OnContractsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charWalletJournalMonitor = new CharacterQueryMonitor<SerializableAPIWalletJournal>(ccpCharacter, CCPAPICharacterMethods.WalletJournal, OnWalletJournalUpdated) { QueryOnStartup = true }; IQueryMonitorEx charWalletTransactionsMonitor = new CharacterQueryMonitor<SerializableAPIWalletTransactions>(ccpCharacter, CCPAPICharacterMethods.WalletTransactions, OnWalletTransactionsUpdated) { QueryOnStartup = true }; m_charIndustryJobsMonitor = new CharacterQueryMonitor<SerializableAPIIndustryJobs>(ccpCharacter, CCPAPICharacterMethods.IndustryJobs, OnIndustryJobsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charResearchPointsMonitor = new CharacterQueryMonitor<SerializableAPIResearch>(ccpCharacter, CCPAPICharacterMethods.ResearchPoints, OnResearchPointsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charEVEMailMessagesMonitor = new CharacterQueryMonitor<SerializableAPIMailMessages>(ccpCharacter, CCPAPICharacterMethods.MailMessages, OnEVEMailMessagesUpdated) { QueryOnStartup = true }; IQueryMonitorEx charEVENotificationsMonitor = new CharacterQueryMonitor<SerializableAPINotifications>(ccpCharacter, CCPAPICharacterMethods.Notifications, OnEVENotificationsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charUpcomingCalendarEventsMonitor = new CharacterQueryMonitor<SerializableAPIUpcomingCalendarEvents>(ccpCharacter, CCPAPICharacterMethods.UpcomingCalendarEvents, OnUpcomingCalendarEventsUpdated) { QueryOnStartup = true }; IQueryMonitorEx charPlanetaryColoniesMonitor = new CharacterQueryMonitor<SerializableAPIPlanetaryColonies>(ccpCharacter, CCPAPIGenericMethods.PlanetaryColonies, OnPlanetaryColoniesUpdated) { QueryOnStartup = true }; // Add the monitors in an order as they will appear in the throbber menu m_characterQueryMonitors.AddRange(new[] { m_charSheetMonitor, skillQueueMonitor, charStandingsMonitor, charContactsMonitor, charFacWarStatsMonitor, charMedalsMonitor, charKillLogMonitor, charAssetsMonitor, m_charMarketOrdersMonitor, m_charContractsMonitor, charWalletJournalMonitor, charWalletTransactionsMonitor, m_charIndustryJobsMonitor, charPlanetaryColoniesMonitor, charResearchPointsMonitor, charEVEMailMessagesMonitor, charEVENotificationsMonitor, charUpcomingCalendarEventsMonitor }); m_characterQueryMonitors.ForEach(monitor => ccpCharacter.QueryMonitors.Add(monitor)); m_basicFeaturesMonitors = m_characterQueryMonitors .Select(monitor => new { monitor, method = (CCPAPICharacterMethods)monitor.Method }) .Where(monitor => (long)monitor.method == ((long)monitor.method & (long)CCPAPIMethodsEnum.BasicCharacterFeatures)) .Select(basicFeature => basicFeature.monitor) .ToList(); if (ccpCharacter.ForceUpdateBasicFeatures) m_basicFeaturesMonitors.ForEach(monitor => monitor.ForceUpdate(true)); EveMonClient.TimerTick += EveMonClient_TimerTick; }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src"></param> internal SellOrder(SerializableOrderListItem src, CCPCharacter character) : base(src, character) { }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src">The source.</param> /// <param name="issuedFor">Whether the order was issued for a corporation or a /// character.</param> internal SellOrder(EsiOrderListItem src, IssuedFor issuedFor, CCPCharacter character) : base(src, issuedFor, character) { }
/// <summary> /// Constructor from the API. /// </summary> /// <param name="src">The source.</param> /// <param name="issuedFor">Whether the order was issued for a corporation or a /// character.</param> internal BuyOrder(EsiOrderListItem src, IssuedFor issuedFor, CCPCharacter character) : base(src, issuedFor, character) { Escrow = src.Escrow; Range = src.Range; }
/// <summary> /// Constructor from an object deserialized from the settings file. /// </summary> /// <param name="src"></param> internal BuyOrder(SerializableOrderBase src, CCPCharacter character) : base(src, character) { }
/// <summary> /// Called when character's skill in training gets updated. /// </summary> /// <param name="result">The result.</param> /// <param name="characterName">The character's name.</param> private void OnSkillInTrainingUpdated(CCPAPIResult <SerializableAPISkillInTraining> result, string characterName) { // Quit if the API key was deleted while it was updating if (!EveMonClient.APIKeys.Contains(this)) { return; } CCPCharacter ccpCharacter = EveMonClient.Characters.OfType <CCPCharacter>().FirstOrDefault(x => x.Name == characterName); // Checks if EVE database is out of service if (result.EVEDatabaseError) { return; } // Return on error if (result.HasError) { if (ccpCharacter != null && ccpCharacter.ShouldNotifyError(result, CCPAPICharacterMethods.SkillInTraining)) { EveMonClient.Notifications.NotifySkillInTrainingError(ccpCharacter, result); } m_skillInTrainingCache[characterName].State = ResponseState.InError; return; } m_skillInTrainingCache[characterName].State = result.Result.SkillInTraining == 1 ? ResponseState.Training : ResponseState.NotTraining; // In the event this becomes a very long running process because of latency // and characters have been removed from the API key since they were queried // remove those characters from the cache IEnumerable <KeyValuePair <string, SkillInTrainingResponse> > toRemove = m_skillInTrainingCache.Where(x => CharacterIdentities.All(y => y.CharacterName != x.Key)); foreach (KeyValuePair <string, SkillInTrainingResponse> charToRemove in toRemove) { m_skillInTrainingCache.Remove(charToRemove.Key); } // If we did not get response from a character in API key yet // or there was an error in any responce, // we are not sure so wait until next time if (m_skillInTrainingCache.Any(x => x.Value.State == ResponseState.Unknown || x.Value.State == ResponseState.InError)) { return; } // We have successful responces from all characters in API key, // so we notify the user and fire the event NotifyAccountNotInTraining(); // Fires the event regarding the API key characters skill in training update EveMonClient.OnCharactersSkillInTrainingUpdated(this); // Reset update pending flag m_updatePending = false; }