Example #1
0
        /// <summary>
        /// Sets properties and attributes of class in accordance with Binary definition.
        /// </summary>
        /// <param name="Definition">Binary definition</param>
        public override async Task FromXml(XmlElement Definition)
        {
            List <IBinaryElement> Children = new List <IBinaryElement>();

            foreach (XmlNode N in Definition.ChildNodes)
            {
                if (N is XmlElement E)
                {
                    ISimulationNode Node = await Factory.Create(E, this, this.Model);

                    if (Node is IBinaryElement BinaryElement)
                    {
                        Children.Add(BinaryElement);
                    }
                    else
                    {
                        throw new Exception(Node.GetType() + " is not a binary element.");
                    }
                }
            }

            this.elements = Children.ToArray();
        }