示例#1
0
        private int ReadThumbprintInternal(IMailboxSession session, bool preview, bool forceReloadThumbprint)
        {
            Mailbox mailbox = ((MailboxSession)session).Mailbox;

            if (forceReloadThumbprint)
            {
                this.tracer.TraceDebug((long)this.GetHashCode(), "Mailbox photo reader: reloading thumbprint properties");
                mailbox.ForceReload(MailboxPhotoReader.ThumbprintProperties);
            }
            object obj = mailbox.TryGetProperty(preview ? MailboxPhotoReader.UserPhotoPreviewCacheIdProperty : MailboxPhotoReader.UserPhotoCacheIdProperty);

            if (!(obj is int))
            {
                this.tracer.TraceDebug <bool>((long)this.GetHashCode(), "Mailbox photo reader: no thumbprint.  Preview? {0}", preview);
                throw new ObjectNotFoundException(Strings.UserPhotoThumbprintNotFound(preview));
            }
            if (0.Equals(obj))
            {
                this.tracer.TraceDebug((long)this.GetHashCode(), "Mailbox photo reader: thumbprint indicates photo has been deleted.");
                throw MailboxPhotoReader.CreateExceptionIndicatingPhotoHasBeenDeleted();
            }
            this.tracer.TraceDebug <int, bool>((long)this.GetHashCode(), "Mailbox photo reader: read thumbprint: {0:X8}.  Preview? {1}", (int)obj, preview);
            return((int)obj);
        }