Esempio n. 1
0
        /// <summary>
        /// Gets the names of the IDs.
        /// </summary>
        /// <param name="src">A list of IDs.</param>
        /// <returns>A list of names</returns>
        private IEnumerable <string> GetIDsToNames(ICollection <string> src)
        {
            // If there are no IDs to query return a list with an empty entry
            if (!src.Any())
            {
                src.Add(String.Empty);
                return(src);
            }

            List <string> listOfNames      = new List <string>();
            List <string> listOfIDsToQuery = new List <string>();

            foreach (string id in src)
            {
                if (id == m_ccpCharacter.CharacterID.ToString(CultureConstants.InvariantCulture))
                {
                    listOfNames.Add(m_ccpCharacter.Name);
                }
                else
                {
                    listOfIDsToQuery.Add(id);
                }
            }

            // We have IDs to query
            if (listOfIDsToQuery.Any())
            {
                listOfNames.AddRange(EveIDToName.GetIDsToNames(listOfIDsToQuery));
            }

            return(listOfNames);
        }
Esempio n. 2
0
        /// <summary>
        /// Populates the serialization object contract with the info from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        private void PopulateContractInfo(EsiContractListItem src)
        {
            src.ThrowIfNull(nameof(src));

            m_method         = src.APIMethod;
            ID               = src.ContractID;
            IssuerID         = src.IssuerID;
            AssigneeID       = src.AssigneeID;
            Description      = src.Title.IsEmptyOrUnknown() ? "(None)" : src.Title;
            IssuedFor        = src.ForCorp ? IssuedFor.Corporation : IssuedFor.Character;
            Issued           = src.DateIssued;
            Expiration       = src.DateExpired;
            Duration         = (int)Math.Round(src.DateExpired.Subtract(src.DateIssued).TotalDays);
            DaysToComplete   = src.NumDays;
            Price            = src.Price;
            Reward           = src.Reward;
            Collateral       = src.Collateral;
            Buyout           = src.Buyout;
            Volume           = src.Volume;
            m_startStationID = src.StartStationID;
            m_endStationID   = src.EndStationID;
            UpdateStation();
            UpdateContractInfo(src);

            Availability = src.Availability;
            ContractType = src.ContractType;
            // Issuer and assignee
            m_issuer = src.ForCorp ? Character.Corporation.Name : EveIDToName.GetIDToName(
                src.IssuerID);
            m_assignee = EveIDToName.GetIDToName(src.AssigneeID);
        }
Esempio n. 3
0
        /// <summary>
        /// Gets the names of the IDs.
        /// </summary>
        /// <param name="src">A list of IDs.</param>
        /// <returns>A list of names</returns>
        private IEnumerable <string> GetIDsToNames(ICollection <long> src)
        {
            // If there are no IDs to query return an empty list
            if (!src.Any())
            {
                return(NO_SENDER);
            }

            List <string> listOfNames      = new List <string>();
            List <long>   listOfIDsToQuery = new List <long>();

            foreach (long id in src)
            {
                if (id == m_ccpCharacter.CharacterID)
                {
                    listOfNames.Add(m_ccpCharacter.Name);
                }
                else
                {
                    listOfIDsToQuery.Add(id);
                }
            }

            // We have IDs to query
            if (listOfIDsToQuery.Any())
            {
                listOfNames.AddRange(EveIDToName.GetIDsToNames(listOfIDsToQuery).Select(x => x ??
                                                                                        EveMonConstants.UnknownText));
            }

            return(listOfNames);
        }
Esempio n. 4
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        internal Loyalty(Character character, EsiLoyaltyListItem src)
        {
            m_character = character;

            LoyaltyPoints     = src.LoyaltyPoints;
            CorpId            = src.CorpID;
            m_corporationName = EveIDToName.GetIDToName(src.CorpID);
        }
