LoadFromXml static method

Read user setting with ProtocolConnectionCollection value. EwsServiceXmlReader

Implementation

static Future<ProtocolConnectionCollection> LoadFromXml(
  EwsXmlReader reader,
) async {
  ProtocolConnectionCollection value = ProtocolConnectionCollection();
  ProtocolConnection? connection;

  do {
    await reader.Read();

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

  return value;
}