/// <summary> /// Deserialization constructor. /// </summary> /// <param name="serial"></param> internal EsiToken(SerializableEsiToken serial) : this() { ClientID = serial.ClientID; ClientSecret = serial.ClientSecret; RefreshToken = serial.RefreshToken; Expiration = serial.Expiration; m_monitored = serial.Monitored; }
/// <summary> /// Updates the API key info and characters list with the given CCP data. /// </summary> /// <param name="result"></param> //private void Import(CCPAPIResult<SerializableAPIKeyInfo> result) //{ // Type = GetCredentialsType(result); // AccessMask = result.Result.Key.AccessMask; // Expiration = result.Result.Key.Expiration; // ImportIdentities(result.HasError ? null : result.Result.Key.Characters); //} /// <summary> /// Updates the characters list with the given CCP data. /// </summary> /// <param name="identities"></param> //private void ImportIdentities(IEnumerable<ISerializableCharacterIdentity> identities) //{ // // Clear the API key on this character // foreach (CharacterIdentity id in EveMonClient.CharacterIdentities.Where(id => id.EsiTokens.Contains(this))) // { // id.EsiTokens.Remove(this); // } // // Return if there were errors in the query // if (identities == null) // return; // // Assign owned identities to this API key // List<ISerializableCharacterIdentity> serializableCharacterIdentities = identities.ToList(); // foreach (CharacterIdentity id in serializableCharacterIdentities.Select( // serialID => EveMonClient.CharacterIdentities[serialID.ID] ?? // EveMonClient.CharacterIdentities.Add(serialID.ID, serialID.Name))) // { // // Update the other info as they may have changed // ISerializableCharacterIdentity characterIdentity = serializableCharacterIdentities.First(x => x.ID == id.CharacterID); // id.CorporationID = characterIdentity.CorporationID; // id.CorporationName = characterIdentity.CorporationName; // id.AllianceID = characterIdentity.AllianceID; // id.AllianceName = characterIdentity.AllianceName; // id.FactionID = characterIdentity.FactionID; // id.FactionName = characterIdentity.FactionName; // // Add the API key to the identity // id.EsiTokens.Add(this); // if (id.CCPCharacter == null) // continue; // // Update the other info // id.CCPCharacter.CorporationID = id.CorporationID; // id.CCPCharacter.CorporationName = id.CorporationName; // id.CCPCharacter.AllianceID = id.AllianceID; // id.CCPCharacter.AllianceName = id.AllianceName; // id.CCPCharacter.FactionID = id.FactionID; // id.CCPCharacter.FactionName = id.FactionName; // // Notify subscribers // EveMonClient.OnCharacterUpdated(id.CCPCharacter); // } // m_characterListUpdated = true; // // Fires the event regarding the character list update // //EveMonClient.OnCharacterListUpdated(this); // // API collection changed, so we'll need to reprocess accounts. // //EveMonClient.OnAPIKeyCollectionChanged(); //} /// <summary> /// Exports the data to a serialization object. /// </summary> /// <returns></returns> internal SerializableEsiToken Export() { SerializableEsiToken serial = new SerializableEsiToken { ClientID = ClientID, ClientSecret = ClientSecret, RefreshToken = RefreshToken, Expiration = Expiration, Monitored = m_monitored, }; return(serial); }