Esempio n. 5
0
        /// <summary>
        /// Populates the serialization object contract with the info from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        private void PopulateContractInfo(SerializableContractListItem src)
        {
            ContractAvailability avail;
            ContractType         type;

            src.ThrowIfNull(nameof(src));

            m_method = src.APIMethod;

            ID               = src.ContractID;
            IssuerID         = src.IssuerID;
            AssigneeID       = src.AssigneeID;
            Description      = string.IsNullOrWhiteSpace(src.Title) ? "(None)" : src.Title;
            IssuedFor        = src.ForCorp ? IssuedFor.Corporation : IssuedFor.Character;
            Issued           = src.DateIssued;
            Expiration       = src.DateExpired;
            Duration         = (int)Math.Round(src.DateExpired.Subtract(src.DateIssued).TotalDays);
            DaysToComplete   = src.NumDays;
            Price            = src.Price;
            Reward           = src.Reward;
            Collateral       = src.Collateral;
            Buyout           = src.Buyout;
            Volume           = src.Volume;
            m_startStationID = src.StartStationID;
            m_endStationID   = src.EndStationID;
            UpdateStation();
            UpdateContractInfo(src);

            // Parse availability and contract type
            if (!Enum.TryParse(src.Availability, true, out avail))
            {
                avail = ContractAvailability.None;
            }
            Availability = avail;
            if (!Enum.TryParse(src.Type, true, out type))
            {
                type = ContractType.None;
            }
            ContractType = type;
            // Issuer and assignee
            m_issuer = src.ForCorp ? Character.Corporation.Name : EveIDToName.GetIDToName(
                src.IssuerID);
            m_assignee = EveIDToName.GetIDToName(src.AssigneeID);

            /*
             * // Retrieve items
             * if (ContractType != ContractType.Courier)
             *  GetContractData<EsiAPIContractItems>(OnContractItemsDownloaded,
             *      ESIAPICorporationMethods.CorporationContractItems,
             *      ESIAPICharacterMethods.ContractItems);
             * // Retrieve bids
             * if (ContractType == ContractType.Auction)
             *  GetContractData<EsiAPIContractBids>(OnContractBidsUpdated,
             *      ESIAPICorporationMethods.CorporationContractBids,
             *      ESIAPICharacterMethods.ContractBids);
             */
        }
Esempio n. 6
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="character"></param>
        /// <param name="src"></param>
        internal Standing(Character character, SerializableStandingsListItem src)
        {
            m_character = character;

            m_entityID    = src.ID;
            m_entityName  = EveIDToName.GetIDToName(m_entityID);
            StandingValue = src.StandingValue;
            Group         = src.Group;
        }
Esempio n. 7
0
        /// <summary>
        /// Gets the names of the IDs.
        /// </summary>
        /// <param name="src">A list of IDs.</param>
        /// <returns>A list of names</returns>
        private IEnumerable <string> GetIDsToNames(ICollection <long> src)
        {
            // If there are no IDs to query return an empty list
            if (!src.Any())
            {
                return(NO_SENDER);
            }

            return(EveIDToName.GetIDsToNames(src).Select(x => x ?? EveMonConstants.UnknownText));
        }
Esempio n. 8
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="character">The character.</param>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        public EmploymentRecord(Character character, SerializableEmploymentHistoryListItem src)
        {
            src.ThrowIfNull(nameof(src));

            m_character       = character;
            m_corporationId   = src.CorporationID;
            m_corporationName = string.IsNullOrWhiteSpace(src.CorporationName)
                ? EveIDToName.GetIDToName(src.CorporationID) : src.CorporationName;
            StartDate = src.StartDate;
        }
Esempio n. 9
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        internal ContractBid(EsiContractBidsListItem src)
        {
            src.ThrowIfNull(nameof(src));

            ID         = src.ID;
            m_bidderId = src.BidderID;
            m_bidder   = EveIDToName.GetIDToName(src.BidderID);
            BidDate    = src.DateBid;
            Amount     = src.Amount;
        }
Esempio n. 10
0
 /// <summary>
 /// Updates the contract info.
 /// </summary>
 /// <param name="src">The source.</param>
 private void UpdateContractInfo(EsiContractListItem src)
 {
     Accepted   = src.DateAccepted;
     Completed  = src.DateCompleted;
     AcceptorID = src.AcceptorID;
     m_acceptor = EveIDToName.GetIDToName(src.AcceptorID);
     Status     = src.ContractStatus;
     if (Overdue)
     {
         Status = CCPContractStatus.Overdue;
     }
 }
