Ejemplo n.º 1
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="apiKey"></param>
        /// <param name="serialCharacterList"></param>
        /// <param name="serialBalanceList"></param>
        internal AccountCreationEventArgs(long userID, string apiKey,
                                          APIResult <SerializableCharacterList> serialCharacterList,
                                          APIResult <SerializableAccountBalanceList> serialBalanceList)
        {
            m_userID = userID;
            m_apiKey = apiKey;
            m_serialCharacterList = serialCharacterList;
            m_keyLevel            = CredentialsLevel.Unknown;
            m_fullKeyError        = "";

            // Didn't test whether the ley was full because the character list was not retrieved.
            if (serialBalanceList == null)
            {
                m_fullKeyError = serialCharacterList.ErrorMessage;
            }
            // No error ? Then it is a full key
            else
            {
                m_keyLevel = Account.GetCredentialsLevel(serialBalanceList);

                // On error, retrieve the error message.
                if (m_keyLevel == CredentialsLevel.Unknown)
                {
                    m_fullKeyError = serialBalanceList.ErrorMessage;
                }
            }


            // Retrieves the characters list
            if (m_serialCharacterList.HasError)
            {
                return;
            }

            foreach (var serialID in m_serialCharacterList.Result.Characters)
            {
                // Look for an existing char ID and update its name.
                var id = EveClient.CharacterIdentities[serialID.ID];
                if (id != null)
                {
                    id.Name = serialID.Name;
                }
                else
                {
                    // Create an identity if necessary
                    id = EveClient.CharacterIdentities.Add(serialID.ID, serialID.Name);
                }

                m_identities.Add(id);
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="userID"></param>
        /// <param name="apiKey"></param>
        /// <param name="serialCharacterList"></param>
        /// <param name="serialBalanceList"></param>
        internal AccountCreationEventArgs(long userID, string apiKey,
                                          APIResult <SerializableAPIAccountStatus> serialAccountStatus,
                                          APIResult <SerializableAPICharacters> serialCharacterList)
        {
            m_userID = userID;
            m_apiKey = apiKey;
            m_serialAccountStatus = serialAccountStatus;
            m_serialCharacterList = serialCharacterList;
            m_keyLevel            = CredentialsLevel.Unknown;
            m_fullKeyError        = String.Empty;

            //Determine the API key level
            m_keyLevel = Account.GetCredentialsLevel(serialAccountStatus);

            // On error, retrieve the error message
            if (m_keyLevel == CredentialsLevel.Unknown)
            {
                m_fullKeyError = serialAccountStatus.ErrorMessage;
            }

            // Retrieves the characters list
            if (m_serialCharacterList.HasError)
            {
                return;
            }

            foreach (var serialID in m_serialCharacterList.Result.Characters)
            {
                // Look for an existing char ID and update its name
                var id = EveClient.CharacterIdentities[serialID.ID];
                if (id != null)
                {
                    id.Name = serialID.Name;
                }
                else
                {
                    // Create an identity if necessary
                    id = EveClient.CharacterIdentities.Add(serialID.ID, serialID.Name);
                }

                m_identities.Add(id);
            }
        }