Exemplo n.º 1
0
        /// <summary>
        /// Parses Packet description
        /// </summary>
        /// <param name="in_element"></param>
        protected override void ParseElement(XPathNavigator in_element, TextReader in_xml_stream, object in_parent)
        {
            ParserDeviceSettingValue value = null;

            // parse only elements
            if (in_element.NodeType != XPathNodeType.Element)
            {
                return;
            }

            switch (in_element.Name)
            {
            case "Group":
            {
                ParserDeviceSettingsRoot  parent = (ParserDeviceSettingsRoot)in_parent;
                ParserDeviceSettingsGroup group  = new ParserDeviceSettingsGroup();

                group.ParseXML(in_element);

                parent.AddGroup(in_element, group);

                ParseXMLChildNodes(in_element, in_xml_stream, group);
            }
            break;

            case "EnumDefs":
            {
                ParserDeviceSettingsRoot     parent    = (ParserDeviceSettingsRoot)in_parent;
                ParserDeviceSettingsEnumDefs enum_defs = new ParserDeviceSettingsEnumDefs();

                enum_defs.ParseXML(in_element);

                parent.AddEnumDefs(in_element, enum_defs);

                ParseXMLChildNodes(in_element, in_xml_stream, enum_defs);
            }
            break;

            case "Title":
            {
                ParserDeviceSettingsEnumDefs  parent = (ParserDeviceSettingsEnumDefs)in_parent;
                ParserDeviceSettingsEnumValue title  = new ParserDeviceSettingsEnumValue();

                title.ParseXML(in_element);

                parent.AddValue(in_element, title);
            }
            break;

            default:
                value = ParserDeviceSettingValue.ValueFactory(in_element, in_xml_stream, (ParserDeviceSettingsGroup)in_parent);
                break;
            }

            if (value != null)
            {
                value.SetValueIndex(m_value_index++);
            }
        }
 /// <summary>
 /// Adds new enum value to the collection
 /// </summary>
 /// <param name="in_element"></param>
 /// <param name="in_value"></param>
 public void AddValue(XPathNavigator in_element, ParserDeviceSettingsEnumValue in_value)
 {
     // store value
     m_values.Add(in_value);
 }