Esempio n. 11
0
        /// <summary>
        /// Populates the serialization object contract with the info from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        private void PopulateContractInfo(SerializableContractListItem src)
        {
            src.ThrowIfNull(nameof(src));

            m_method = src.APIMethod;

            ID               = src.ContractID;
            IssuerID         = src.IssuerID;
            AssigneeID       = src.AssigneeID;
            Description      = String.IsNullOrWhiteSpace(src.Title) ? "(None)" : src.Title;
            IssuedFor        = src.ForCorp ? IssuedFor.Corporation : IssuedFor.Character;
            Issued           = src.DateIssued;
            Expiration       = src.DateExpired;
            Duration         = Convert.ToInt32(src.DateExpired.Subtract(src.DateIssued).TotalDays);
            DaysToComplete   = src.NumDays;
            Price            = src.Price;
            Reward           = src.Reward;
            Collateral       = src.Collateral;
            Buyout           = src.Buyout;
            Volume           = src.Volume;
            m_startStationID = src.StartStationID;
            m_endStationID   = src.EndStationID;
            UpdateStation();
            UpdateContractInfo(src);

            Availability = Enum.IsDefined(typeof(ContractAvailability), src.Availability)
                ? (ContractAvailability)Enum.Parse(typeof(ContractAvailability), src.Availability)
                : ContractAvailability.None;

            ContractType = Enum.IsDefined(typeof(ContractType), src.Type)
                ? (ContractType)Enum.Parse(typeof(ContractType), src.Type)
                : ContractType.None;

            m_issuer = src.ForCorp
                ? Character.Corporation.Name
                : src.IssuerID == Character.CharacterID
                    ? Character.Name
                    : EveIDToName.GetIDToName(src.IssuerID);


            m_assignee = src.AssigneeID == Character.CharacterID
                ? Character.Name
                : src.AssigneeID == Character.CorporationID
                    ? Character.Corporation.Name
                    : EveIDToName.GetIDToName(src.AssigneeID);


            if (ContractType != ContractType.Courier)
            {
                GetContractItems();
            }
        }
Esempio n. 12
0
        /// <summary>
        /// Base constructor.
        /// </summary>
        /// <param name="identity"></param>
        /// <param name="guid"></param>
        private CCPCharacter(CharacterIdentity identity, Guid guid)
            : base(identity, guid)
        {
            QueryMonitors           = new QueryMonitorCollection();
            SkillQueue              = new SkillQueue(this);
            Standings               = new StandingCollection(this);
            Assets                  = new AssetCollection(this);
            WalletJournal           = new WalletJournalCollection(this);
            WalletTransactions      = new WalletTransactionsCollection(this);
            CharacterMarketOrders   = new MarketOrderCollection(this);
            CorporationMarketOrders = new MarketOrderCollection(this);
            CharacterContracts      = new ContractCollection(this);
            CorporationContracts    = new ContractCollection(this);
            CharacterIndustryJobs   = new IndustryJobCollection(this);
            CorporationIndustryJobs = new IndustryJobCollection(this);
            ResearchPoints          = new ResearchPointCollection(this);
            EVEMailMessages         = new EveMailMessageCollection(this);
            EVEMailingLists         = new EveMailingListCollection(this);
            EVENotifications        = new EveNotificationCollection(this);
            Contacts                = new ContactCollection(this);
            CharacterMedals         = new MedalCollection(this);
            CorporationMedals       = new MedalCollection(this);
            UpcomingCalendarEvents  = new UpcomingCalendarEventCollection(this);
            KillLog                 = new KillLogCollection(this);
            PlanetaryColonies       = new PlanetaryColonyCollection(this);
            LoyaltyPoints           = new LoyaltyCollection(this);

            m_endedOrdersForCharacter   = new List <MarketOrder>();
            m_endedOrdersForCorporation = new List <MarketOrder>();

            m_endedContractsForCharacter   = new List <Contract>();
            m_endedContractsForCorporation = new List <Contract>();

            m_jobsCompletedForCharacter = new List <IndustryJob>();
            m_allianceName    = EveIDToName.GetIDToName(AllianceID);
            m_corporationName = EveIDToName.GetIDToName(CorporationID);

            EveMonClient.CharacterAssetsUpdated           += EveMonClient_CharacterAssetsUpdated;
            EveMonClient.CharacterMarketOrdersUpdated     += EveMonClient_CharacterMarketOrdersUpdated;
            EveMonClient.CorporationMarketOrdersUpdated   += EveMonClient_CorporationMarketOrdersUpdated;
            EveMonClient.CharacterContractsUpdated        += EveMonClient_CharacterContractsUpdated;
            EveMonClient.CorporationContractsUpdated      += EveMonClient_CorporationContractsUpdated;
            EveMonClient.CharacterIndustryJobsUpdated     += EveMonClient_CharacterIndustryJobsUpdated;
            EveMonClient.CorporationIndustryJobsUpdated   += EveMonClient_CorporationIndustryJobsUpdated;
            EveMonClient.CharacterIndustryJobsCompleted   += EveMonClient_CharacterIndustryJobsCompleted;
            EveMonClient.CorporationIndustryJobsCompleted += EveMonClient_CorporationIndustryJobsCompleted;
            EveMonClient.CharacterPlaneteryPinsCompleted  += EveMonClient_CharacterPlaneteryPinsCompleted;
            EveMonClient.ESIKeyInfoUpdated  += EveMonClient_ESIKeyInfoUpdated;
            EveMonClient.EveIDToNameUpdated += EveMonClient_EveIDToNameUpdated;
            EveMonClient.TimerTick          += EveMonClient_TimerTick;
        }
