public void Load(string league) { // Load CSV Data if (Conversions.Count == 0) { Conversions = Util.ConvertCsv <ConversionCsv>(Util.ReadFile("poe_conversions.csv")); } if (CurrencyCsv.Count == 0) { CurrencyCsv = Util.ConvertCsv <CurrencyCsv>(Util.ReadFile("poe_currency.csv")); } if (EnchantsCsv.Count == 0) { EnchantsCsv = Util.ConvertCsv <EnchantCsv>(Util.ReadFile("poe_enchants.csv")); } if (Prices.Count == 0) { Prices = Util.ConvertCsv <PriceCsv>(Util.ReadFile("poe_prices.csv")); } if (UniquesCsv.Count == 0) { UniquesCsv = Util.ConvertCsv <UniqueCsv>(Util.ReadFile("poe_uniques.csv")); } // Load JSON Data if (Softcore.Count == 0) { Softcore = PoeNinja.GetData(false, league); } if (Hardcore.Count == 0) { Hardcore = PoeNinja.GetData(true, league); } }
/// <summary> /// Loads data from POE Ninja synchronously. /// </summary> public static List <ItemData> GetData(bool hardcore, string league) { PoeNinja poeNinja = new PoeNinja(); Exception ex = Task.Run(async() => await poeNinja.LoadAsync(hardcore, league)).Result; if (ex != null) { throw ex; } return(poeNinja.data); }