Пример #1
0
        private PhotoResponse ReadPhotoOffOfPersonAndServe(Person person, PhotoRequest request, PhotoResponse response)
        {
            string preferredThirdPartyPhotoUrl = person.PreferredThirdPartyPhotoUrl;

            if (!string.IsNullOrEmpty(preferredThirdPartyPhotoUrl))
            {
                return(this.ServePhotoWithRedirect(request, response, preferredThirdPartyPhotoUrl, null, string.Empty));
            }
            StoreObjectId photoSourceContactId;
            string        photoSourceNetworkId;
            PhotoResponse result;

            using (Stream photoStreamFromPerson = this.GetPhotoStreamFromPerson(request, person, out photoSourceContactId, out photoSourceNetworkId))
            {
                if (photoStreamFromPerson == null)
                {
                    this.tracer.TraceDebug((long)this.GetHashCode(), "PRIVATE HANDLER: person doesn't have a photo.");
                    result = this.ServePhotoNotFound(response);
                }
                else if (photoStreamFromPerson.Length == 0L)
                {
                    this.tracer.TraceDebug((long)this.GetHashCode(), "PRIVATE HANDLER: photo attached to person is empty.");
                    result = this.ServePhotoNotFound(response);
                }
                else
                {
                    result = this.ServePhotoContent(request, response, photoStreamFromPerson, photoSourceContactId, photoSourceNetworkId);
                }
            }
            return(result);
        }
        // Token: 0x06001345 RID: 4933 RVA: 0x0004F85C File Offset: 0x0004DA5C
        private PhotoResponse LoadPreview(PhotoRequest request, PhotoResponse response)
        {
            Dictionary <UserPhotoSize, byte[]> dictionary = new Dictionary <UserPhotoSize, byte[]>();

            try
            {
                int num = this.reader.ReadAllPreviewSizes(this.session, dictionary);
                this.tracer.TraceDebug <string, int>((long)this.GetHashCode(), "Preview photo upload handler: read preview photo of {0} with thumbprint {1:X8}.", request.TargetPrimarySmtpAddress, num);
                response.UploadedPhotos = dictionary;
                response.Thumbprint     = new int?(num);
                response.PreviewUploadHandlerProcessed = true;
            }
            catch (ObjectNotFoundException arg)
            {
                this.tracer.TraceError <ObjectNotFoundException>((long)this.GetHashCode(), "Preview photo upload handler: preview photo does NOT exist in mailbox.  Exception: {0}", arg);
                throw;
            }
            catch (StoragePermanentException arg2)
            {
                this.tracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "Preview photo upload handler: hit a permanent storage exception loading preview photo from mailbox.  Exception: {0}", arg2);
                throw;
            }
            catch (StorageTransientException arg3)
            {
                this.tracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "Preview photo upload handler: hit a transient storage exception loading preview photo from mailbox.  Exception: {0}", arg3);
                throw;
            }
            return(response);
        }
Пример #3
0
        private PhotoResponse CacheToFileSystem(PhotoRequest request, PhotoResponse response)
        {
            PhotoResponse result;

            using (new StopwatchPerformanceTracker("CachingHandlerCachePhoto", request.PerformanceLogger))
            {
                using (new CpuPerformanceTracker("CachingHandlerCachePhoto", request.PerformanceLogger))
                {
                    if (!response.OutputPhotoStream.CanSeek || !response.OutputPhotoStream.CanRead)
                    {
                        this.tracer.TraceError((long)this.GetHashCode(), "CACHING HANDLER: skipped because photo stream is unreadable and/or not seekable.");
                        result = response;
                    }
                    else
                    {
                        response.CachingHandlerProcessed = true;
                        request.PerformanceLogger.Log("CachingHandlerProcessed", string.Empty, 1U);
                        int num = this.ComputeAndStampThumbprintOntoResponse(response);
                        response.OutputPhotoStream.Seek(0L, SeekOrigin.Begin);
                        this.tracer.TraceDebug <string, int, long>((long)this.GetHashCode(), "CACHING HANDLER: caching photo at {0} with thumbprint {1:X8} and size {2} bytes", response.PhotoFullPathOnFileSystem, num, response.OutputPhotoStream.Length);
                        this.writer.Write(response.PhotoFullPathOnFileSystem, num, response.OutputPhotoStream);
                        response.PhotoWrittenToFileSystem = true;
                        this.tracer.TraceDebug((long)this.GetHashCode(), "CACHING HANDLER: photo has been cached successfully");
                        result = response;
                    }
                }
            }
            return(result);
        }
