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

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

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

            // We have IDs to query
            if (listOfIDsToQuery.Count > 0)
            {
                listOfNames.AddRange(EveIDtoName.GetIDsToNames(listOfIDsToQuery));
            }

            return(listOfNames);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the name of the ID.
        /// </summary>
        /// <param name="ID">The ID.</param>
        /// <returns></returns>
        private string GetIDToName(long ID)
        {
            if (ID == 0)
            {
                return("Unknown");
            }

            // Look into EVEMon's data file if it's an NPC corporation or agent
            foreach (var station in StaticGeography.AllStations)
            {
                if (station.CorporationID == ID && station.CorporationName != null)
                {
                    return(station.CorporationName);
                }

                if (station.Agents.Any(x => x.ID == ID))
                {
                    return(station.Agents.First(x => x.ID == ID).Name);
                }
            }

            // Lookup if it's a players null sec corporation
            // (while we have the data we can avoid unnecessary queries to the API)
            Station conqStation = ConquerableStation.AllStations.FirstOrDefault(x => x.CorporationID == ID);

            if (conqStation != null)
            {
                return(conqStation.CorporationName);
            }

            // Didn't found any ? Query the API
            return(EveIDtoName.GetIDToName(ID.ToString()));
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Constructor from the API.
 /// </summary>
 /// <param name="src"></param>
 internal EveMailMessage(CCPCharacter ccpCharacter, SerializableMailMessagesListItem src)
 {
     m_ccpCharacter = ccpCharacter;
     State          = (src.SenderID != ccpCharacter.CharacterID ?
                       EVEMailState.Inbox : EVEMailState.SentItem);
     MessageID = src.MessageID;
     Sender    = src.ToListID.Any(x => x == src.SenderID.ToString()) ?
                 GetMailingListIDToName(src.SenderID.ToString()) : EveIDtoName.GetIDToName(src.SenderID.ToString());
     SentDate         = src.SentDate;
     Title            = src.Title;
     ToCorpOrAlliance = EveIDtoName.GetIDToName(src.ToCorpOrAllianceID);
     ToCharacters     = GetIDsToNames(src.ToCharacterIDs);
     ToMailingLists   = GetMailingListIDsToNames(src.ToListID);
     Recipient        = GetRecipient();
 }