Exemplo n.º 1
0
        /// <summary>
        /// Read user setting with ProtocolConnection value.
        /// </summary>
        /// <param name="reader">EwsServiceXmlReader</param>
        internal static ProtocolConnection LoadFromXml(EwsXmlReader reader)
        {
            ProtocolConnection connection = new ProtocolConnection();
            
            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    switch (reader.LocalName)
                    {
                        case XmlElementNames.EncryptionMethod:
                            connection.EncryptionMethod = reader.ReadElementValue<string>();
                            break;
                        case XmlElementNames.Hostname:
                            connection.Hostname = reader.ReadElementValue<string>();
                            break;
                        case XmlElementNames.Port:
                            connection.Port = reader.ReadElementValue<int>();
                            break;
                    }
                }
            }
            while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.ProtocolConnection));

            return connection;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Read user setting with ProtocolConnectionCollection value.
        /// </summary>
        /// <param name="reader">EwsServiceXmlReader</param>
        internal static ProtocolConnectionCollection LoadFromXml(EwsXmlReader reader)
        {
            ProtocolConnectionCollection value      = new ProtocolConnectionCollection();
            ProtocolConnection           connection = null;

            do
            {
                reader.Read();

                if (reader.NodeType == XmlNodeType.Element)
                {
                    if (reader.LocalName == XmlElementNames.ProtocolConnection)
                    {
                        connection = ProtocolConnection.LoadFromXml(reader);
                        if (connection != null)
                        {
                            value.Connections.Add(connection);
                        }
                    }
                }
            }while (!reader.IsEndElement(XmlNamespace.Autodiscover, XmlElementNames.ProtocolConnections));

            return(value);
        }