Пример #4
0
 private void ComputeTargetPrincipalAndStampOntoRequest(PhotoRequest request)
 {
     if (request.TargetPrincipal != null)
     {
         this.tracer.TraceDebug((long)this.GetHashCode(), "MAILBOX HANDLER: target principal has already been initialized.");
         return;
     }
     if (request.Requestor == null || request.Requestor.OrganizationId == null)
     {
         this.tracer.TraceDebug((long)this.GetHashCode(), "MAILBOX HANDLER: cannot compute target principal because requestor's organization id has not been initialized.");
         return;
     }
     if (string.IsNullOrEmpty(request.TargetSmtpAddress))
     {
         this.tracer.TraceDebug((long)this.GetHashCode(), "MAILBOX HANDLER: cannot compute target principal because the target's SMTP address has not been initialized.");
         return;
     }
     using (new StopwatchPerformanceTracker("MailboxPhotoHandlerComputeTargetPrincipal", request.PerformanceLogger))
     {
         using (new ADPerformanceTracker("MailboxPhotoHandlerComputeTargetPrincipal", request.PerformanceLogger))
         {
             this.tracer.TraceDebug((long)this.GetHashCode(), "MAILBOX HANDLER: computing target principal.");
             request.TargetPrincipal = ExchangePrincipal.FromProxyAddress(this.recipientSession, request.TargetSmtpAddress, RemotingOptions.LocalConnectionsOnly);
             if (request.TargetAdObjectId == null)
             {
                 request.TargetAdObjectId = request.TargetPrincipal.ObjectId;
                 this.tracer.TraceDebug <ADObjectId>((long)this.GetHashCode(), "MAILBOX HANDLER: stamped AD object ID '{0}' onto request.", request.TargetAdObjectId);
             }
         }
     }
 }
        // Token: 0x06001344 RID: 4932 RVA: 0x0004F768 File Offset: 0x0004D968
        private PhotoResponse UploadPreview(PhotoRequest request, PhotoResponse response)
        {
            if (request.RawUploadedPhoto == null || request.RawUploadedPhoto.Length == 0L)
            {
                this.tracer.TraceDebug((long)this.GetHashCode(), "Preview photo upload handler: skipped because no photo was uploaded in the request.");
                return(response);
            }
            request.RawUploadedPhoto.Seek(0L, SeekOrigin.Begin);
            int num = PhotoThumbprinter.Default.Compute(request.RawUploadedPhoto);

            this.tracer.TraceDebug <string, int>((long)this.GetHashCode(), "Preview photo upload handler: uploading preview photo of {0}.  Its thumbprint is {1:X8}.", request.TargetPrimarySmtpAddress, num);
            try
            {
                this.writer.UploadPreview(num, this.CropAndScaleRawPhoto(request.RawUploadedPhoto));
                response.PreviewUploadHandlerProcessed = true;
            }
            catch (StoragePermanentException arg)
            {
                this.tracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "Preview photo upload handler: hit a permanent storage exception uploading photo to mailbox.  Exception: {0}", arg);
                throw;
            }
            catch (StorageTransientException arg2)
            {
                this.tracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "Preview photo upload handler: hit a transient storage exception uploading photo to mailbox.  Exception: {0}", arg2);
                throw;
            }
            return(response);
        }
Пример #6
0
        private int ReadThumbprintAndStampOntoResponse(PhotoRequest request, PhotoResponse response, IMailboxSession session, bool forceReloadThumbprint)
        {
            int num = this.reader.ReadThumbprint(session, request.Preview, forceReloadThumbprint);

            response.Thumbprint = new int?(num);
            return(num);
        }
