protected override void InternalProcessRecord()
 {
     if (this.Original)
     {
         SystemMessage dataObject = this.DataObject;
         if (dataObject.DsnCode != null)
         {
             LocalizedString localizedString;
             if (DsnDefaultMessages.TryGetResourceRecipientExplanation(dataObject.DsnCode.Value, out localizedString))
             {
                 if (!ClientCultures.IsCultureSupportedForDsn(dataObject.Language))
                 {
                     this.WriteWarning(Strings.CustomizedDsnLanguageNotAvailable(dataObject.Language.Name, base.DataSession.Source));
                 }
                 dataObject.Text = localizedString.ToString(dataObject.Language);
             }
             else
             {
                 base.WriteError(new CodeNotADefaultException(dataObject.DsnCode), ErrorCategory.InvalidOperation, this.DataObject);
             }
         }
         else if (dataObject.QuotaMessageType != null)
         {
             QuotaLocalizedTexts quotaLocalizedTexts = QuotaLocalizedTexts.GetQuotaLocalizedTexts(SetSystemMessage.ConvertToInternal(dataObject.QuotaMessageType.Value), string.Empty, string.Empty, true);
             dataObject.Text = quotaLocalizedTexts.Details.ToString(dataObject.Language);
         }
     }
     base.InternalProcessRecord();
 }
 static InitiationProcessor()
 {
     if (ClientCultures.IsCultureSupportedForDsn(CultureInfo.CurrentCulture))
     {
         InitiationProcessor.DefaultFallBackCulture = CultureInfo.CurrentCulture;
         return;
     }
     InitiationProcessor.DefaultFallBackCulture = CultureInfo.GetCultureInfo("en-US");
 }
        internal InitiationProcessor(MbxTransportMailItem mbxTransportMailItem, InitiationMessage initiationMessage, MessageItem initiationMessageItem, ApprovalEngine.ApprovalRequestCreateDelegate requestCreate, RoutingAddress approvalRequestSender)
        {
            this.mbxTransportMailItem  = mbxTransportMailItem;
            this.initiationMessage     = initiationMessage;
            this.initiationMessageItem = initiationMessageItem;
            this.requestCreate         = requestCreate;
            this.approvalRequestSender = approvalRequestSender;
            CultureInfo internalDsnDefaultLanguage = this.mbxTransportMailItem.TransportSettings.InternalDsnDefaultLanguage;

            if (internalDsnDefaultLanguage == null || !ClientCultures.IsCultureSupportedForDsn(internalDsnDefaultLanguage))
            {
                this.organizationFallbackCulture = InitiationProcessor.DefaultFallBackCulture;
                return;
            }
            this.organizationFallbackCulture = internalDsnDefaultLanguage;
        }
        // Token: 0x06000038 RID: 56 RVA: 0x00003BFC File Offset: 0x00001DFC
        private void SendModeratorExpiryNotification(MessageItem messageItem, ApprovalInformation.ApprovalNotificationType notificationType)
        {
            ModeratedDLApplication.diag.TraceDebug((long)this.GetHashCode(), "Entering SendModeratorExpiryNotification");
            if (!this.ShouldSendNotification(messageItem))
            {
                return;
            }
            string valueOrDefault = messageItem.GetValueOrDefault <string>(MessageItemSchema.ApprovalAllowedDecisionMakers);

            RoutingAddress[] collection;
            if (!ApprovalUtils.TryGetDecisionMakers(valueOrDefault, out collection))
            {
                return;
            }
            MailboxSession mailboxSession = (MailboxSession)messageItem.Session;

            messageItem.Load(ModeratedDLApplication.NotificationPropertiesFromInitMessage);
            ICollection <string> moderatedRecipients = this.GetModeratedRecipients(messageItem, false);
            string valueOrDefault2 = messageItem.GetValueOrDefault <string>(ItemSchema.InternetReferences, string.Empty);
            int    value           = messageItem.GetValueAsNullable <int>(StoreObjectSchema.RetentionPeriod) ?? 2;
            Dictionary <CultureInfo, List <RoutingAddress> > dictionary = null;
            IRecipientSession      tenantOrRootOrgRecipientSession      = DirectorySessionFactory.Default.GetTenantOrRootOrgRecipientSession(false, ConsistencyMode.FullyConsistent, mailboxSession.GetADSessionSettings(), 587, "SendModeratorExpiryNotification", "f:\\15.00.1497\\sources\\dev\\Approval\\src\\Applications\\ModeratedDLApplication\\ModeratedDLApplication.cs");
            DsnHumanReadableWriter defaultDsnHumanReadableWriter        = DsnHumanReadableWriter.DefaultDsnHumanReadableWriter;
            StoreObjectId          defaultFolderId = mailboxSession.GetDefaultFolderId(DefaultFolderType.Outbox);

            if (ClientCultures.IsCultureSupportedForDsn(CultureInfo.CurrentCulture))
            {
                this.defaultFallBackCulture = CultureInfo.CurrentCulture;
            }
            else
            {
                this.defaultFallBackCulture = CultureInfo.GetCultureInfo("en-US");
            }
            if (ApprovalProcessor.TryGetCulturesForDecisionMakers(new List <RoutingAddress>(collection), tenantOrRootOrgRecipientSession, this.defaultFallBackCulture, out dictionary))
            {
                foreach (CultureInfo cultureInfo in dictionary.Keys)
                {
                    IList <RoutingAddress> list = dictionary[cultureInfo];
                    using (MessageItem messageItem2 = MessageItem.Create(mailboxSession, defaultFolderId))
                    {
                        ApprovalInformation approvalInformation = null;
                        string text;
                        this.AttachOriginalMessageToNotification(messageItem, messageItem2, out text);
                        if (string.IsNullOrEmpty(text))
                        {
                            RoutingAddress routingAddress;
                            if (!this.TryGetOriginalSender(messageItem, out routingAddress))
                            {
                                break;
                            }
                            text = routingAddress.ToString();
                        }
                        approvalInformation  = defaultDsnHumanReadableWriter.GetMessageInModerationModeratorExpiredInformation(notificationType, messageItem.Subject, moderatedRecipients, text, new int?(value), cultureInfo.Name, this.defaultFallBackCulture);
                        messageItem2.Subject = approvalInformation.Subject;
                        BodyWriteConfiguration configuration = new BodyWriteConfiguration(BodyFormat.TextHtml, approvalInformation.MessageCharset.Name);
                        using (Stream stream = messageItem2.Body.OpenWriteStream(configuration))
                        {
                            defaultDsnHumanReadableWriter.WriteHtmlModerationBody(stream, approvalInformation);
                        }
                        this.StampCommonNotificationProperties(messageItem2, messageItem, list, valueOrDefault2, approvalInformation.Culture);
                        messageItem2.ClassName = "IPM.Note.Microsoft.Approval.Reply.Reject";
                        messageItem2.SendWithoutSavingMessage();
                        ModeratedDLApplication.diag.TraceDebug <int, string>((long)this.GetHashCode(), "Expiry Notification sent for {0} decision makers, original message id '{1}'", list.Count, valueOrDefault2);
                    }
                }
            }
        }