Esempio n. 1
0
        public void LoadFromXML(XmlNode resourceNode)
        {
            XMLResourceTypeFactory.LoadFromXML(resourceNode, this);

            /// if the display color is specified, then load it,
            /// otherwise use a random color
            if (resourceNode.Attributes["display_color"] != null)
            {
                this._displayColor = System.Drawing.Color.FromName(resourceNode.Attributes["display_color"].Value);
            }
            else
            {
                Random random = Controller.Random;
                this._displayColor = System.Drawing.Color.FromArgb(random.Next(256), random.Next(256), random.Next(256), random.Next(256));
            }

            XMLResourceTypeFactory.CreateResourceTypeFields(this.SubTypes, resourceNode);
            foreach (System.Xml.XmlNode node in resourceNode.ChildNodes)
            {
                switch (node.Name)
                {
                case "execute":
                    Scripts.Script executionType = XMLScriptFactory.CreateScript(node);
                    this.Executions.Add(executionType.Name, executionType);
                    break;

                default:
                    continue;
                }
            }
        }
Esempio n. 2
0
 public void LoadFromXML(System.Xml.XmlNode node)
 {
     System.Diagnostics.Debug.Assert(node.Name.Equals(Typename));
     XMLResourceTypeFactory.LoadFromXML(node, this);
     XMLResourceTypeFactory.CreateResourceTypeFields(this.SubTypes, node);
 }