Ejemplo n.º 1
0
        // Token: 0x0600025A RID: 602 RVA: 0x00015264 File Offset: 0x00013464
        protected void RenderSilverlight(string rootVisualType, string id, int width, int height, string alternateHtml)
        {
            SanitizedHtmlString value = SanitizedHtmlString.Format("<div style=\"width:{1}px;height:{2}px;\"><object \r\n                id=\"{0}\" \r\n                data=\"data:application/x-silverlight-2,\"\r\n                type=\"application/x-silverlight-2\"\r\n                width=\"{1}\" \r\n                height=\"{2}\"\r\n                ><param name=\"source\" value=\"/OWA/{3}/ClientBin/{4}.xap\"/>\r\n                <param name=\"initParams\" value=\"RootVisualType={5}.{6}\"/>\r\n                <param name=\"onError\" value=\"{7}\" />\r\n                <param name=\"minRuntimeVersion\" value=\"{8}\" />\r\n                <param name=\"autoUpgrade\" value=\"true\" />{9}</object></div>", new object[]
            {
                id,
                width,
                height,
                Globals.ApplicationVersion,
                "OwaSl",
                "Microsoft.Exchange.Clients.Owa.Silverlight",
                rootVisualType,
                "SL_OnPluginError",
                "2.0.31005.0",
                alternateHtml
            });

            base.Response.Output.Write(value);
        }
Ejemplo n.º 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);
        }
        public void InvokeTaskManager()
        {
            if (!AppSettings.GetConfiguredValue <bool>("TranscodingServiceEnabled", false))
            {
                this.HandleFault(LocalizedStrings.GetNonEncoded(500694802));
                return;
            }
            AttachmentPolicy attachmentPolicy = this.owaContext.UserContext.AttachmentPolicy;

            using (Stream stream = this.LoadDocument(true, out this.decryptionStatus))
            {
                if (this.decryptionStatus.Failed)
                {
                    SanitizedHtmlString irmErrorDetails = WebReadyViewUtilities.GetIrmErrorDetails(this.owaContext.UserContext, this.decryptionStatus);
                    this.HandleFault(irmErrorDetails.ToString());
                }
                else if (!attachmentPolicy.WebReadyDocumentViewingEnable)
                {
                    this.HandleFault(LocalizedStrings.GetNonEncoded(500694802));
                }
                else if (!AttachmentUtility.IsWebReadyDocument(this.fileExtension, this.mimeType))
                {
                    this.HandleFault(LocalizedStrings.GetNonEncoded(-1584334964));
                }
                else
                {
                    try
                    {
                        byte[] bytes = Encoding.Default.GetBytes(this.documentIdStringBuilder.ToString());
                        byte[] value = null;
                        using (MessageDigestForNonCryptographicPurposes messageDigestForNonCryptographicPurposes = new MessageDigestForNonCryptographicPurposes())
                        {
                            value = messageDigestForNonCryptographicPurposes.ComputeHash(bytes);
                        }
                        WebReadyViewUtilities.InitializeTranscodingService();
                        Utilities.MakePageNoCacheNoStore(this.owaContext.HttpContext.Response);
                        string sourceDocType = string.IsNullOrEmpty(this.fileExtension) ? this.mimeType : this.fileExtension.TrimStart(new char[]
                        {
                            '.'
                        });
                        try
                        {
                            TranscodingTaskManager.Transcode(BitConverter.ToString(value), this.owaContext.UserContext.Key.UserContextId, stream, sourceDocType, this.currentPageNumber, out this.totalPageNumber, this.owaContext.HttpContext.Response);
                        }
                        catch (TranscodingCrashException innerException)
                        {
                            OwaDiagnostics.LogEvent(ClientsEventLogConstants.Tuple_TranscodingWorkerProcessFails, string.Empty, new object[]
                            {
                                this.owaContext.LogonIdentity.GetLogonName(),
                                this.owaContext.LogonIdentity.UserSid.Value,
                                this.messageFrom,
                                this.messageSubject,
                                this.messageId,
                                this.documentPath,
                                this.documentIdStringBuilder.ToString()
                            });
                            throw new TranscodingUnconvertibleFileException("Transcoding service crash when converting the document.", innerException, this);
                        }
                        if (this.currentPageNumber == 0)
                        {
                            this.currentPageNumber = this.totalPageNumber;
                        }
                    }
                    catch (TranscodingException ex)
                    {
                        ExTraceGlobals.TranscodingTracer.TraceDebug <Type, string>(0L, "Exception: Type: {0} Error: {1}.", ex.GetType(), ex.Message);
                        ErrorInformation exceptionHandlingInformation = Utilities.GetExceptionHandlingInformation(ex, this.owaContext.MailboxIdentity);
                        this.HandleFault(exceptionHandlingInformation.Message);
                    }
                }
            }
        }
Ejemplo n.º 4
0
 internal bool EnqueueLicensingError(OwaStoreObjectId messageId, SanitizedHtmlString requestStatusMessage, string requestCorrelator)
 {
     return(this.Enqueue(new IrmLicensingManager.LicensingResponseQueue.LicensingResponse(messageId, true, requestStatusMessage, requestCorrelator)));
 }
Ejemplo n.º 5
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);
        }
Ejemplo n.º 6
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.");
         }
     }
 }