Пример #1
0
 protected void RenderHtmlEncodedSaveAttachmentToDiskMessage()
 {
     if (base.UserContext.IsBasicExperience)
     {
         base.SanitizingResponse.Write(SanitizedHtmlString.FromStringId(-353246432));
         return;
     }
     Utilities.SanitizeHtmlEncode(base.GetSaveAttachmentToDiskMessage(687430467), base.SanitizingResponse);
 }
Пример #2
0
        public static SanitizedHtmlString GetAttendeeResponseCountMessage(CalendarItemBase calendarItemBase)
        {
            int num  = 0;
            int num2 = 0;
            int num3 = 0;

            foreach (Attendee attendee in calendarItemBase.AttendeeCollection)
            {
                switch (attendee.ResponseType)
                {
                case ResponseType.Tentative:
                    num2++;
                    break;

                case ResponseType.Accept:
                    num++;
                    break;

                case ResponseType.Decline:
                    num3++;
                    break;
                }
            }
            SanitizedHtmlString result;

            if (num == 0 && num2 == 0 && num3 == 0)
            {
                result = SanitizedHtmlString.FromStringId(-518767563);
            }
            else
            {
                string response  = MeetingUtilities.GetResponse(num, LocalizedStrings.GetNonEncoded(-1438005858), LocalizedStrings.GetNonEncoded(-171859085), Strings.MoreThenOneAttendeeAccepted);
                string response2 = MeetingUtilities.GetResponse(num2, LocalizedStrings.GetNonEncoded(-409971733), LocalizedStrings.GetNonEncoded(-1184021704), Strings.MoreThenOneAttendeeTentativelyAccepted);
                string response3 = MeetingUtilities.GetResponse(num3, LocalizedStrings.GetNonEncoded(161551623), LocalizedStrings.GetNonEncoded(1194482770), Strings.MoreThenOneAttendeeDeclined);
                result = SanitizedHtmlString.Format(LocalizedStrings.GetNonEncoded(-1080172631), new object[]
                {
                    response,
                    response2,
                    response3
                });
            }
            return(result);
        }
Пример #3
0
        private void HandleRightsManagementException(RightsManagementException e, OwaStoreObjectId messageId, string correlator)
        {
            RightsManagementFailureCode failureCode = e.FailureCode;

            if (failureCode <= RightsManagementFailureCode.PreLicenseAcquisitionFailed)
            {
                if (failureCode == RightsManagementFailureCode.UserRightNotGranted)
                {
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(-1796455575, this.userCulture), new object[]
                    {
                        string.Empty
                    }), correlator);
                    return;
                }
                if (failureCode != RightsManagementFailureCode.PreLicenseAcquisitionFailed)
                {
                    goto IL_15E;
                }
            }
            else
            {
                switch (failureCode)
                {
                case RightsManagementFailureCode.FailedToExtractTargetUriFromMex:
                case RightsManagementFailureCode.FailedToDownloadMexData:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(1314141112, this.userCulture), correlator);
                    return;

                case RightsManagementFailureCode.GetServerInfoFailed:
                    goto IL_15E;

                case RightsManagementFailureCode.InternalLicensingDisabled:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1049269714, this.userCulture), new object[]
                    {
                        Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture)
                    }), correlator);
                    return;

                case RightsManagementFailureCode.ExternalLicensingDisabled:
                    this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(1397740097, this.userCulture), new object[]
                    {
                        Utilities.GetOfficeDownloadAnchor(Microsoft.Exchange.Data.Storage.BodyFormat.TextHtml, this.userCulture)
                    }), correlator);
                    return;

                default:
                    switch (failureCode)
                    {
                    case RightsManagementFailureCode.ServerRightNotGranted:
                        this.EnqueueLicensingError(messageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(784482022, this.userCulture), new object[]
                        {
                            string.Empty
                        }), correlator);
                        return;

                    case RightsManagementFailureCode.InvalidLicensee:
                        break;

                    default:
                        goto IL_15E;
                    }
                    break;
                }
            }
            this.EnqueueLicensingError(messageId, SanitizedHtmlString.FromStringId(-1489754529, this.userCulture), correlator);
            return;

