private static IEnumerable InitializeAbilityTextInternal() { IsLoading = true; SingleFileImporter importer = new AbilityImporter(); foreach (var state in importer.LoadAsync()) { yield return(state); } importer = new SkillImporter(); foreach (var state in importer.LoadAsync()) { yield return(state); } IsLoading = false; }
public void UpdateCommanderSkills(bool ForceUpdate = false) { LOG.Debug("UpdateCommanderSkills()"); SkillImporter Importer = WGAPI.GetCommanderSkills(); if (Importer.Status.ToLower().Equals("ok")) { string csv = Properties.Settings.Default.CommanderSkillsVersion; if (ForceUpdate || (!csv.Equals("") && !csv.Equals(Importer.Version))) { Program.CommanderSkills = new Dictionary <string, List <Skill> >(); Program.CommanderSkills = Importer.Data; BinarySerialize.WriteToBinaryFile(Commons.GetCommanderSkillFileName(), Program.CommanderSkills); Properties.Settings.Default.CommanderSkillsVersion = Importer.Version; Properties.Settings.Default.Save(); LOG.Info("Imported commander skills: " + Program.CommanderSkills["dd"].Count + ", " + Program.CommanderSkills["ca"].Count + ", " + Program.CommanderSkills["bb"].Count + ", " + Program.CommanderSkills["cv"].Count); } else { LOG.Info("Commander skills are up to date. No import/refresh needed."); } } else { LOG.Warning("Unable to import commander skills: " + Importer.Status.ToString()); } /* SkillImporter Importer = WGAPI.GetCommanderSkills(); * if (Importer.Status.ToLower().Equals("ok")) * { * Program.CommanderSkills = new List<Skill>(); * foreach (KeyValuePair<string, Skill> SkillData in Importer.Data) * { * Program.CommanderSkills.Add(SkillData.Value); * } * BinarySerialize.WriteToBinaryFile(Commons.GetCommanderSkillFileName(), Program.CommanderSkills); * }*/ }
public static SkillImporter GetCommanderSkills() { using (WebClient wc = new WebClient()) { string jsonFile = Commons.GetCurrentDirectory() + "/skills.json"; wc.DownloadFile("https://onedrive.live.com/download?cid=919CD8D21AC2180D&resid=919CD8D21AC2180D%2117153&authkey=AHbaH3E2Ks9MGjM", jsonFile); string jsonText = File.ReadAllText(jsonFile); SkillImporter Import = JsonConvert.DeserializeObject <SkillImporter>(jsonText); return(Import); } /* try { Setup(); } catch (Exception) { } * string path = $"encyclopedia/crewskills/?application_id={APP_ID}"; * string responseString = ""; * var response = Client.GetAsync(path).Result; * if (response.IsSuccessStatusCode) * { * var responseContent = response.Content; * responseString = responseContent.ReadAsStringAsync().Result; * } * SkillImporter Importer = JsonConvert.DeserializeObject<SkillImporter>(responseString); * return Importer;*/ }