private static RecipientTrackingEvent Create(string domain, string recipientEmail, string recipientDisplayName, string deliveryStatusString, string eventDescriptionString, string[] eventData, string server, DateTime date, string internalIdString, string uniquePathId, bool hiddenRecipient, bool?bccRecipient, string rootAddress, Microsoft.Exchange.SoapWebClient.EWS.TrackingPropertyType[] properties)
        {
            if (string.IsNullOrEmpty(recipientEmail))
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Null recipient address in WS-RecipientTrackingEvent: {0}", recipientEmail);
                TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "Null recipient in WS-response", new object[0]);
            }
            SmtpAddress smtpAddress = new SmtpAddress(recipientEmail);

            if (!smtpAddress.IsValidAddress)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <SmtpAddress>(0, "Corrupt recipient address in RD-RecipientTrackingEvent: {0}", smtpAddress);
                TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "Invalid recipient address {0} in WS-response", new object[]
                {
                    smtpAddress
                });
            }
            recipientDisplayName = (recipientDisplayName ?? smtpAddress.ToString());
            DeliveryStatus deliveryStatus;

            if (!EnumValidator <DeliveryStatus> .TryParse(deliveryStatusString, EnumParseOptions.Default, out deliveryStatus))
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <string>(0, "Skipping event because of unknown delivery-status value in WS-RecipientTrackingEvent: {0}", deliveryStatusString);
                return(null);
            }
            EventDescription eventDescription;

            if (!EnumValidator <EventDescription> .TryParse(eventDescriptionString, EnumParseOptions.Default, out eventDescription))
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <string>(0, "Skipping event because of unknown event-description in WS-RecipientTrackingEvent: {0}", eventDescriptionString);
                return(null);
            }
            if (string.IsNullOrEmpty(internalIdString))
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Null or empty internalIdString in RD-RecipientTrackingEvent: {0}", internalIdString);
                TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "No InternalId {0} in WS-response", new object[0]);
            }
            long num = 0L;

            if (!long.TryParse(internalIdString, out num) || num < 0L)
            {
                TraceWrapper.SearchLibraryTracer.TraceError <string>(0, "Non-numeric or negative internalIdString in RD-RecipientTrackingEvent: {0}", internalIdString);
                TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "Invalid InternalId {0} in WS-response", new object[]
                {
                    internalIdString
                });
            }
            TrackingExtendedProperties trackingExtendedProperties = TrackingExtendedProperties.CreateFromTrackingPropertyArray(properties);

            if (eventDescription == EventDescription.PendingModeration && !string.IsNullOrEmpty(trackingExtendedProperties.ArbitrationMailboxAddress) && !SmtpAddress.IsValidSmtpAddress(trackingExtendedProperties.ArbitrationMailboxAddress))
            {
                TraceWrapper.SearchLibraryTracer.TraceDebug <string>(0, "Arbitration address is in the extended proprties but it's invalid: {0}", trackingExtendedProperties.ArbitrationMailboxAddress);
                TrackingFatalException.RaiseED(ErrorCode.UnexpectedErrorPermanent, "Invalid ArbitrationMailboxAddress property {0} in WS-response", new object[]
                {
                    trackingExtendedProperties.ArbitrationMailboxAddress
                });
            }
            return(new RecipientTrackingEvent(domain, smtpAddress, recipientDisplayName, deliveryStatus, EventType.Pending, eventDescription, eventData, server, date, num, uniquePathId, hiddenRecipient, bccRecipient, rootAddress, true, trackingExtendedProperties));
        }
 public static void Convert(Microsoft.Exchange.SoapWebClient.EWS.FindMessageTrackingReportRequestType request, int version)
 {
     Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType exchangeVersionType  = VersionConverter.GetExchangeVersionType(version);
     Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType exchangeVersionType2 = exchangeVersionType;
     if (exchangeVersionType2 == Microsoft.Exchange.SoapWebClient.EWS.ExchangeVersionType.Exchange2010)
     {
         TrackingExtendedProperties trackingExtendedProperties = TrackingExtendedProperties.CreateFromTrackingPropertyArray(request.Properties);
         Options options = new Options(VersionConverter.BasicDiagnostics.Equals(request.DiagnosticsLevel, StringComparison.Ordinal), trackingExtendedProperties.ExpandTree, trackingExtendedProperties.SearchAsRecip, request.ServerHint);
         request.DiagnosticsLevel = options.ToString();
         request.ServerHint       = null;
         request.Properties       = null;
         return;
     }
     if (request.Properties != null && request.Properties.Length == 0)
     {
         request.Properties = null;
     }
 }