Beispiel #1
0
        public override void WriteObject(XmlWriter writer, object graph)
        {
            AddressResponse AddressResponseField = ((AddressResponse)(graph));

            if (WriteParentElement(writer, true, true, graph))
            {
                if (WriteChildElement(writer, "address", true, false, AddressResponseField.address))
                {
                    writer.WriteString(AddressResponseField.address);
                    writer.WriteEndElement();
                }
                if (WriteChildElement(writer, "port", true, false, AddressResponseField.port))
                {
                    writer.WriteString(AddressResponseField.port);
                    writer.WriteEndElement();
                }
                if (WriteChildElement(writer, "serverTime", false, false, AddressResponseField.serverTime))
                {
                    writer.WriteString(XmlConvert.ToString(AddressResponseField.serverTime));
                    writer.WriteEndElement();
                }
                writer.WriteEndElement();
            }
            return;
        }
Beispiel #2
0
        public override object ReadObject(XmlReader reader)
        {
            AddressResponse AddressResponseField = null;

            if (IsParentStartElement(reader, false, true))
            {
                AddressResponseField = new AddressResponse();
                reader.Read();
                if (IsChildStartElement(reader, "address", true, false))
                {
                    reader.Read();
                    AddressResponseField.address = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "port", true, false))
                {
                    reader.Read();
                    AddressResponseField.port = reader.ReadString();
                    reader.ReadEndElement();
                }
                if (IsChildStartElement(reader, "serverTime", false, false))
                {
                    reader.Read();
                    AddressResponseField.serverTime = XmlConvert.ToInt64(reader.ReadString());
                    reader.ReadEndElement();
                }
                reader.ReadEndElement();
            }
            return(AddressResponseField);
        }