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 } }); }
static void Main(string[] args) { using (var repo = Repository.Create()) { if (args.Length > 2) { var charId = args[0].Trim(); var apiKeyId = args[1].Trim(); var apiSecret = args[2].Trim(); var apiKey = new model.ApiKey { Id = Int32.Parse(apiKeyId), Secret = apiSecret }; ModelCharacter.AddNew(repo, apiKey, Int32.Parse(charId)).Wait(); } else { ModelCharacter.UpdateExisting(repo).Wait(); } } }
public void AddApiKey(model.ApiKey apiKey) { m_Db.ApiKeys.Add(apiKey); }
public static async Task AddNew(IRepository repo, model.ApiKey apiKey, int charId) { var character = await repo.CharacterFromApi(apiKey, charId); repo.AddCharacter(character); }