Exemplo n.º 1
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);
        }
Exemplo n.º 2
0
        private void SavePhotoToFileSystem(PhotoRequest request, PhotoResponse response, FileSystemPhotoMap map, UserPhotoSize size)
        {
            byte[] uploadedPhotoOfSize = this.GetUploadedPhotoOfSize(response.UploadedPhotos, size);
            if (uploadedPhotoOfSize == null || uploadedPhotoOfSize.Length == 0)
            {
                this.tracer.TraceError <UserPhotoSize>((long)this.GetHashCode(), "File system photo upload handler: photo of size {0} NOT available and will NOT be saved to file system.", size);
                return;
            }
            string text = map.Map(request.TargetPrimarySmtpAddress, size);

            using (MemoryStream memoryStream = new MemoryStream(uploadedPhotoOfSize))
            {
                this.tracer.TraceDebug <string>((long)this.GetHashCode(), "File system photo upload handler: writing photo at {0}", text);
                this.DeleteThenWritePhoto(text, response.Thumbprint.Value, memoryStream);
            }
        }