IL_15E:
            SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>(LocalizedStrings.GetNonEncoded(360598592));

            sanitizingStringBuilder.Append("<br>");
            sanitizingStringBuilder.AppendFormat(LocalizedStrings.GetHtmlEncoded(1633606253, this.userCulture), new object[]
            {
                e.Message
            });
            this.EnqueueLicensingError(messageId, sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>(), correlator);
        }
Пример #4
0
 private void AcquireUseLicenseAndUsageRightsCallback(IAsyncResult asyncResult)
 {
     if (asyncResult == null)
     {
         throw new ArgumentNullException("asyncResult");
     }
     if (asyncResult.AsyncState == null)
     {
         IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: asyncResult.AsyncState is null.");
         throw new InvalidOperationException("asyncResult.AsyncState must NOT be null.");
     }
     IrmLicensingManager.AsyncState asyncState = (IrmLicensingManager.AsyncState)asyncResult.AsyncState;
     try
     {
         IrmLicensingManager.Tracer.TraceDebug <OwaStoreObjectId>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: calling EndAcquireUseLicenseAndUsageRights to get results for message {0}", asyncState.MessageId);
         UseLicenseAndUsageRights useLicenseAndUsageRights = RmsClientManager.EndAcquireUseLicenseAndUsageRights(asyncResult);
         if (string.IsNullOrEmpty(useLicenseAndUsageRights.UseLicense))
         {
             IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: Use license is null/empty");
             throw new InvalidOperationException("Use license must NOT be null/empty");
         }
         if (this.userContext.State != UserContextState.Active)
         {
             IrmLicensingManager.Tracer.TraceDebug((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: User context is no longer active.  Bailing out.");
         }
         else
         {
             SafeRightsManagementHandle safeRightsManagementHandle = null;
             try
             {
                 RmsClientManager.BindUseLicenseForDecryption(new RmsClientManagerContext(useLicenseAndUsageRights.OrganizationId, RmsClientManagerContext.ContextId.MessageId, asyncState.MessageId.ToString(), null), useLicenseAndUsageRights.LicensingUri, useLicenseAndUsageRights.UseLicense, useLicenseAndUsageRights.PublishingLicense, out safeRightsManagementHandle);
             }
             finally
             {
                 if (safeRightsManagementHandle != null)
                 {
                     safeRightsManagementHandle.Close();
                 }
             }
             bool flag = false;
             try
             {
                 this.userContext.Lock();
                 flag = true;
                 using (Item item = Item.Bind(asyncState.MessageId.GetSession(this.userContext), asyncState.MessageId.StoreObjectId, ItemBindOption.None))
                 {
                     MessageItem messageItem = item as MessageItem;
                     if (messageItem == null)
                     {
                         IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: bound item is not a message.  Ignoring it.");
                     }
                     else
                     {
                         messageItem.OpenAsReadWrite();
                         messageItem[MessageItemSchema.DRMRights]     = useLicenseAndUsageRights.UsageRights;
                         messageItem[MessageItemSchema.DRMExpiryTime] = useLicenseAndUsageRights.ExpiryTime;
                         if (!DrmClientUtils.IsCachingOfLicenseDisabled(useLicenseAndUsageRights.UseLicense))
                         {
                             using (Stream stream = messageItem.OpenPropertyStream(MessageItemSchema.DRMServerLicenseCompressed, PropertyOpenMode.Create))
                             {
                                 DrmEmailCompression.CompressUseLicense(useLicenseAndUsageRights.UseLicense, stream);
                             }
                         }
                         messageItem[MessageItemSchema.DRMPropsSignature] = useLicenseAndUsageRights.DRMPropsSignature;
                         RightsManagedMessageItem rightsManagedMessageItem = messageItem as RightsManagedMessageItem;
                         if (rightsManagedMessageItem != null && rightsManagedMessageItem.IsRestricted && !rightsManagedMessageItem.TryDecode(Utilities.CreateOutboundConversionOptions(this.userContext), false).Failed)
                         {
                             bool flag2 = false;
                             foreach (AttachmentHandle attachmentHandle in rightsManagedMessageItem.ProtectedAttachmentCollection)
                             {
                                 if (!attachmentHandle.IsInline)
                                 {
                                     flag2 = true;
                                     break;
                                 }
                             }
                             messageItem[MessageItemSchema.AllAttachmentsHidden] = !flag2;
                             rightsManagedMessageItem.AbandonChangesOnProtectedData();
                         }
                         messageItem.Save(SaveMode.ResolveConflicts);
                         if (DrmClientUtils.IsCachingOfLicenseDisabled(useLicenseAndUsageRights.UseLicense))
                         {
                             this.EnqueueLicensingError(asyncState.MessageId, SanitizedHtmlString.FromStringId(-1616549110, this.userCulture), asyncState.RequestCorrelator);
                         }
                         else
                         {
                             this.EnqueueLicenseAcquired(asyncState.MessageId, asyncState.RequestCorrelator);
                         }
                     }
                 }
             }
             finally
             {
                 if (this.userContext.LockedByCurrentThread() && flag)
                 {
                     this.userContext.Unlock();
                 }
             }
         }
     }
     catch (OwaLockTimeoutException arg)
     {
         IrmLicensingManager.Tracer.TraceError <OwaLockTimeoutException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: timed-out at acquiring user context lock.  Exception: {0}", arg);
         this.EnqueueLicensingError(asyncState.MessageId, new SanitizedHtmlString(LocalizedStrings.GetNonEncoded(858913858)), asyncState.RequestCorrelator);
     }
     catch (ExchangeConfigurationException arg2)
     {
         IrmLicensingManager.Tracer.TraceError <ExchangeConfigurationException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", arg2);
         this.HandleExchangeConfigurationException(asyncState.MessageId, asyncState.RequestCorrelator);
     }
     catch (RightsManagementException ex)
     {
         IrmLicensingManager.Tracer.TraceError <RightsManagementException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", ex);
         this.HandleRightsManagementException(ex, asyncState.MessageId, asyncState.RequestCorrelator);
     }
     catch (StoragePermanentException ex2)
     {
         IrmLicensingManager.Tracer.TraceError <StoragePermanentException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", ex2);
         this.EnqueueLicensingError(asyncState.MessageId, SanitizedHtmlString.Format(LocalizedStrings.GetHtmlEncoded(994351595, this.userCulture), new object[]
         {
             ex2.Message
         }), asyncState.RequestCorrelator);
     }
     catch (TransientException arg3)
     {
         IrmLicensingManager.Tracer.TraceError <TransientException>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", arg3);
         this.EnqueueLicensingError(asyncState.MessageId, new SanitizedHtmlString(LocalizedStrings.GetNonEncoded(858913858)), asyncState.RequestCorrelator);
     }
     catch (Exception ex3)
     {
         IrmLicensingManager.Tracer.TraceError <Exception>((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: caught exception.  Exception: {0}", ex3);
         if (Globals.SendWatsonReports)
         {
             IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: sending watson report...");
             string data = string.Format("OWA version: {0}; Message Id: {1}", Globals.ApplicationVersion, asyncState.MessageId.ToBase64String());
             ExWatson.AddExtraData(data);
             ExWatson.SendReport(ex3, ReportOptions.None, null);
             IrmLicensingManager.Tracer.TraceError((long)this.GetHashCode(), "AcquireLicenseAndRightsCB: watson report has been sent.");
         }
     }
 }