Esempio n. 13
0
        /// <summary>
        /// Gets the corporation name from the provided ID.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        private static string GetIDToName(long id)
        {
            string corporationName = String.Empty;

            // Check if it's an NPC Corporation
            if (id <= Int32.MaxValue)
            {
                NPCCorporation corporation = StaticGeography.GetCorporationByID((int)id);
                corporationName = corporation?.Name ?? String.Empty;
            }

            // If it's a player's corporation, query the API
            return(string.IsNullOrEmpty(corporationName) ? EveIDToName.GetIDToName(id) : corporationName);
        }
Esempio n. 14
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="ccpCharacter">The CCP character.</param>
        /// <param name="src">The source.</param>
        internal UpcomingCalendarEvent(CCPCharacter ccpCharacter, EsiAPICalendarEvent src)
        {
            m_ccpCharacter = ccpCharacter;

            m_eventID        = src.EventID;
            OwnerID          = src.OwnerID;
            m_ownerName      = EveIDToName.GetIDToName(OwnerID);
            EventTitle       = src.EventTitle;
            EventText        = src.EventText;
            Duration         = src.Duration;
            Importance       = src.Importance != 0;
            Response         = src.Response;
            EventDate        = src.EventDate;
            m_eventAttendees = new List <CalendarEventAttendee>();
        }
Esempio n. 15
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="src"></param>
        internal FactionalWarfareStats(EsiAPIFactionalWarfareStats src)
        {
            src.ThrowIfNull(nameof(src));

            FactionID              = src.FactionID;
            FactionName            = EveIDToName.GetIDToName(FactionID);
            EnlistedDate           = src.EnlistedDate;
            CurrentRank            = src.CurrentRank;
            HighestRank            = src.HighestRank;
            KillsYesterday         = src.Kills?.Yesterday ?? 0;
            KillsLastWeek          = src.Kills?.LastWeek ?? 0;
            KillsTotal             = src.Kills?.Total ?? 0;
            VictoryPointsYesterday = src.VictoryPoints?.Yesterday ?? 0;
            VictoryPointsLastWeek  = src.VictoryPoints?.LastWeek ?? 0;
            VictoryPointsTotal     = src.VictoryPoints?.Total ?? 0;
        }
Esempio n. 16
0
        /// <summary>
        /// Updates the contract info.
        /// </summary>
        /// <param name="src">The source.</param>
        private void UpdateContractInfo(SerializableContractListItem src)
        {
            Accepted   = src.DateAccepted;
            Completed  = src.DateCompleted;
            AcceptorID = src.AcceptorID;
            m_acceptor = src.AcceptorID == Character.CharacterID ? Character.Name :
                         (src.AcceptorID == Character.CorporationID ? Character.Corporation.Name :
                          EveIDToName.GetIDToName(src.AcceptorID));

            Status = GetStatus(src);

            if (Overdue)
            {
                Status = CCPContractStatus.Overdue;
            }
        }
Esempio n. 17
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="src"></param>
        internal Contact(SerializableContactListItem src)
        {
            m_contactID   = src.ContactID;
            m_contactName = EveIDToName.GetIDToName(m_contactID);
            IsInWatchlist = src.InWatchlist;
            Standing      = src.Standing;
            Group         = src.Group == ContactGroup.Personal && StaticGeography.AllAgents.Any(x => x.ID == m_contactID)
                ? ContactGroup.Agent
                : src.Group;

            m_contactType       = src.ContactTypeID == DBConstants.CorporationID
                ? m_contactType = ContactType.Corporation
                : src.ContactTypeID == DBConstants.AllianceID
                    ? m_contactType = ContactType.Alliance
                    : ContactType.Character;
        }
