示例#1
0
        public async Task <model.Character> CharacterFromApi(model.ApiKey apiKey, int charId)
        {
            var charKey = new CharacterKey(apiKey.Id, apiKey.Secret);
            await charKey.InitAsync();

            var apiChar    = new ApiCharacter(charKey, charId);
            var charInfo   = (await apiChar.GetCharacterInfoAsync()).Result;
            var charSheet  = (await apiChar.GetCharacterSheetAsync()).Result;
            var skillQueue = (await apiChar.GetSkillQueueAsync()).Result;

            return(new model.Character
            {
                Id = charId,
                Name = charInfo.CharacterName,
                CorpName = charInfo.CorporationName,
                CloneName = charSheet.CloneName,
                CloneSP = charSheet.CloneSkillPoints,
                SP = charInfo.SkillPoints,
                SecStatus = charInfo.SecurityStatus,
                SkillQueue = SkillQueue(skillQueue),
                ApiKey = new model.ApiKey {
                    Id = charKey.KeyId, Secret = charKey.VCode
                }
            });
        }
示例#2
0
 public async Task<model.Character> CharacterFromApi(model.ApiKey apiKey, int charId)
 {
     var charKey = new CharacterKey(apiKey.Id, apiKey.Secret);
     await charKey.InitAsync();
     var apiChar = new ApiCharacter(charKey, charId);
     var charInfo = (await apiChar.GetCharacterInfoAsync()).Result;
     var charSheet = (await apiChar.GetCharacterSheetAsync()).Result;
     var skillQueue = (await apiChar.GetSkillQueueAsync()).Result;
     return new model.Character
     {
         Id = charId,
         Name = charInfo.CharacterName,
         CorpName = charInfo.CorporationName,
         CloneName = charSheet.CloneName,
         CloneSP = charSheet.CloneSkillPoints,
         SP = charInfo.SkillPoints,
         SecStatus = charInfo.SecurityStatus,
         SkillQueue = SkillQueue(skillQueue),
         ApiKey = new model.ApiKey { Id = charKey.KeyId, Secret = charKey.VCode }
     };
 }
 public Character_StaticDeserializationTests() {
     _character = new Character(new CharacterKey(0, ""), 0);
     _character.RequestHandler = new StaticXmlRequestHandler(new XmlSerializer());
 }