コード例 #1
0
        /// <summary>
        /// Imports the character identities from a serialization object
        /// </summary>
        /// <param name="serial"></param>
        /// <param name="charactersGuid"></param>
        internal void Import(IEnumerable <SerializableSettingsCharacter> serial)
        {
            // Clear the accounts on every identity
            foreach (var id in EveClient.CharacterIdentities)
            {
                id.Account = null;
            }

            // Import the characters, their identies, etc
            m_items.Clear();
            foreach (var serialCharacter in serial)
            {
                // Gets the identity or create it
                var id = EveClient.CharacterIdentities[serialCharacter.ID];
                if (id == null)
                {
                    id = EveClient.CharacterIdentities.Add(serialCharacter.ID, serialCharacter.Name);
                }

                // Imports the character
                var ccpCharacter = serialCharacter as SerializableCCPCharacter;
                if (ccpCharacter != null)
                {
                    m_items.Add(new CCPCharacter(id, ccpCharacter));
                }
                else
                {
                    var uriCharacter = serialCharacter as SerializableUriCharacter;
                    m_items.Add(new UriCharacter(id, uriCharacter));
                }
            }

            // Notify the change
            EveClient.OnCharacterCollectionChanged();
        }
コード例 #2
0
 /// <summary>
 /// Removes the provided character for the uri characters
 /// </summary>
 /// <param name="character">The character to remove</param>
 /// <exception cref="InvalidOperationException">This character does not have that identity</exception>
 public void Remove(UriCharacter character)
 {
     if (!m_uriCharacters.Remove(character))
     {
         throw new InvalidOperationException("This source does not belong to this character's sources");
     }
     EveClient.OnCharacterCollectionChanged();
 }
コード例 #3
0
 /// <summary>
 /// Adds a character to this collection.
 /// </summary>
 /// <param name="character"></param>
 /// <param name="notify"></param>
 internal void Add(Character character, bool notify)
 {
     m_items.Add(character);
     if (notify)
     {
         EveClient.OnCharacterCollectionChanged();
     }
 }
コード例 #4
0
        /// <summary>
        /// Addsa new UriCharacter with the specified Uri and deserialization object, then returns it
        /// </summary>
        /// <param name="uri">The source uri</param>
        /// <param name="result">The deserialization object acquired from the given uri</param>
        /// <returns>The created character, or null if there was errors on the provided CCP data.</returns>
        internal UriCharacter Add(Uri uri, APIResult <SerializableAPICharacterSheet> result)
        {
            if (result.HasError)
            {
                return(null);
            }

            var character = new UriCharacter(m_characterID, uri, result);

            m_uriCharacters.Add(character);

            EveClient.OnCharacterCollectionChanged();
            return(character);
        }
コード例 #5
0
        /// <summary>
        /// Adds a character from a deserialization object
        /// </summary>
        /// <param name="serial"></param>
        internal void Add(SerializableUriCharacter serial)
        {
            var uriCharacter = this[new Uri(serial.Uri)];

            if (uriCharacter == null)
            {
                m_uriCharacters.Add(new UriCharacter(m_characterID, serial));
                EveClient.OnCharacterCollectionChanged();
            }
            else
            {
                uriCharacter.Import(serial);
            }
        }
コード例 #6
0
        /// <summary>
        /// Removes a character from this collection.
        /// Also removes it from the monitored characters collection, and assign it to the ignore list of its account.
        /// </summary>
        /// <param name="character"></param>
        /// <param name="notify"></param>
        internal void Remove(Character character, bool notify)
        {
            m_items.Remove(character);
            character.Monitored = false;

            // For CCP characters, also put it on the account's ignore list.
            if (character is CCPCharacter)
            {
                var account = character.Identity.Account;
                if (account != null)
                {
                    account.IgnoreList.Add(character as CCPCharacter);
                }
            }

            if (notify)
            {
                EveClient.OnCharacterCollectionChanged();
            }
        }