Пример #7
0
        private ADRecipient LookupTargetInDirectory(PhotoRequest request)
        {
            ADRecipient result;

            using (new StopwatchPerformanceTracker("RouterLookupTargetInDirectory", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("RouterLookupTargetInDirectory", request.PerformanceLogger))
                {
                    if (!string.IsNullOrEmpty(request.TargetSmtpAddress) && SmtpAddress.IsValidSmtpAddress(request.TargetSmtpAddress))
                    {
                        ADRecipient adrecipient = this.recipientSession.FindByProxyAddress(ProxyAddress.Parse(request.TargetSmtpAddress));
                        if (adrecipient != null)
                        {
                            return(adrecipient);
                        }
                    }
                    if (request.TargetAdObjectId != null)
                    {
                        ADRecipient adrecipient2 = this.recipientSession.Read(request.TargetAdObjectId);
                        if (adrecipient2 != null)
                        {
                            return(adrecipient2);
                        }
                    }
                    this.tracer.TraceDebug <string, ADObjectId>((long)this.GetHashCode(), "ROUTING: target not found in directory.  Search params were SMTP-address='{0}' OR ADObjectId='{1}'", request.TargetSmtpAddress, request.TargetAdObjectId);
                    result = null;
                }
            }
            return(result);
        }
Пример #8
0
        public IPhotoHandler Route(PhotoRequest request)
        {
            ArgumentValidator.ThrowIfNull("request", request);
            IPhotoHandler result;

            using (new StopwatchPerformanceTracker("RouterTotal", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("RouterTotal", request.PerformanceLogger))
                {
                    if (this.IsSelfPhotoRequest(request))
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "ROUTING: self-photo request.");
                        result = new SelfPhotoRetrievalPipeline(this.configuration, this.clientInfo, this.recipientSession, this.xsoFactory, this.tracer);
                    }
                    else if (this.TargetKnownToBeLocalToThisServer(request))
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "ROUTING: target known to be local to this server.");
                        result = new LocalServerPhotoRetrievalPipeline(this.configuration, this.clientInfo, this.recipientSession, this.xsoFactory, this.tracer);
                    }
                    else if (request.RequestorFromExternalOrganization)
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "ROUTING: requestor is from EXTERNAL organization.");
                        result = new ExternalRequestorPhotoRetrievalPipeline(this.recipientSession, this.tracer);
                    }
                    else
                    {
                        result = this.LookupTargetInDirectoryAndRoute(request);
                    }
                }
            }
            return(result);
        }
Пример #9
0
        private PhotoResponse ReadPhotoOffOfContactAndServe(StoreObjectId contactId, PhotoRequest request, PhotoResponse response)
        {
            PhotoResponse result;

            using (IContact contact = this.xsoFactory.BindToContact(request.RequestorMailboxSession, contactId, PrivatePhotoHandler.ContactPropertiesToLoad))
            {
                string valueOrDefault = contact.GetValueOrDefault <string>(ContactSchema.PartnerNetworkThumbnailPhotoUrl, null);
                if (!string.IsNullOrEmpty(valueOrDefault))
                {
                    result = this.ServePhotoWithRedirect(request, response, valueOrDefault, contactId, string.Empty);
                }
                else
                {
                    using (Stream photoStream = contact.GetPhotoStream())
                    {
                        if (photoStream == null)
                        {
                            result = this.ServePhotoNotFound(response);
                        }
                        else if (photoStream.Length == 0L)
                        {
                            result = this.ServePhotoNotFound(response);
                        }
                        else
                        {
                            result = this.ServePhotoContent(request, response, photoStream, contactId, string.Empty);
                        }
                    }
                }
            }
            return(result);
        }
