void ProcessInventory(IAsyncResult res) { var webRequest = res.AsyncState as HttpWebRequest; string status; try { using (var response = webRequest.EndGetResponse(res)) using (Stream stream = response.GetResponseStream()) status = stream.ReadAll(); } catch (WebException ex) { Console.WriteLine("Web Exception: " + ex); return; } var data = new JsonReader().Read(status) as IDictionary<string, object>; var success = data["success"] as bool?; if (success.HasValue && success.Value == false) return; Inventory = new Inventory(); Inventory.TryParse(data); var @event = new TradeEvent(); @event.type = ETradeEventType.InventoryLoaded; Events.Enqueue(@event); }
void ProcessForeignInventory(IAsyncResult res) { var webRequest = res.AsyncState as HttpWebRequest; string status; try { using (var response = webRequest.EndGetResponse(res)) using (Stream stream = response.GetResponseStream()) status = stream.ReadAll(); } catch (WebException ex) { Console.WriteLine("Web Exception: " + ex); return; } var data = new JsonReader().Read(status) as IDictionary<string, object>; var success = data["success"] as bool?; if (success.HasValue && success.Value == false) { var error = data["error"] as string; if (error != null) Console.WriteLine("Could not get foreign inventory: " + error); return; } ForeignInventory = new Inventory(); ForeignInventory.TryParse(data); var evt = new TradeEvent(); evt.type = ETradeEventType.ForeignInventoryLoaded; Events.Enqueue(evt); }
public override void OnUserRemoveItem(ItemInfo schemaItem, Inventory.Item invItem) { }