Example #1
0
        /// <summary>
        /// Parses realtime object description file elements
        /// </summary>
        /// <param name="in_element"></param>
        protected override void ParseElement(XPathNavigator in_element, TextReader in_xml_stream, object in_parent)
        {
            switch (in_element.Name)
            {
            case "Object":
            {
                ParserRealtimeObject realtime_object = new ParserRealtimeObject((byte)(((ParserRealtimeObjectCollection)in_parent).Objects.Count + 1));

                realtime_object.ParseXML(in_element);

                ParseXMLChildNodes(in_element, in_xml_stream, realtime_object);

                ((ParserRealtimeObjectCollection)in_parent).AddObject(in_element, realtime_object);
            }
            break;

            case "LinearConverter":
            {
                LinearConverter converter = new LinearConverter();

                converter.ParseXML(in_element);

                ((ParserRealtimeObjectCollection)m_root_class).AddConverter(in_element, converter);
            }
            break;

            default:
            {
                ParserRealtimeObjectMember realtime_member = new ParserRealtimeObjectMember();

                realtime_member.ParseValueMember(in_element, in_xml_stream, in_parent);

                ((ParserRealtimeObject)in_parent).AddMember(in_element, realtime_member);
            }
            break;
            }
        }
        /// <summary>
        /// Parses real time object description file elements
        /// </summary>
        /// <param name="in_element"></param>
        protected override void ParseElement(XPathNavigator in_element, TextReader in_xml_stream, object in_parent)
        {
            string name;
            string cdecl;

            RealtimeObjectMember.MemberType type;

            switch (in_element.Name)
            {
            case "Type":
            {
                name  = XMLAttributeParser.ConvertAttributeToString(in_element, "Name", XMLAttributeParser.atObligatory);
                cdecl = XMLAttributeParser.ConvertAttributeToString(in_element, "CDecl", XMLAttributeParser.atObligatory);

                if (name == "PacketHeader")
                {
                    m_packet_header_declaration = cdecl;
                }
                else
                {
                    type = ParserRealtimeObjectMember.TypeStringToMemberType(name);

                    if (type == RealtimeObjectMember.MemberType.Unknown)
                    {
                        throw XMLParserBase.CreateXMLParseException(string.Format(ParserRealtimeObjectStringConstants.ErrorInvalidElementType, in_element.Name), in_element);
                    }

                    m_type_lookup.Add(type, cdecl);
                }
            }
            break;

            default:
                throw XMLParserBase.CreateXMLParseException(string.Format(ParserRealtimeObjectStringConstants.ErrorInvalidElementType, in_element.Name), in_element);
            }
        }
Example #3
0
 /// <summary>
 /// Adds a new value description to the object
 /// </summary>
 /// <param name="in_element"></param>
 /// <param name="in_member"></param>
 public void AddMember(XPathNavigator in_element, ParserRealtimeObjectMember in_member)
 {
     m_members.Add(in_member);
     m_members_lookup.Add(in_member.Name, m_members.Count - 1);
 }
 /// <summary>
 /// Creates realtime object member from parser member data
 /// </summary>
 /// <param name="in_member"></param>
 public RealtimeObjectMember(ParserRealtimeObjectMember in_member) : this(in_member.Name, in_member.Type)
 {
     m_multiplier = in_member.FixedMultipler;
 }