public static ActionGroup BuildActionGroup(XmlNode node) { var name = node.Attributes["name"].Value; var description = node.Attributes["decription"]?.Value; var path = GeneratePath("library", "action_group", node.Attributes["src"].Value); var srcCode = ToCSCode(path); ActionGroup group = new ActionGroup(name, description); group.Script = CSharpScript.Create(srcCode, ScriptOptions.Default.WithReferences(typeof(Superpower).Assembly), typeof(Global)); foreach (XmlNode cmdComplex in node.ChildNodes) { switch (cmdComplex.Name) { case "ActionGroup": group.AddSubGroup(BuildActionGroup(cmdComplex)); break; case "Execution": group.AddAction(BuildExecution(cmdComplex, group)); break; case "Field": group.AddAction(BuildField(cmdComplex, group)); break; default: throw new InvalidOperationException($"\"{cmdComplex.Name}\" is bot a valid xml name"); } } return(group); }