} // Checks to add to every Filter in a category with the template tag public CategoryNode(ConfigNode node, LoadAndProcess data) { CategoryName = Localizer.Format(node.GetValue("name").Trim()); IconName = node.GetValue("icon"); if (string.IsNullOrEmpty(IconName)) { IconName = CategoryName; } Colour = GUIUtils.ConvertToColor(node.GetValue("colour")); ConfigNode[] filtNodes = node.GetNodes("FILTER"); if (filtNodes != null) { Templates = new List <FilterNode>(); foreach (ConfigNode n in filtNodes) { Templates.Add(new FilterNode(n)); } } if (bool.TryParse(node.GetValue("all"), out bool tmpBool)) { All = tmpBool; } SubCategories = LoadSubcategoryItems(node.GetNodes("SUBCATEGORIES")); string tmpStr = string.Empty; if (node.TryGetValue("type", ref tmpStr)) { try { Type = (CategoryType)Enum.Parse(typeof(CategoryType), tmpStr.ToUpperInvariant()); } catch {} // leave as default } if (node.TryGetValue("value", ref tmpStr)) { tmpStr = Localizer.Format(tmpStr); if (string.Equals(tmpStr, "replace", StringComparison.OrdinalIgnoreCase)) { Behaviour = CategoryBehaviour.Replace; } else if (string.Equals(tmpStr, "engine", StringComparison.OrdinalIgnoreCase)) { Behaviour = CategoryBehaviour.Engines; foreach (List <string> combo in data.propellantCombos) { string dummy = string.Empty, subcatName = string.Join(",", combo.ToArray()); data.SetName(ref subcatName); SubCategories.AddUnique(new SubCategoryItem(subcatName)); } } } }