diff --git a/POEApi.Model/Item.cs b/POEApi.Model/Item.cs index 4cfa3dd7..b37439aa 100644 --- a/POEApi.Model/Item.cs +++ b/POEApi.Model/Item.cs @@ -59,7 +59,7 @@ protected Item(JSONProxy.Item item) this.H = item.H; this.IconURL = getIconUrl(item.Icon); this.League = item.League; - this.Name = filterName(item.Name); + this.Name = item.Name; this.TypeLine = item.TypeLine; this.DescrText = item.DescrText; this.X = item.X; @@ -90,16 +90,6 @@ protected Item(JSONProxy.Item item) this.Character = string.Empty; } - private string filterName(string jsonName) - { - var items = jsonName.Split(new string[] { ">>" }, StringSplitOptions.None); - - if (items.Count() == 1) - return jsonName; - - return items[3]; - } - private string getIconUrl(string url) { Uri uri; diff --git a/POEApi.Model/ItemFactory.cs b/POEApi.Model/ItemFactory.cs index 73c9621e..6b910085 100644 --- a/POEApi.Model/ItemFactory.cs +++ b/POEApi.Model/ItemFactory.cs @@ -1,5 +1,6 @@ using POEApi.Infrastructure; using System; +using System.Linq; namespace POEApi.Model { @@ -9,6 +10,9 @@ public static Item Get(JSONProxy.Item item) { try { + item.Name = filterString(item.Name); + item.TypeLine = filterString(item.TypeLine); + if (item.frameType == 4) return new Gem(item); @@ -31,5 +35,16 @@ public static Item Get(JSONProxy.Item item) throw new Exception(errorMessage); } } + + + private static string filterString(string json) + { + var items = json.Split(new string[] { ">>" }, StringSplitOptions.None); + + if (items.Count() == 1) + return json; + + return items[3]; + } } -} +} \ No newline at end of file