/// <summary> /// Fill object data from xml node /// </summary> /// <param name="source"></param> protected override void LoadFromXmlNode(XmlNode source) { this.Id = GetAttribute(source, "id"); this.DisplayName = GetAttribute(source, "displayname", null); this.TypeString = GetAttribute(source, "type"); this.Documentation = GetAttribute(source, "documentation", null); this.Keywords = GetListAttribute(source, "keywords"); this.Visuals = CreateFromXml <AdvanceBlockVisuals>(source); this.Value = GetChildNode(source, "*"); }
/// <summary> /// Fill object data from xml node /// </summary> /// <param name="source"></param> protected override void LoadFromXmlNode(XmlNode source) { this.Id = GetAttribute(source, "id"); this.Type = GetAttribute(source, "type"); this.Documentation = GetAttribute(source, "documentation", null); this.Keywords = GetListAttribute(source, "keywords"); this.Visuals = CreateFromXml <AdvanceBlockVisuals>(source); foreach (XmlNode node in GetChildren(source, "vararg")) { this.Varargs.Add(GetAttribute(node, "name"), GetIntAttribute(node, "count", 0)); } }
/// <summary> /// Fill object data from xml node /// </summary> /// <param name="source">Source Xml</param> protected override void LoadFromXmlNode(XmlNode source) { this.Id = GetAttribute(source, "id"); this.Documentation = GetAttribute(source, "documentation", null); this.Keywords = GetListAttribute(source, "keywords"); this.Visuals = CreateFromXml <AdvanceBlockVisuals>(source); HashSet <string> usedIds = new HashSet <string>(); foreach (XmlNode n in GetChildren(source, "*")) { switch (n.Name) { case "block": AdvanceBlockReference b = CreateFromXml <AdvanceBlockReference>(n); b.parent = this; if (usedIds.Contains(b.Id)) { this.ThrowDuplicatedIdentifierException(n, b.Id); } else { this.Blocks.Add(b.Id, b); usedIds.Add(b.Id); } break; case "composite-block": AdvanceCompositeBlock cb = CreateFromXml <AdvanceCompositeBlock>(n); cb.Parent = this; if (usedIds.Contains(cb.Id)) { this.ThrowDuplicatedIdentifierException(n, cb.Id); } else { this.Composites.Add(cb.Id, cb); usedIds.Add(cb.Id); } break; case "constant": AdvanceConstantBlock c = CreateFromXml <AdvanceConstantBlock>(n); if (usedIds.Contains(c.Id)) { this.ThrowDuplicatedIdentifierException(n, c.Id); } else { this.Constants.Add(c.Id, c); usedIds.Add(c.Id); } break; case "bind": AdvanceBlockBind bb = CreateFromXml <AdvanceBlockBind>(n); bb.Parent = this; this.Bindings.Add(bb); break; case "type-variable": AdvanceTypeVariable tv = CreateFromXml <AdvanceTypeVariable>(n); if (!this.AddTypeVariable(tv)) { this.ThrowDuplicatedIdentifierException(n, tv.Name); } break; case "input": AdvanceCompositeBlockParameterDescription inp = CreateFromXml <AdvanceCompositeBlockParameterDescription>(n); if (!this.AddInput(inp)) { this.ThrowDuplicatedIdentifierException(n, inp.Id); } break; case "output": AdvanceCompositeBlockParameterDescription outp = CreateFromXml <AdvanceCompositeBlockParameterDescription>(n); if (!this.AddOutput(outp)) { this.ThrowDuplicatedIdentifierException(n, outp.Id); } break; } } this.LinkTypeVariables(); }