public void ParseOptions(XmlElement optionsNode) { if (optionsNode != null) { XmlNode xmlNode = optionsNode["Range", "Search:"]; if (xmlNode != null) { string[] array = xmlNode.InnerText.Split(new char[] { '-' }); AirSyncDiagnostics.Assert(array.Length == 2); this.minRange = int.Parse(array[0], CultureInfo.InvariantCulture); this.maxRange = int.Parse(array[1], CultureInfo.InvariantCulture); if (this.minRange > this.maxRange || (this.protocolVersion < 120 && this.minRange != 0)) { throw new AirSyncPermanentException(StatusCode.Sync_ProtocolVersionMismatch, false) { ErrorStringForProtocolLogger = "MinMoreThanMaxinGalSearch" }; } this.rangeSpecified = true; } XmlNode pictureOptionsNode = optionsNode["Picture", "Search:"]; this.pictureOptions = PictureOptions.Parse(pictureOptionsNode, StatusCode.Sync_ProtocolVersionMismatch); } this.user.Context.ProtocolLogger.SetValue(ProtocolLoggerData.PictureRequested, (this.pictureOptions != null) ? 1 : 0); }
private void ParseOptionsNode(XmlNode optionsNode) { foreach (object obj in optionsNode.ChildNodes) { XmlNode xmlNode = (XmlNode)obj; string localName; if ((localName = xmlNode.LocalName) != null) { if (!(localName == "CertificateRetrieval")) { if (!(localName == "MaxCertificates")) { if (!(localName == "MaxAmbiguousRecipients")) { if (localName == "Availability") { this.ParseAvailabilityNode(xmlNode); continue; } if (localName == "Picture") { this.pictureOptions = PictureOptions.Parse(xmlNode, StatusCode.Sync_ServerError); continue; } } else { if (!int.TryParse(xmlNode.InnerText, out this.maxAmbiguousRecipients)) { throw new AirSyncPermanentException(StatusCode.Sync_ServerError, this.GetValidationErrorXml(), null, false) { ErrorStringForProtocolLogger = "BadMaxAmbigValueInResolveRecipients" }; } continue; } } else { if (!int.TryParse(xmlNode.InnerText, out this.maxCertificates)) { throw new AirSyncPermanentException(StatusCode.Sync_ServerError, this.GetValidationErrorXml(), null, false) { ErrorStringForProtocolLogger = "BadMaxCertsValueInResolveRecipients" }; } continue; } } else { int num; if (!int.TryParse(xmlNode.InnerText, out num)) { throw new AirSyncPermanentException(StatusCode.Sync_ServerError, this.GetValidationErrorXml(), null, false) { ErrorStringForProtocolLogger = "BadCertRetrievalValueInResolveRecipients" }; } this.certificateRetrieval = (ResolveRecipientsCommand.CertificateRetrievalType)num; if (this.certificateRetrieval != ResolveRecipientsCommand.CertificateRetrievalType.None && this.maxCertificates == 0) { this.maxCertificates = 65535; continue; } continue; } } throw new AirSyncPermanentException(StatusCode.Sync_ServerError, this.GetValidationErrorXml(), null, false) { ErrorStringForProtocolLogger = "BadOptionNode(" + xmlNode.LocalName + ")InResolveRecipients" }; } }