Esempio n. 18
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="ccpCharacter">The CCP character.</param>
        /// <param name="src">The source.</param>
        internal EveNotification(CCPCharacter ccpCharacter, EsiNotificationsListItem src)
        {
            string typeCode = src.Type;

            m_ccpCharacter = ccpCharacter;
            NotificationID = src.NotificationID;
            TypeID         = EveNotificationType.GetID(typeCode);
            TypeName       = EveNotificationType.GetName(TypeID);
            m_senderID     = src.SenderID;
            m_title        = string.Empty;
            m_senderName   = (m_senderID == 0L) ? "EVE System" : EveIDToName.GetIDToName(m_senderID);
            SentDate       = src.SentDate;
            Recipient      = new List <string> {
                ccpCharacter.Name
            };
            EVENotificationText = new EveNotificationText(this, TypeID, src.NotificationText);
        }
Esempio n. 19
0
        /// <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);
        }
Esempio n. 20
0
 /// <summary>
 /// Imports data from the given character sheet informations.
 /// </summary>
 /// <param name="serial">The serialized character sheet</param>
 internal void Import(EsiAPICharacterSheet serial)
 {
     // Import from ESI
     m_name         = serial.Name;
     Birthday       = serial.Birthday;
     Race           = serial.Race.ToString().UnderscoresToDashes();
     Bloodline      = serial.BloodLine.ToString().UnderscoresToDashes();
     Ancestry       = serial.Ancestry.ToString().Replace('_', ' ');
     Gender         = serial.Gender.ToTitleCase();
     CorporationID  = serial.CorporationID;
     AllianceID     = serial.AllianceID;
     FactionID      = serial.FactionID;
     SecurityStatus = serial.SecurityStatus;
     // Enable bypass since we would have a circular loop otherwise
     CorporationName = EveIDToName.GetIDToName(CorporationID, true);
     AllianceName    = EveIDToName.GetIDToName(AllianceID, true);
     FactionName     = EveIDToName.GetIDToName(FactionID);
 }
Esempio n. 21
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="ccpCharacter">The CCP character.</param>
        /// <param name="src">The source.</param>
        internal EveNotification(CCPCharacter ccpCharacter, EsiNotificationsListItem src)
        {
            m_ccpCharacter = ccpCharacter;

            NotificationID = src.NotificationID;
            TypeID         = EveNotificationType.GetID(src.Type);
            m_senderID     = src.SenderID;
            m_senderName   = (m_senderID == 0L) ? "EVE System" : EveIDToName.GetIDToName(m_senderID);
            SentDate       = src.SentDate;
            Recipient      = new List <string> {
                ccpCharacter.Name
            };
            EVENotificationText = new EveNotificationText(this, new SerializableNotificationTextsListItem
            {
                NotificationID   = 0,
                NotificationText = String.Empty,
            });
        }
Esempio n. 22
0
 /// <summary>
 /// Imports data from the given character sheet informations.
 /// </summary>
 /// <param name="serial">The serialized character sheet</param>
 internal void Import(EsiAPICharacterSheet serial)
 {
     // Import from ESI
     m_name          = serial.Name;
     Birthday        = serial.Birthday;
     Race            = serial.Race.ToString().UnderscoresToDashes();
     Bloodline       = serial.BloodLine.ToString().UnderscoresToDashes();
     Ancestry        = serial.Ancestry.ToString().Replace('_', ' ');
     Gender          = serial.Gender.ToTitleCase();
     CorporationID   = serial.CorporationID;
     AllianceID      = serial.AllianceID;
     FactionID       = serial.FactionID;
     SecurityStatus  = serial.SecurityStatus;
     CorporationName = EveIDToName.GetIDToName(CorporationID);
     AllianceName    = EveIDToName.GetIDToName(AllianceID);
     FactionName     = EveIDToName.GetIDToName(FactionID);
     EveMonClient.OnCharacterUpdated(this);
 }