Пример #10
0
        private void ClearPhotoFromFileSystem(PhotoRequest request, PhotoResponse response, FileSystemPhotoMap map, UserPhotoSize size)
        {
            int    num  = PhotoThumbprinter.Default.GenerateThumbprintForNegativeCache();
            string text = map.Map(request.TargetPrimarySmtpAddress, size);

            this.tracer.TraceDebug <string, int>((long)this.GetHashCode(), "File system photo upload handler: clearing photo at {0}.  Replacing it with NEGATIVE caching photo with thumbprint = {1:X8}", text, num);
            this.DeleteThenWritePhoto(text, num, Stream.Null);
        }
Пример #11
0
 // Token: 0x060011CB RID: 4555 RVA: 0x0004AC5E File Offset: 0x00048E5E
 private static string GetPreviewQueryStringParameter(PhotoRequest request)
 {
     if (request.Preview)
     {
         return("&isPreview=true");
     }
     return(string.Empty);
 }
Пример #12
0
 // Token: 0x060011CC RID: 4556 RVA: 0x0004AC73 File Offset: 0x00048E73
 private static string GetTargetEmailAddress(PhotoRequest request)
 {
     if (!string.IsNullOrEmpty(request.TargetPrimarySmtpAddress))
     {
         return(request.TargetPrimarySmtpAddress);
     }
     return(request.TargetSmtpAddress);
 }
Пример #13
0
 private PhotoResponse ServePhotoHasBeenDeleted(PhotoRequest request, PhotoResponse response)
 {
     this.tracer.TraceDebug((long)this.GetHashCode(), "MAILBOX HANDLER: photo has been deleted.");
     response.Served            = true;
     response.Status            = HttpStatusCode.NotFound;
     response.HttpExpiresHeader = UserAgentPhotoExpiresHeader.Default.ComputeExpiresHeader(DateTime.UtcNow, HttpStatusCode.NotFound, this.configuration);
     request.PerformanceLogger.Log("MailboxHandlerPhotoServed", string.Empty, 0U);
     return(response);
 }
Пример #14
0
        private void PopulateTargetInformationIntoRequest(PhotoRequest request, ADRecipient target)
        {
            request.TargetRecipient  = (request.TargetRecipient ?? target);
            request.TargetAdObjectId = (request.TargetAdObjectId ?? target.Id);
            SmtpAddress primarySmtpAddress = target.PrimarySmtpAddress;

            request.TargetSmtpAddress        = (string.IsNullOrEmpty(request.TargetSmtpAddress) ? target.PrimarySmtpAddress.ToString() : request.TargetSmtpAddress);
            request.TargetPrimarySmtpAddress = (string.IsNullOrEmpty(request.TargetPrimarySmtpAddress) ? target.PrimarySmtpAddress.ToString() : request.TargetPrimarySmtpAddress);
        }
Пример #15
0
 private PhotoResponse ServePhotoNotModified(PhotoRequest request, PhotoResponse response)
 {
     this.tracer.TraceDebug <string>((long)this.GetHashCode(), "MAILBOX HANDLER: NOT MODIFIED.  Requestor already has photo cached.  ETag: {0}", request.ETag);
     response.Served            = true;
     response.Status            = HttpStatusCode.NotModified;
     response.HttpExpiresHeader = UserAgentPhotoExpiresHeader.Default.ComputeExpiresHeader(DateTime.UtcNow, HttpStatusCode.NotModified, this.configuration);
     request.PerformanceLogger.Log("MailboxHandlerPhotoAvailable", string.Empty, 1U);
     request.PerformanceLogger.Log("MailboxHandlerPhotoServed", string.Empty, 1U);
     return(response);
 }
Пример #16
0
        private IPhotoHandler LookupTargetInDirectoryAndRoute(PhotoRequest request)
        {
            ADRecipient adrecipient = this.LookupTargetInDirectory(request);

            if (adrecipient == null)
            {
                return(new TargetNotFoundPhotoHandler(this.configuration, this.tracer));
            }
            return(this.RouteTarget(request, adrecipient));
        }
