sort schema elements and types

This commit is contained in:
bluepilledgreat 2024-10-20 15:54:07 +01:00
parent 70b7a65080
commit 2d37db126f

View File

@ -41,12 +41,12 @@ namespace Bloxstrap.UI.Elements.Editor
/// <summary> /// <summary>
/// Elements and their attributes /// Elements and their attributes
/// </summary> /// </summary>
public static Dictionary<string, Dictionary<string, string>> ElementInfo { get; set; } = new(); public static SortedDictionary<string, SortedDictionary<string, string>> ElementInfo { get; set; } = new();
/// <summary> /// <summary>
/// All type info /// All type info
/// </summary> /// </summary>
public static Dictionary<string, Type> Types { get; set; } = new(); public static SortedDictionary<string, Type> Types { get; set; } = new();
public static void ParseSchema() public static void ParseSchema()
{ {
@ -57,16 +57,18 @@ namespace Bloxstrap.UI.Elements.Editor
if (_schema == null) if (_schema == null)
throw new Exception("Deserialised CustomBootstrapperSchema is null"); throw new Exception("Deserialised CustomBootstrapperSchema is null");
Types = _schema.Types; foreach (var type in _schema.Types)
Types.Add(type.Key, type.Value);
PopulateElementInfo(); PopulateElementInfo();
} }
private static Dictionary<string, string> GetElementAttributes(string name, Element element) private static SortedDictionary<string, string> GetElementAttributes(string name, Element element)
{ {
if (ElementInfo.ContainsKey(name)) if (ElementInfo.ContainsKey(name))
return ElementInfo[name]; return ElementInfo[name];
Dictionary<string, string> attributes = new(); SortedDictionary<string, string> attributes = new();
foreach (var attribute in element.Attributes) foreach (var attribute in element.Attributes)
attributes.Add(attribute.Key, attribute.Value); attributes.Add(attribute.Key, attribute.Value);