Esempio n. 23
0
        /// <summary>
        /// Gets the corporation name from the provided ID.
        /// </summary>
        /// <param name="id">The id.</param>
        /// <returns></returns>
        private static string GetIDToName(long id)
        {
            string corporationName = String.Empty;

            // Check if it's an NPC Corporation
            if (id > Int32.MaxValue)
            {
                return(String.IsNullOrEmpty(corporationName) ? EveIDToName.GetIDToName(id) : corporationName);
            }

            int            npcCorpID   = Convert.ToInt32(id);
            NPCCorporation corporation = StaticGeography.GetCorporationByID(npcCorpID);

            corporationName = corporation?.Name ?? String.Empty;

            // If it's a player's corporation, query the API
            return(String.IsNullOrEmpty(corporationName) ? EveIDToName.GetIDToName(id) : corporationName);
        }
Esempio n. 24
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WalletTransaction" /> class.
        /// </summary>
        /// <param name="src">The SRC.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        internal WalletTransaction(SerializableWalletTransactionsListItem src)
        {
            src.ThrowIfNull(nameof(src));

            ID              = src.ID;
            JournalID       = src.JournalTransactionID;
            Date            = src.TransactionDate;
            ItemName        = src.TypeName;
            Quantity        = src.Quantity;
            Price           = src.Price;
            m_clientID      = src.ClientID;
            m_clientName    = EveIDToName.GetIDToName(m_clientID);
            TransactionType = src.TransactionType == "buy" ? TransactionType.Buy : TransactionType.Sell;
            TransactionFor  = src.TransactionFor == "personal" ? IssuedFor.Character : IssuedFor.Corporation;
            m_stationID     = src.StationID;
            UpdateStation();

            Credit = GetCredit();
        }
Esempio n. 25
0
        /// <summary>
        /// Populates the serialization object contract with the info from the API.
        /// </summary>
        /// <param name="src">The source.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        private void PopulateContractInfo(SerializableContractListItem src)
        {
            ContractAvailability avail;
            ContractType         type;

            src.ThrowIfNull(nameof(src));

            m_method         = src.APIMethod;
            ID               = src.ContractID;
            IssuerID         = src.IssuerID;
            AssigneeID       = src.AssigneeID;
            Description      = src.Title.IsEmptyOrUnknown() ? "(None)" : src.Title;
            IssuedFor        = src.ForCorp ? IssuedFor.Corporation : IssuedFor.Character;
            Issued           = src.DateIssued;
            Expiration       = src.DateExpired;
            Duration         = (int)Math.Round(src.DateExpired.Subtract(src.DateIssued).TotalDays);
            DaysToComplete   = src.NumDays;
            Price            = src.Price;
            Reward           = src.Reward;
            Collateral       = src.Collateral;
            Buyout           = src.Buyout;
            Volume           = src.Volume;
            m_startStationID = src.StartStationID;
            m_endStationID   = src.EndStationID;
            UpdateStation();
            UpdateContractInfo(src);

            // Parse availability and contract type
            if (!Enum.TryParse(src.Availability, true, out avail))
            {
                avail = ContractAvailability.None;
            }
            Availability = avail;
            if (!Enum.TryParse(src.Type, true, out type))
            {
                type = ContractType.None;
            }
            ContractType = type;
            // Issuer and assignee
            m_issuer = src.ForCorp ? Character.Corporation.Name : EveIDToName.GetIDToName(
                src.IssuerID);
            m_assignee = EveIDToName.GetIDToName(src.AssigneeID);
        }
Esempio n. 26
0
        /// <summary>
        /// Constructor from the API.
        /// </summary>
        /// <param name="ccpCharacter"></param>
        /// <param name="src"></param>
        internal EveMailMessage(CCPCharacter ccpCharacter, SerializableMailMessagesListItem src)
        {
            if (ccpCharacter == null)
            {
                throw new ArgumentNullException("ccpCharacter");
            }

            m_ccpCharacter = ccpCharacter;
            m_source       = src;
            m_bodyResponse = null;

            long senderID = src.SenderID;

            State = (senderID != ccpCharacter.CharacterID) ? EveMailState.Inbox :
                    EveMailState.SentItem;
            MessageID = src.MessageID;
            SentDate  = src.SentDate;
            Title     = src.Title.HtmlDecode();

            // Was it sent from a mailing list?
            if (src.ToListID.Contains(senderID))
            {
                m_senderName = ccpCharacter.EVEMailingLists.FirstOrDefault(x => x.ID ==
                                                                           senderID)?.Name ?? EveMonConstants.UnknownText;
            }
            else if (senderID == 0L)
            {
                m_senderName = EveMonConstants.UnknownText;
            }
            else
            {
                m_senderName = EveIDToName.GetIDToName(senderID);
            }
            m_toCharacters     = GetIDsToNames(src.ToCharacterIDs);
            m_toMailingLists   = GetMailingListIDsToNames(src.ToListID);
            m_toCorpOrAlliance = EveIDToName.GetIDToName(src.ToCorpOrAllianceID);

            EVEMailBody = new EveMailBody(0L, new EsiAPIMailBody()
            {
                Body = ""
            });
        }