Пример #17
0
 // Token: 0x0600114B RID: 4427 RVA: 0x00047AF5 File Offset: 0x00045CF5
 private PhotoResponse FindTargetAndReadPhoto(PhotoRequest request, PhotoResponse response)
 {
     this.ComputeTargetADObjectIdAndStampOntoRequest(request);
     if (request.TargetAdObjectId == null)
     {
         this.tracer.TraceDebug((long)this.GetHashCode(), "AD HANDLER: cannot serve photo because target AD object ID has not been initialized.");
         return(response);
     }
     return(this.ReadPhotoOntoResponse(request, response));
 }
Пример #18
0
        private PhotoResponse FindContactOrPersonAndServePhoto(PhotoRequest request, PhotoResponse response)
        {
            StoreObjectId storeObjectId = this.FindContactId(request);

            if (storeObjectId == null)
            {
                return(this.FindPersonAndServePhoto(request, response));
            }
            return(this.ReadPhotoOffOfContactAndServe(storeObjectId, request, response));
        }
Пример #19
0
        // Token: 0x06001149 RID: 4425 RVA: 0x000478C4 File Offset: 0x00045AC4
        public PhotoResponse Retrieve(PhotoRequest request, PhotoResponse response)
        {
            PhotoResponse result;

            using (new StopwatchPerformanceTracker("ADHandlerTotal", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("ADHandlerTotal", request.PerformanceLogger))
                {
                    if (request.ShouldSkipHandlers(PhotoHandlers.ActiveDirectory))
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "AD HANDLER: skipped by request.");
                        result = response;
                    }
                    else if (response.Served)
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "AD HANDLER: skipped because photo has already been served by an upstream handler.");
                        result = response;
                    }
                    else
                    {
                        response.ADHandlerProcessed = true;
                        request.PerformanceLogger.Log("ADHandlerProcessed", string.Empty, 1U);
                        try
                        {
                            result = this.FindTargetAndReadPhoto(request, response);
                        }
                        catch (ADNoSuchObjectException arg)
                        {
                            this.tracer.TraceDebug <ADNoSuchObjectException>((long)this.GetHashCode(), "AD HANDLER: no photo.  Exception: {0}", arg);
                            request.PerformanceLogger.Log("ADHandlerPhotoAvailable", string.Empty, 0U);
                            result = response;
                        }
                        catch (TransientException arg2)
                        {
                            this.tracer.TraceError <TransientException>((long)this.GetHashCode(), "AD HANDLER: transient exception at reading photo.  Exception: {0}", arg2);
                            request.PerformanceLogger.Log("ADHandlerError", string.Empty, 1U);
                            throw;
                        }
                        catch (ADOperationException arg3)
                        {
                            this.tracer.TraceError <ADOperationException>((long)this.GetHashCode(), "AD HANDLER: AD exception at reading photo.  Exception: {0}", arg3);
                            request.PerformanceLogger.Log("ADHandlerError", string.Empty, 1U);
                            throw;
                        }
                        catch (IOException arg4)
                        {
                            this.tracer.TraceError <IOException>((long)this.GetHashCode(), "AD HANDLER: I/O exception at reading photo.  Exception: {0}", arg4);
                            request.PerformanceLogger.Log("ADHandlerError", string.Empty, 1U);
                            throw;
                        }
                    }
                }
            }
            return(result);
        }
 private PhotoResponse ServePhotoNotModified(PhotoRequest request, PhotoResponse response)
 {
     this.tracer.TraceDebug <string>((long)this.GetHashCode(), "FILE SYSTEM HANDLER: NOT MODIFIED.  Requestor already has photo cached.  ETag: {0}", request.ETag);
     response.ServerCacheHit          = true;
     response.Served                  = true;
     response.Status                  = HttpStatusCode.NotModified;
     response.IsPhotoFileOnFileSystem = true;
     request.PerformanceLogger.Log("FileSystemHandlerPhotoAvailable", string.Empty, 1U);
     request.PerformanceLogger.Log("FileSystemHandlerPhotoServed", string.Empty, 1U);
     return(response);
 }
