diff --git a/StatisticsAnalysisTool/StatisticsAnalysisTool/MainWindow.xaml b/StatisticsAnalysisTool/StatisticsAnalysisTool/MainWindow.xaml
index 64db0f9ec..06723b531 100644
--- a/StatisticsAnalysisTool/StatisticsAnalysisTool/MainWindow.xaml
+++ b/StatisticsAnalysisTool/StatisticsAnalysisTool/MainWindow.xaml
@@ -23,7 +23,7 @@
-
+
@@ -68,7 +68,7 @@
()
-
+
diff --git a/StatisticsAnalysisTool/StatisticsAnalysisTool/Models/ItemWithMarketInformation.cs b/StatisticsAnalysisTool/StatisticsAnalysisTool/Models/ItemWithMarketInformation.cs
deleted file mode 100644
index dfedc6ab9..000000000
--- a/StatisticsAnalysisTool/StatisticsAnalysisTool/Models/ItemWithMarketInformation.cs
+++ /dev/null
@@ -1,32 +0,0 @@
-using StatisticsAnalysisTool.Common;
-using System.Windows.Media.Imaging;
-
-namespace StatisticsAnalysisTool.Models
-{
- public class ItemWithMarketInformation
- {
- private readonly Item _item;
-
- public ItemWithMarketInformation(Item item)
- {
- _item = item;
- }
-
- public string LocalizationNameVariable => _item.LocalizationNameVariable;
- public string LocalizationDescriptionVariable => _item.LocalizationDescriptionVariable;
- public Item.LocalizedNamesStruct? LocalizedNames => _item.LocalizedNames;
- public int Index => _item.Index;
- public string UniqueName => _item.UniqueName;
- public string LocalizedName(string language = null) => _item.LocalizedName(language);
- public string LocalizedNameAndEnglish => _item.LocalizedNameAndEnglish;
- public BitmapImage Icon => _item.Icon;
-
- public decimal PriceAvgCaerleon => ApiController.GetMarketStatAvgPriceFromJsonAsync(_item.UniqueName, Location.Caerleon).Result;
- public decimal PriceAvgBridgewatch => ApiController.GetMarketStatAvgPriceFromJsonAsync(_item.UniqueName, Location.Bridgewatch).Result;
- public decimal PriceAvgFortSterling => ApiController.GetMarketStatAvgPriceFromJsonAsync(_item.UniqueName, Location.FortSterling).Result;
- public decimal PriceAvgLymhurst => ApiController.GetMarketStatAvgPriceFromJsonAsync(_item.UniqueName, Location.Lymhurst).Result;
- public decimal PriceAvgMartlock => ApiController.GetMarketStatAvgPriceFromJsonAsync(_item.UniqueName, Location.Martlock).Result;
- public decimal PriceAvgThetford => ApiController.GetMarketStatAvgPriceFromJsonAsync(_item.UniqueName, Location.Thetford).Result;
-
- }
-}
diff --git a/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisManager.cs b/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisManager.cs
index 95b85e5cf..f5c25de61 100644
--- a/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisManager.cs
+++ b/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisManager.cs
@@ -1,145 +1,144 @@
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using StatisticsAnalysisTool.Common;
-using StatisticsAnalysisTool.Models;
-using StatisticsAnalysisTool.Properties;
-using System;
-using System.Collections.Generic;
-using System.Diagnostics;
-using System.IO;
-using System.Linq;
-using System.Text;
-using System.Threading.Tasks;
-using System.Windows;
-
-namespace StatisticsAnalysisTool
-{
- public class StatisticsAnalysisManager
- {
- // Info Link -> https://github.com/broderickhyman/ao-bin-dumps
- // Models: https://github.com/broderickhyman/albiondata-models-dotNet
-
- public static List- Items;
-
- private static bool GetItemListSourceUrlIfExist(ref string url)
- {
- if (string.IsNullOrEmpty(Settings.Default.CurrentItemListSourceUrl))
- {
- url = Settings.Default.DefaultItemListSourceUrl;
- if (string.IsNullOrEmpty(url))
- return false;
-
- Settings.Default.CurrentItemListSourceUrl = Settings.Default.DefaultItemListSourceUrl;
- MessageBox.Show(LanguageController.Translation("DEFAULT_ITEMLIST_HAS_BEEN_LOADED"), LanguageController.Translation("NOTE"));
- }
- return true;
- }
-
- private static async Task
> TryToGetItemListFromWeb(string url)
- {
- using (var wd = new WebDownload(30000))
- {
- try
- {
- var itemsString = await wd.DownloadStringTaskAsync(url);
- File.WriteAllText($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}", itemsString, Encoding.UTF8);
- return JsonConvert.DeserializeObject>(itemsString);
- }
- catch (Exception)
- {
- try
- {
- var itemsString = await wd.DownloadStringTaskAsync(Settings.Default.DefaultItemListSourceUrl);
- File.WriteAllText($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}", itemsString, Encoding.UTF8);
- return JsonConvert.DeserializeObject>(itemsString);
- }
- catch
- {
- return null;
- }
- }
- }
- }
-
- private static List- GetItemListFromLocal()
- {
- try
- {
- var localItemString = File.ReadAllText($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}");
- return JsonConvert.DeserializeObject
>(localItemString);
- }
- catch
- {
- return null;
- }
- }
-
- public static async Task GetItemListFromJsonAsync()
- {
- var url = Settings.Default.CurrentItemListSourceUrl;
- if (!GetItemListSourceUrlIfExist(ref url))
- return false;
-
- if (File.Exists($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}"))
- {
- var fileDateTime = File.GetLastWriteTime($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}");
-
- if (fileDateTime.AddDays(7) < DateTime.Now)
- {
- Items = await TryToGetItemListFromWeb(url);
- return (Items != null);
- }
-
- Items = GetItemListFromLocal();
- return (Items != null);
- }
-
- Items = await TryToGetItemListFromWeb(url);
- return (Items != null);
- }
-
- public static async Task> FindItemsAsync(string searchText)
- {
- return await Task.Run(() =>
- {
- try
- {
- return Items?.FindAll(s => (s.LocalizedName().ToLower().Contains(searchText.ToLower())));
- }
- catch (Exception ex)
- {
- Debug.Print(ex.Message);
- return null;
- }
- });
- }
-
- public static FrequentlyValues.ItemTier GetItemTier(string uniqueName) => FrequentlyValues.ItemTiers.FirstOrDefault(x => x.Value == uniqueName.Split('_')[0]).Key;
-
- public static FrequentlyValues.ItemLevel GetItemLevel(string uniqueName)
- {
- if (!uniqueName.Contains("@"))
- return FrequentlyValues.ItemLevel.Level0;
-
- if(int.TryParse(uniqueName.Split('@')[1], out int number))
- return FrequentlyValues.ItemLevels.First(x => x.Value == number).Key;
- return FrequentlyValues.ItemLevel.Level0;
- }
-
- public static int GetQuality(FrequentlyValues.ItemQuality value) => FrequentlyValues.ItemQualities.FirstOrDefault(x => x.Key == value).Value;
-
- public static FrequentlyValues.ItemQuality GetQuality(int value) => FrequentlyValues.ItemQualities.FirstOrDefault(x => x.Value == value).Key;
-
- public static void AddLocalizedName(ref ItemData itemData, JObject parsedObject)
+using Newtonsoft.Json;
+using Newtonsoft.Json.Linq;
+using StatisticsAnalysisTool.Common;
+using StatisticsAnalysisTool.Models;
+using StatisticsAnalysisTool.Properties;
+using System;
+using System.Collections.Generic;
+using System.Diagnostics;
+using System.IO;
+using System.Linq;
+using System.Text;
+using System.Threading.Tasks;
+using System.Windows;
+
+namespace StatisticsAnalysisTool
+{
+ public class StatisticsAnalysisManager
+ {
+ // Info Link -> https://github.com/broderickhyman/ao-bin-dumps
+ // Models: https://github.com/broderickhyman/albiondata-models-dotNet
+
+ public static List- Items;
+
+ private static bool GetItemListSourceUrlIfExist(ref string url)
{
- foreach (var language in Enum.GetValues(typeof(FrequentlyValues.GameLanguage)).Cast())
- {
- var cultureCode = FrequentlyValues.GameLanguages.FirstOrDefault(x => x.Key == language).Value;
-
- if (parsedObject["localizedNames"]?[cultureCode] != null)
- itemData.LocalizedNames.Add(new ItemData.KeyValueStruct() { Key = cultureCode, Value = parsedObject["localizedNames"][cultureCode].ToString() });
- }
- }
-
- }
-}
\ No newline at end of file
+ if (string.IsNullOrEmpty(Settings.Default.CurrentItemListSourceUrl))
+ {
+ url = Settings.Default.DefaultItemListSourceUrl;
+ if (string.IsNullOrEmpty(url))
+ return false;
+
+ Settings.Default.CurrentItemListSourceUrl = Settings.Default.DefaultItemListSourceUrl;
+ MessageBox.Show(LanguageController.Translation("DEFAULT_ITEMLIST_HAS_BEEN_LOADED"), LanguageController.Translation("NOTE"));
+ }
+ return true;
+ }
+
+ private static async Task
> TryToGetItemListFromWeb(string url)
+ {
+ using (var wd = new WebDownload(30000))
+ {
+ try
+ {
+ var itemsString = await wd.DownloadStringTaskAsync(url);
+ File.WriteAllText($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}", itemsString, Encoding.UTF8);
+ return JsonConvert.DeserializeObject>(itemsString);
+ }
+ catch (Exception)
+ {
+ try
+ {
+ var itemsString = await wd.DownloadStringTaskAsync(Settings.Default.DefaultItemListSourceUrl);
+ File.WriteAllText($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}", itemsString, Encoding.UTF8);
+ return JsonConvert.DeserializeObject>(itemsString);
+ }
+ catch
+ {
+ return null;
+ }
+ }
+ }
+ }
+
+ private static List- GetItemListFromLocal()
+ {
+ try
+ {
+ var localItemString = File.ReadAllText($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}");
+ return JsonConvert.DeserializeObject
>(localItemString);
+ }
+ catch
+ {
+ return null;
+ }
+ }
+
+ public static async Task GetItemListFromJsonAsync()
+ {
+ var url = Settings.Default.CurrentItemListSourceUrl;
+ if (!GetItemListSourceUrlIfExist(ref url))
+ return false;
+
+ if (File.Exists($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}"))
+ {
+ var fileDateTime = File.GetLastWriteTime($"{AppDomain.CurrentDomain.BaseDirectory}{Settings.Default.ItemListFileName}");
+
+ if (fileDateTime.AddDays(7) < DateTime.Now)
+ {
+ Items = await TryToGetItemListFromWeb(url);
+ return (Items != null);
+ }
+
+ Items = GetItemListFromLocal();
+ return (Items != null);
+ }
+
+ Items = await TryToGetItemListFromWeb(url);
+ return (Items != null);
+ }
+
+ public static async Task> FindItemsAsync(string searchText)
+ {
+ return await Task.Run(() =>
+ {
+ try
+ {
+ return Items?.FindAll(s => (s.LocalizedNameAndEnglish.ToLower().Contains(searchText.ToLower())));
+ }
+ catch (Exception ex)
+ {
+ Debug.Print(ex.Message);
+ return null;
+ }
+ });
+ }
+
+ public static FrequentlyValues.ItemTier GetItemTier(string uniqueName) => FrequentlyValues.ItemTiers.FirstOrDefault(x => x.Value == uniqueName.Split('_')[0]).Key;
+
+ public static FrequentlyValues.ItemLevel GetItemLevel(string uniqueName)
+ {
+ if (!uniqueName.Contains("@"))
+ return FrequentlyValues.ItemLevel.Level0;
+
+ if(int.TryParse(uniqueName.Split('@')[1], out int number))
+ return FrequentlyValues.ItemLevels.First(x => x.Value == number).Key;
+ return FrequentlyValues.ItemLevel.Level0;
+ }
+
+ public static int GetQuality(FrequentlyValues.ItemQuality value) => FrequentlyValues.ItemQualities.FirstOrDefault(x => x.Key == value).Value;
+
+ public static FrequentlyValues.ItemQuality GetQuality(int value) => FrequentlyValues.ItemQualities.FirstOrDefault(x => x.Value == value).Key;
+
+ public static void AddLocalizedName(ref ItemData itemData, JObject parsedObject)
+ {
+ foreach (var language in Enum.GetValues(typeof(FrequentlyValues.GameLanguage)).Cast())
+ {
+ var cultureCode = FrequentlyValues.GameLanguages.FirstOrDefault(x => x.Key == language).Value;
+
+ if (parsedObject["localizedNames"]?[cultureCode] != null)
+ itemData.LocalizedNames.Add(new ItemData.KeyValueStruct() { Key = cultureCode, Value = parsedObject["localizedNames"][cultureCode].ToString() });
+ }
+ }
+ }
+}
diff --git a/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisTool.csproj b/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisTool.csproj
index d2e8a146c..b09849de3 100644
--- a/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisTool.csproj
+++ b/StatisticsAnalysisTool/StatisticsAnalysisTool/StatisticsAnalysisTool.csproj
@@ -100,7 +100,6 @@
-