LoadFromXml static method

Future<ProtocolConnection> LoadFromXml(
  1. EwsXmlReader reader
)
Read user setting with ProtocolConnection value. EwsServiceXmlReader

Implementation

static Future<ProtocolConnection> LoadFromXml(EwsXmlReader reader) async {
  ProtocolConnection connection = new ProtocolConnection();

  do {
    await reader.Read();

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

  return connection;
}