public void Apply(CSCommand c) { foreach (var pp in Params) { foreach (var p in c.Params) { if (pp.Name == p.Name) { pp.Apply(p); } } } }
public CSSpec(Spec spec, Patch patch) { Structs = new List <CSStruct>(); Enums = new List <CSEnum>(); Commands = new List <CSCommand>(); EnumMap = new Dictionary <string, CSEnum>(); FlagsMap = new Dictionary <string, string>(); foreach (var s in spec.Structs) { if (spec.ExtensionTypes.Contains(s.Name) && !spec.IncludedTypes.Contains(s.Name)) { continue; } var css = new CSStruct(s); Structs.Add(css); } foreach (var e in spec.Enums) { if (spec.ExtensionTypes.Contains(e.Name) && !spec.IncludedTypes.Contains(e.Name)) { continue; } var cse = new CSEnum(e); if (cse.Name.Contains("Flags")) { cse.Values.Add(new CSEnumValue(cse.Name, "None", "0")); } Enums.Add(cse); EnumMap.Add(cse.Name, cse); } foreach (var c in spec.Commands) { if (!spec.IncludedCommands.Contains(c.Name)) { continue; } var csc = new CSCommand(spec, c); Commands.Add(csc); } foreach (var s in Structs) { foreach (var ps in patch.Structs) { if (ps.Name == s.Name) { ps.Apply(s); } } } foreach (var c in Commands) { foreach (var pc in patch.Commands) { if (pc.Name == c.Name) { pc.Apply(c); } } } FixEnums(); }