/// <summary> /// This function allows you to recursively build the items list. /// This is needed because the items can be infinitely nested in the killmail /// </summary> /// <param name="ItemNode">The XmlNode containing the item row you want to parse</param> /// <returns>The item with it's child items in it's ContainedItems array</returns> private static KillLog.Item ParseItemRow(XmlNode ItemNode) { KillLog.Item tmpItem = new KillLog.Item(); tmpItem.TypeId = Convert.ToInt32(ItemNode.Attributes["typeID"].InnerText); tmpItem.QtyDropped = Convert.ToInt32(ItemNode.Attributes["qtyDropped"].InnerText); tmpItem.QtyDestroyed = Convert.ToInt32(ItemNode.Attributes["qtyDestroyed"].InnerText); int flagValue = Convert.ToInt32(ItemNode.Attributes["flag"].InnerText); if (Enum.IsDefined(typeof(InventoryFlagType), flagValue)) { tmpItem.Flag = (InventoryFlagType)Enum.ToObject(typeof(InventoryFlagType), flagValue); } else { tmpItem.Flag = InventoryFlagType.FlagUnknown; } //Parse this Items contained items and add it to it's list if (ItemNode.HasChildNodes) { List <KillLog.Item> itemList = new List <KillLog.Item>(); foreach (XmlNode item in ItemNode.SelectNodes("./rowset[@name='items']/row")) { itemList.Add(ParseItemRow(item)); } tmpItem.ContainedItems = itemList.ToArray(); } return(tmpItem); }
private bool CompareItems(KillLog.Item item1, KillLog.Item item2) { if (item1.TypeId != item2.TypeId) { return(false); } for (int i = 0; i < item1.ContainedItems.Length; i++) { if (CompareItems(item1.ContainedItems[i], item2.ContainedItems[i]) == false) { return(false); } } return(true); }