Esempio n. 27
0
        /// <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();
            m_senderName       = EveIDToName.GetIDToName(src.SenderID);
            m_toCharacters     = GetIDsToNames(src.ToCharacterIDs);
            m_toMailingLists   = GetMailingListIDsToNames(src.ToListID);
            m_toCorpOrAlliance = EveIDToName.GetIDToName(src.ToCorpOrAllianceID);

            EVEMailBody = new EveMailBody(0L, new EsiAPIMailBody()
            {
                Body = ""
            });
        }
Esempio n. 28
0
        /// <summary>
        /// Initializes a new instance of the <see cref="WalletJournal" /> class.
        /// </summary>
        /// <param name="src">The SRC.</param>
        /// <exception cref="System.ArgumentNullException">src</exception>
        internal WalletJournal(SerializableWalletJournalListItem src)
        {
            src.ThrowIfNull(nameof(src));

            m_refTypeID     = src.RefTypeID;
            m_taxReceiverID = src.TaxReceiverID;

            ID           = src.ID;
            Date         = src.Date;
            Amount       = src.Amount;
            Balance      = src.Balance;
            m_ownerID1   = src.OwnerID1;
            m_ownerName1 = EveIDToName.GetIDToName(m_ownerID1);
            m_ownerID2   = src.OwnerID2;
            m_ownerName2 = EveIDToName.GetIDToName(m_ownerID2);
            TaxAmount    = src.TaxAmount;

            Reason        = ParseReason(src.Reason);
            m_refType     = EveRefType.GetRefTypeIDToName(src.RefTypeID);
            m_taxReceiver = GetTaxReceiver();
        }
Esempio n. 29
0
 /// <summary>
 /// Updates the names and corporations/alliances of victims and attackers.
 /// </summary>
 public void UpdateCharacterNames()
 {
     if (Victim != null)
     {
         // Update victim's info
         Victim.AllianceName    = EveIDToName.GetIDToName(Victim.AllianceID);
         Victim.CorporationName = EveIDToName.GetIDToName(Victim.CorporationID);
         Victim.FactionName     = EveIDToName.GetIDToName(Victim.FactionID);
         Victim.Name            = EveIDToName.GetIDToName(Victim.ID);
     }
     if (Attackers != null)
     {
         foreach (var attacker in Attackers)
         {
             // Update attacker's info
             attacker.AllianceName    = EveIDToName.GetIDToName(attacker.AllianceID);
             attacker.CorporationName = EveIDToName.GetIDToName(attacker.CorporationID);
             attacker.FactionName     = EveIDToName.GetIDToName(attacker.FactionID);
             attacker.Name            = EveIDToName.GetIDToName(attacker.ID);
         }
     }
 }
Esempio n. 30
0
        /// <summary>
        /// Handles the EveIDToNameUpdated event of the EveMonClient control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="System.EventArgs"/> instance containing the event data.</param>
        private void EveMonClient_EveIDToNameUpdated(object sender, EventArgs e)
        {
            bool   updated = false;
            string cname = CorporationName, aname = AllianceName, fname = FactionName;

            // If the corp, alliance, or faction was unknown, update it
            if (cname.IsEmptyOrUnknown())
            {
                CorporationName = EveIDToName.GetIDToName(CorporationID);
                if (CorporationName != cname)
                {
                    updated = true;
                }
            }
            if (aname.IsEmptyOrUnknown())
            {
                AllianceName = EveIDToName.GetIDToName(AllianceID);
                if (AllianceName != aname)
                {
                    updated = true;
                }
            }
            if (fname.IsEmptyOrUnknown())
            {
                FactionName = EveIDToName.GetIDToName(FactionID);
                if (FactionName != fname)
                {
                    updated = true;
                }
            }

            // Only fire update if the new names changed
            if (updated)
            {
                EveMonClient.OnCharacterInfoUpdated(this);
            }
        }