public void LoadNestedHairItems(GearInfo[] objectsToLoad = null) { NestedOfficialItems.Clear(); var gearToLoad = (GearInfo[])objectsToLoad; if (gearToLoad == null) { return; } foreach (var gear in gearToLoad) { CustomFolderInfo parent = null; var nameSplit = gear.name.Split(' '); if (string.IsNullOrEmpty(nameSplit.FirstOrDefault())) { continue; } var hairStyle = nameSplit.FirstOrDefault(); if (hairStyle.ToLower() == "long" || hairStyle.ToLower() == "short" || hairStyle.ToLower() == "curly") { hairStyle = $"{hairStyle} {nameSplit[1]}"; } AddFolder <CustomGearFolderInfo>(hairStyle, null, NestedOfficialItems, ref parent); AddItem(gear, parent.Children, ref parent); } NestedOfficialItems = SortList(NestedOfficialItems); }
public void LoadNestedOfficialItems(GearInfo[] gearToLoad = null) { NestedOfficialItems.Clear(); if (gearToLoad == null) { return; } List <string> unbrandedItems = new List <string> { #region Decks "Tie Dye Light", "Skater XL Obstacles Deck", #endregion #region Grip "Black", "Camo Grey", "Easy Day Logo", #endregion #region Trucks "Black", "Silver", "White", #endregion #region Wheels "Purple", "Red/Blue Swirl", "White", #endregion }; CustomFolderInfo parent = null; var easyDayItemsExist = gearToLoad.Any(x => x.name.StartsWith("Blank") || x.name.StartsWith("Unbranded") || x.name.StartsWith("Denim") || unbrandedItems.Contains(x.name)); if (easyDayItemsExist) { AddFolder <CustomGearFolderInfo>("Easy Day", null, NestedOfficialItems, ref parent); } parent = null; var easyDayFolder = NestedOfficialItems.FirstOrDefault(x => x.GetName() == "\\Easy Day" && x.GetPath() == null) as CustomFolderInfo; foreach (var gear in gearToLoad) { parent = null; if (gear.name.StartsWith("Blank") || gear.name.StartsWith("Unbranded") || gear.name.StartsWith("Denim") || unbrandedItems.Contains(gear.name)) { AddItem(gear, easyDayFolder.Children, ref easyDayFolder); } else { var nameSplit = gear.name.Split(' '); if (string.IsNullOrEmpty(nameSplit.FirstOrDefault())) { continue; } var brand = nameSplit.FirstOrDefault(); if (brand == "Old" || brand == "New" || brand == "Santa" || brand == "Grimple") { brand = $"{nameSplit[0]} {nameSplit[1]}"; } else if (brand == "The") { brand = $"{nameSplit[0]} {nameSplit[1]} {nameSplit[2]}"; } else if (brand == "TWS") { brand = "Transworld"; } AddFolder <CustomGearFolderInfo>(brand, null, NestedOfficialItems, ref parent); AddItem(gear, parent.Children, ref parent); } } NestedOfficialItems = SortList(NestedOfficialItems); }