Example #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++);
            }
        }
Example #2
0
        /// <summary>
        /// Adds enum definition to the root
        /// </summary>
        /// <param name="in_element"></param>
        /// <param name="in_enum_defs"></param>
        public void AddEnumDefs(XPathNavigator in_element, ParserDeviceSettingsEnumDefs in_enum_defs)
        {
            int index;

            // store group
            m_enum_defs.Add(in_enum_defs);
            index = m_enum_defs.Count - 1;
            m_enumdefs_lookup.Add(in_enum_defs.ID, index);
        }