public Stash GetStash(int index, string league, bool forceRefresh) { DataContractJsonSerializer serialiser = new DataContractJsonSerializer(typeof(JSONProxy.Stash)); JSONProxy.Stash proxy = null; onStashLoaded(POEEventState.BeforeEvent, index, -1); using (Stream stream = transport.GetStash(index, league, forceRefresh)) { try { proxy = (JSONProxy.Stash)serialiser.ReadObject(stream); if (proxy == null) { logNullStash(stream, "Proxy was null"); } } catch (Exception ex) { Logger.Log(ex); logNullStash(stream, "JSON Serialization Failed"); } } onStashLoaded(POEEventState.AfterEvent, index, proxy.NumTabs); return(new Stash(proxy)); }
public Stash GetStash(int index, string league, string accountName, string realm, bool forceRefresh = false) { JSONProxy.Stash proxy = null; onStashLoaded(POEEventState.BeforeEvent, index, -1); using (var stream = Transport.GetStash(index, league, accountName, realm, forceRefresh)) { try { if (stream == Stream.Null) { return(new Stash(null)); } proxy = GetProperObjectFromTransport <JSONProxy.Stash>(stream); if (proxy == null) { LogNullStash(stream, "Proxy was null"); } } catch (Exception ex) { Logger.Log(ex); LogNullStash(stream, "JSON Serialization Failed"); } } onStashLoaded(POEEventState.AfterEvent, index, proxy.NumTabs); return(new Stash(proxy)); }
internal Stash(JSONProxy.Stash proxy) { if (proxy.Items == null) { items = new List <Item>(); NumberOfTabs = 0; return; } items = proxy.Items.Select(item => ItemFactory.Get(item)).ToList(); this.NumberOfTabs = proxy.NumTabs; this.Tabs = ProxyMapper.GetTabs(proxy.Tabs); }
internal Stash(JSONProxy.Stash proxy) { if (proxy.Items == null) { items = new List <Item>(); NumberOfTabs = 0; return; } items = proxy.Items.Select(item => ItemFactory.Get(item)).ToList(); this.NumberOfTabs = proxy.NumTabs; this.Tabs = ProxyMapper.GetTabs(proxy.Tabs); tabNameByTabId = Tabs.Where(t => t.IsFakeTab == false).ToDictionary(t => t.i, t => t.Name); }