public List<Tuple<ItemInfo, PaintInfo>> GetOfficialItems() { List<Tuple<ItemInfo, PaintInfo>> officialItems = new List<Tuple<ItemInfo, PaintInfo>>(); KeyValue result = this.Read("alternate_icons2"); List<PaintInfo> paintInfos = this.GetAllPaintKits(); List<ItemInfo> itemInfos = this.GetAllItemInfo(); ItemInfo item = new ItemInfo(); PaintInfo paint = new PaintInfo(); string econPath; List<string> econPathList = new List<string>(); if (result != null) { foreach (var subChildKey in result.Children[0].Children) { econPath = subChildKey.Children[0].Value; econPathList.Add(econPath); } } string[] splittedEconPath; string[] removeList = new string[] { "_medium", "_heavy" }; string itemPaint; foreach (var strRemove in removeList) { econPathList.RemoveAll(p => p.Contains(strRemove)); } foreach (var str in econPathList) { splittedEconPath = str.Split('/'); if (splittedEconPath[2].Contains("_light")) { itemPaint = splittedEconPath[2].Replace("_light", string.Empty); foreach (var paintInfo in paintInfos) { if (itemPaint.Contains(paintInfo.Name)) { paint = paintInfo; itemPaint = itemPaint.Replace("_" + paintInfo.Name, string.Empty); break; } } foreach (var itemInfo in itemInfos) { if (itemPaint.Equals(itemInfo.CodedName)) { item = itemInfo; break; } } } if ((string.IsNullOrEmpty(item.CodedName) == false) && (string.IsNullOrEmpty(paint.Name) == false)) { officialItems.Add(new Tuple<ItemInfo, PaintInfo>(item, paint)); } } return officialItems; }
public List<ItemInfo> GetAllItemInfo() { KeyValue result = this.Read(ItemInfo.KeyName); List<ItemInfo> returnValue = new List<ItemInfo>(); ItemInfo def; if (result != null) { foreach (var subChildKey in result.Children) { def = new ItemInfo(); //skip the first "default" subkey if (subChildKey.Name.Equals("default", StringComparison.CurrentCultureIgnoreCase)) { continue; } else def.CodedValue = int.Parse(subChildKey.Name); foreach (var itemSubChildKey in subChildKey.Children) { if (itemSubChildKey.Name.Equals(ItemInfo.SubKeyName, StringComparison.CurrentCultureIgnoreCase)) { def.CodedName = itemSubChildKey.Value; } else if (itemSubChildKey.Name.Equals(ItemInfo.SubKeyDesc, StringComparison.CurrentCultureIgnoreCase)) { def.Description = itemSubChildKey.Value; } else if (itemSubChildKey.Name.Equals(ItemInfo.SubKeyPrefab, StringComparison.CurrentCultureIgnoreCase)) { if (itemSubChildKey.Value.Contains("weapon_")) { def.IsWeapon = true; } } } returnValue.Add(def); } } return returnValue; }