Пример #21
0
 // Token: 0x060011A9 RID: 4521 RVA: 0x0004A54C File Offset: 0x0004874C
 private HttpWebRequest ConfigureOutgoingRequest(PhotoRequest request, HttpWebRequest httpRequest)
 {
     httpRequest.UserAgent = "Exchange/15.0 (HttpPhotoHandler)";
     httpRequest.Timeout   = this.configuration.OutgoingPhotoRequestTimeoutMilliseconds;
     httpRequest.Headers.Add("RequestType", "CrossSite");
     if (!string.IsNullOrEmpty(request.ClientRequestId))
     {
         httpRequest.Headers.Add("client-request-id", request.ClientRequestId);
     }
     return(httpRequest);
 }
Пример #22
0
        private PhotoResponse FindPersonAndServePhoto(PhotoRequest request, PhotoResponse response)
        {
            Person person = this.FindPerson(request);

            if (person == null)
            {
                this.tracer.TraceDebug((long)this.GetHashCode(), "PRIVATE HANDLER: person could not be found.");
                return(this.ServePhotoNotFound(response));
            }
            return(this.ReadPhotoOffOfPersonAndServe(person, request, response));
        }
Пример #23
0
 private PhotoResponse ServePhotoWithRedirect(PhotoRequest request, PhotoResponse response, string photoUrl, StoreObjectId photoSourceContactId, string photoSourceNetworkId)
 {
     this.tracer.TraceDebug <string, StoreObjectId, string>((long)this.GetHashCode(), "PRIVATE HANDLER: serving photo at '{0}';  found in contact with ID: '{1}';  source network: '{2}'", photoUrl, photoSourceContactId, photoSourceNetworkId);
     response.Served            = true;
     response.Status            = HttpStatusCode.Found;
     response.PhotoUrl          = photoUrl;
     response.HttpExpiresHeader = UserAgentPhotoExpiresHeader.Default.ComputeExpiresHeader(DateTime.UtcNow, HttpStatusCode.Found, this.configuration);
     response.Thumbprint        = null;
     this.TraceInformationAboutContact(photoSourceContactId, request);
     request.PerformanceLogger.Log("PrivateHandlerServedRedirect", string.Empty, 1U);
     return(response);
 }
Пример #24
0
        private PhotoResponse SavePhotosToFileSystem(PhotoRequest request, PhotoResponse response)
        {
            response.FileSystemUploadHandlerProcessed = true;
            this.tracer.TraceDebug <string>((long)this.GetHashCode(), "File system photo upload handler: saving photos of {0} to file system.", request.TargetPrimarySmtpAddress);
            FileSystemPhotoMap map = new FileSystemPhotoMap(this.photosRootDirectoryFullPath, this.upstreamTracer);

            foreach (UserPhotoSize size in this.sizesToCacheOnFileSystem)
            {
                this.SavePhotoToFileSystem(request, response, map, size);
            }
            return(response);
        }
Пример #25
0
        public PhotoResponse Retrieve(PhotoRequest request, PhotoResponse response)
        {
            ArgumentValidator.ThrowIfNull("request", request);
            ArgumentValidator.ThrowIfNull("response", response);
            PhotoResponse result;

            using (new StopwatchPerformanceTracker("PrivateHandlerTotal", request.PerformanceLogger))
            {
                using (new StorePerformanceTracker("PrivateHandlerTotal", request.PerformanceLogger))
                {
                    if (request.ShouldSkipHandlers(PhotoHandlers.Private))
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "PRIVATE HANDLER: skipped by request.");
                        result = response;
                    }
                    else if (response.Served)
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "PRIVATE HANDLER: skipped because photo has already been served by an upstream handler.");
                        result = response;
                    }
                    else if (request.RequestorMailboxSession == null)
                    {
                        this.tracer.TraceDebug((long)this.GetHashCode(), "PRIVATE HANDLER: skipped because a session to the requestor's mailbox has NOT been initialized.");
                        result = response;
                    }
                    else
                    {
                        response.PrivateHandlerProcessed = true;
                        request.PerformanceLogger.Log("PrivateHandlerProcessed", string.Empty, 1U);
                        try
                        {
                            result = this.FindContactOrPersonAndServePhoto(request, response);
                        }
                        catch (ObjectNotFoundException arg)
                        {
                            this.tracer.TraceDebug <ObjectNotFoundException>((long)this.GetHashCode(), "PRIVATE HANDLER: photo not found.  Exception: {0}", arg);
                            result = response;
                        }
                        catch (StorageTransientException arg2)
                        {
                            this.tracer.TraceError <StorageTransientException>((long)this.GetHashCode(), "PRIVATE HANDLER: transient exception at reading photo.  Exception: {0}", arg2);
                            throw;
                        }
                        catch (StoragePermanentException arg3)
                        {
                            this.tracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "PRIVATE HANDLER: permanent exception at reading photo.  Exception: {0}", arg3);
                            throw;
                        }
                    }
                }
            }
            return(result);
        }
