CatEye.StageOperationParameters.DeserializeFromXML C# (CSharp) Method

DeserializeFromXML() public method

public DeserializeFromXML ( XmlNode node ) : void
node System.Xml.XmlNode
return void
        public virtual void DeserializeFromXML(XmlNode node)
        {
            if (node.Name != "StageOperationParameters")
                throw new IncorrectNodeException("Node isn't a StageOperationParameters node");

            string ID = GetStageOperationID();
            if (ID == null)
            {
                throw new MissingStageOperationIDException("Can't deserialize the object. It's class (" + GetType().Name + ") has no StageOperationID attribute");
            }

            if (node.Attributes["ID"] == null)
                throw new IncorrectNodeException("Node doesn't contain ID attribute");

            if (node.Attributes["ID"].Value != ID)

            {
                throw new IncorrectNodeException("Node ID (" + node.Attributes["ID"].Value +
                    ") is inequal to the ID of the object being loaded (" + ID + ")");
            }

            if (node.Attributes["Active"] != null)
            {
                bool bres;
                if (bool.TryParse(node.Attributes["Active"].Value, out bres))
                {
                    Active = bres;
                }
                else
                {
                    throw new IncorrectNodeException("Incorrect Active value");
                }
            }
            OnChanged();
        }