Пример #26
0
        private IMailboxSession CreateMailboxSession(PhotoRequest request)
        {
            IMailboxSession result;

            using (new StopwatchPerformanceTracker("MailboxHandlerOpenMailbox", request.PerformanceLogger))
            {
                using (new StorePerformanceTracker("MailboxHandlerOpenMailbox", request.PerformanceLogger))
                {
                    result = this.xsoFactory.ConfigurableOpenMailboxSession(request.TargetPrincipal, new MailboxAccessInfo(new WindowsPrincipal(WindowsIdentity.GetCurrent())), CultureInfo.InvariantCulture, this.clientInfo, LogonType.Admin, MailboxPhotoHandler.MailboxPropertyDefinitions, MailboxSession.InitializationFlags.DefaultFolders | MailboxSession.InitializationFlags.SuppressFolderIdPrefetch | MailboxSession.InitializationFlags.DeferDefaultFolderIdInitialization, MailboxPhotoHandler.MailboxDefaultFolderTypes);
                }
            }
            return(result);
        }
Пример #27
0
        private Stream GetPhotoStreamFromPerson(PhotoRequest request, Person person, out StoreObjectId photoSourceContactId, out string photoSourceNetworkId)
        {
            Stream attachedPhoto;

            using (new StopwatchPerformanceTracker("GetPhotoStreamFromPerson", request.PerformanceLogger))
            {
                using (new StorePerformanceTracker("GetPhotoStreamFromPerson", request.PerformanceLogger))
                {
                    attachedPhoto = person.GetAttachedPhoto(out photoSourceNetworkId, out photoSourceContactId);
                }
            }
            return(attachedPhoto);
        }
Пример #28
0
        // Token: 0x060011AF RID: 4527 RVA: 0x0004A838 File Offset: 0x00048A38
        private Uri LocatePhotoService(PhotoRequest request)
        {
            Uri result;

            using (new StopwatchPerformanceTracker("HttpHandlerLocateService", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("HttpHandlerLocateService", request.PerformanceLogger))
                {
                    result = this.serviceLocator.Locate((ADUser)request.TargetRecipient);
                }
            }
            return(result);
        }
Пример #29
0
        // Token: 0x060011AA RID: 4522 RVA: 0x0004A5B0 File Offset: 0x000487B0
        private HttpWebResponse SendRequestOutbound(PhotoRequest request, HttpWebRequest httpRequest)
        {
            HttpWebResponse result;

            using (new StopwatchPerformanceTracker("HttpHandlerSendRequestAndGetResponse", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("HttpHandlerSendRequestAndGetResponse", request.PerformanceLogger))
                {
                    result = this.outboundRequestSender.SendAndGetResponse(httpRequest);
                }
            }
            return(result);
        }
Пример #30
0
        private bool IsTargetMailboxOnThisServer(PhotoRequest request, ADUser target, IPhotoServiceLocator serviceLocator)
        {
            bool result;

            using (new StopwatchPerformanceTracker("RouterCheckTargetMailboxOnThisServer", request.PerformanceLogger))
            {
                using (new ADPerformanceTracker("RouterCheckTargetMailboxOnThisServer", request.PerformanceLogger))
                {
                    result = serviceLocator.IsServiceOnThisServer(serviceLocator.Locate(target));
                }
            }
            return(result);
        }