Beispiel #1
0
 // Token: 0x06001BD9 RID: 7129 RVA: 0x000A07E8 File Offset: 0x0009E9E8
 public static bool RenderTaskIcon(TextWriter writer, UserContext userContext, string itemClass, int iconFlag, bool isRead, bool isIrmProtected)
 {
     if (itemClass == null)
     {
         return(false);
     }
     if (string.Equals(itemClass, "IPM.Note", StringComparison.InvariantCultureIgnoreCase) && isIrmProtected)
     {
         itemClass += ".irm";
     }
     SmallIconManager.RenderItemIcon(writer, userContext, itemClass, false, null, false, isRead, iconFlag, string.Empty, new string[0]);
     return(true);
 }
Beispiel #2
0
        private static void RenderIconForItem(Item item, TextWriter writer, UserContext userContext)
        {
            int  iconFlag     = -1;
            bool isInConflict = false;
            bool isRead       = false;

            if (item is MessageItem)
            {
                iconFlag     = ItemUtility.GetProperty <int>(item, ItemSchema.IconIndex, -1);
                isInConflict = ItemUtility.GetProperty <bool>(item, MessageItemSchema.MessageInConflict, false);
                isRead       = ItemUtility.GetProperty <bool>(item, MessageItemSchema.IsRead, false);
            }
            writer.Write("<img class=\"sI\" alt=\"\" src=\"");
            SmallIconManager.RenderItemIconUrl(writer, userContext, item.ClassName, null, isInConflict, isRead, iconFlag);
            writer.Write("\">");
        }
        // Token: 0x060006B0 RID: 1712 RVA: 0x00034850 File Offset: 0x00032A50
        internal static void RenderSpecialFolderIcon(TextWriter output, UserContext userContext, string folderClass, StoreObjectId folderId)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (folderId == null)
            {
                throw new ArgumentNullException("folderId");
            }
            ThemeFileId themeFileId = ThemeFileId.None;

            switch (Utilities.GetDefaultFolderType(userContext.MailboxSession, folderId))
            {
            case DefaultFolderType.DeletedItems:
                themeFileId = ThemeFileId.BasicDeleted;
                break;

            case DefaultFolderType.Drafts:
                themeFileId = ThemeFileId.Drafts;
                break;

            case DefaultFolderType.Inbox:
                themeFileId = ThemeFileId.Inbox;
                break;

            case DefaultFolderType.JunkEmail:
                themeFileId = ThemeFileId.JunkEMail;
                break;

            case DefaultFolderType.SentItems:
                themeFileId = ThemeFileId.SentItems;
                break;
            }
            if (themeFileId == ThemeFileId.None)
            {
                SmallIconManager.RenderFolderIconUrl(output, userContext, folderClass);
                return;
            }
            userContext.RenderThemeFileUrl(output, themeFileId);
        }
Beispiel #4
0
        // Token: 0x06002592 RID: 9618 RVA: 0x000D9780 File Offset: 0x000D7980
        private void BuildIcon(SanitizingStringBuilder <OwaHtml> stringBuilder)
        {
            FolderSharingFlag sharingFlag = FolderSharingFlag.None;

            if (this.isSharedFolder || this.isPublicFolder)
            {
                sharingFlag = FolderSharingFlag.SharedIn;
            }
            else if (this.isSharedOutFolder)
            {
                sharingFlag = FolderSharingFlag.SharedOut;
            }
            using (SanitizingStringWriter <OwaHtml> sanitizingStringWriter = new SanitizingStringWriter <OwaHtml>())
            {
                SmallIconManager.RenderFolderIcon(sanitizingStringWriter, this.userContext, this.containerClass, sharingFlag, false, new string[0]);
                stringBuilder.Append <SanitizedHtmlString>(sanitizingStringWriter.ToSanitizedString <SanitizedHtmlString>());
            }
        }
Beispiel #5
0
 // Token: 0x06001BD6 RID: 7126 RVA: 0x000A0734 File Offset: 0x0009E934
 public static bool RenderItemIcon(TextWriter writer, UserContext userContext, string itemClass, string defaultItemClass)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     if (userContext == null)
     {
         throw new ArgumentNullException("userContext");
     }
     if (itemClass == null)
     {
         return(false);
     }
     SmallIconManager.SmallIcon itemSmallIcon = SmallIconManager.GetItemSmallIcon(itemClass, defaultItemClass, false, false, -1);
     userContext.RenderThemeImageWithToolTip(writer, (ThemeFileId)itemSmallIcon.ThemeId, "sI", itemSmallIcon.AltId, new string[0]);
     return(true);
 }
		// Token: 0x06002EBE RID: 11966 RVA: 0x0010C4DC File Offset: 0x0010A6DC
		private bool BindItemAndShowDialog(Event eventItem, string type)
		{
			MessageItem messageItem = null;
			bool result;
			try
			{
				messageItem = Item.BindAsMessage(base.UserContext.MailboxSession, eventItem.ObjectId);
				if (messageItem != null)
				{
					string text = ItemUtility.GetProperty<string>(messageItem, StoreObjectSchema.ItemClass, null);
					if (text == null)
					{
						text = "IPM.Note";
					}
					this.Writer.Write("shwNwItmDlg(\"");
					if (messageItem.From != null && messageItem.From.DisplayName != null)
					{
						Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.From.DisplayName), this.Writer);
					}
					this.Writer.Write("\",\"");
					if (messageItem.Subject != null)
					{
						Utilities.JavascriptEncode(Utilities.HtmlEncode(messageItem.Subject), this.Writer);
					}
					this.Writer.Write("\",\"" + type + "\",\"");
					using (StringWriter stringWriter = new StringWriter())
					{
						SmallIconManager.RenderItemIcon(stringWriter, base.UserContext, text, false, "nwItmImg", new string[0]);
						Utilities.JavascriptEncode(stringWriter.ToString(), this.Writer);
					}
					this.Writer.Write("\");");
				}
				result = true;
			}
			catch (ObjectNotFoundException)
			{
				if (type != null)
				{
					if (!(type == "lnkNwMl"))
					{
						if (!(type == "lnkNwVMl"))
						{
							if (type == "lnkNwFx")
							{
								this.Writer.Write("shwNF(0);");
							}
						}
						else
						{
							this.Writer.Write("shwNVM(0);");
						}
					}
					else
					{
						this.Writer.Write("shwNM(0);");
					}
				}
				result = false;
			}
			finally
			{
				if (messageItem != null)
				{
					messageItem.Dispose();
				}
			}
			return result;
		}
Beispiel #7
0
        protected void RenderTargetFolderList(TextWriter writer)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            writer.Write("<td class=\"ddt\" nowrap>");
            writer.Write(LocalizedStrings.GetHtmlEncoded(-1166023766));
            writer.Write("</td>");
            writer.Write("<td class=\"dd\" nowrap>");
            writer.Write("<table cellspacing=0 cellpadding=0>");
            bool flag = false;

            if (this.Module == NavigationModule.Mail && this.mruFolderList != null)
            {
                for (int i = 0; i < this.mruFolderList.Count; i++)
                {
                    writer.Write("<tr><td class=\"chkb\">");
                    writer.Write("<input type=radio name=\"tfId\" onClick=\"return onClkRdo()\" value=\"");
                    Utilities.HtmlEncode(this.mruFolderList[i].Id.ToBase64String(), writer);
                    writer.Write("\"");
                    if (this.targetFolderId != null && this.targetFolderId.Equals(this.mruFolderList[i].Id))
                    {
                        writer.Write(" checked=true");
                        flag = true;
                    }
                    writer.Write(" id=\"rdomru");
                    writer.Write(i + 1);
                    writer.Write("\">");
                    writer.Write("</td><td class=\"mru\" nowrap><label for=\"rdomru");
                    writer.Write(i + 1);
                    writer.Write("\"><a href=\"#\" onClick=\"return onClkMru(");
                    writer.Write(i + 1);
                    writer.Write(")\"><img src=\"");
                    SmallIconManager.RenderFolderIconUrl(writer, base.OwaContext.UserContext, null);
                    writer.Write("\" alt=\"\">");
                    Utilities.CropAndRenderText(writer, this.mruFolderList[i].DisplayName, 24);
                    writer.Write("</a></label></td><td></td></tr>");
                }
            }
            writer.Write("<tr><td>");
            string        dropdownName  = "tfId";
            StoreObjectId storeObjectId = flag ? null : this.targetFolderId;

            switch (this.Module)
            {
            case NavigationModule.Mail:
                if (this.mruFolderList != null && this.mruFolderList.Count != 0)
                {
                    writer.Write("<input type=radio name=\"tfId\" id=\"rdofldlst\" onClick=\"return onClkRdo()\" ");
                    if (this.targetFolderId != null && !flag)
                    {
                        writer.Write(" checked");
                    }
                    writer.Write("></td><td>");
                    dropdownName = null;
                }
                if (storeObjectId == null)
                {
                    storeObjectId = base.UserContext.InboxFolderId;
                }
                this.folderDropDown.RenderMailMove(this.allFolderList, storeObjectId, dropdownName, writer);
                break;

            case NavigationModule.Calendar:
                if (storeObjectId == null)
                {
                    storeObjectId = base.UserContext.CalendarFolderId;
                }
                break;

            case NavigationModule.Contacts:
                if (storeObjectId == null)
                {
                    storeObjectId = base.UserContext.ContactsFolderId;
                }
                this.folderDropDown.RenderContactMove(this.contactFolderList, storeObjectId, dropdownName, writer);
                break;
            }
            writer.Write("</td><td class=\"btn\" align=\"left\">");
            bool flag2 = this.mruFolderList == null || this.mruFolderList.Count == 0 || this.targetFolderId != null;

            writer.Write("<a href=\"#\" onClick=\"return onClkMv();\" onKeyPress=\"return onKPMv(event);\" id=\"btnmv\"");
            if (!flag2)
            {
                writer.Write(" class=\"fmbtn fmbtnDis\"");
            }
            else
            {
                writer.Write(" class=\"fmbtn fmbtnEnb\"");
            }
            writer.Write(">");
            writer.Write(LocalizedStrings.GetHtmlEncoded(1414245993));
            writer.Write("</a></td></tr></table></td>");
        }
Beispiel #8
0
        internal static void RenderAttachmentLink(TextWriter output, AttachmentWellType wellType, AttachmentWellInfo attachmentInfoObject, string itemId, UserContext userContext, ArrayList previousAttachmentDisplayNames, AttachmentWell.AttachmentWellFlags flags, bool prependSemicolon = false)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (attachmentInfoObject == null)
            {
                throw new ArgumentNullException("attachmentInfoObject");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (string.IsNullOrEmpty(itemId))
            {
                throw new ArgumentException("itemId may not be null or empty string");
            }
            SanitizedHtmlString value = null;
            string fileExtension      = string.Empty;
            SanitizedHtmlString sanitizedHtmlString = null;

            AttachmentUtility.AttachmentLinkFlags attachmentLinkFlag = AttachmentUtility.GetAttachmentLinkFlag(wellType, attachmentInfoObject);
            if ((flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) != (AttachmentWell.AttachmentWellFlags) 0)
            {
                string format = "<a id=\"{0}\" href=\"#\" onclick=\"{1}\" title=\"{2}\">{3}";
                string text   = AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false);
                value = SanitizedHtmlString.Format(format, new object[]
                {
                    "lnkAtmt",
                    "return alert(L_ErrRchMxEmbDpth)",
                    attachmentInfoObject.AttachmentName,
                    text
                });
            }
            else
            {
                string format2 = "<a id=\"{0}\" href=\"attachment.ashx?attach=1&{1}\" target=_blank onclick=\"{2}\" title=\"{3}\">{4}";
                SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>();
                if (AttachmentWell.AttachmentWellFlags.RenderEmbeddedAttachment != (flags & AttachmentWell.AttachmentWellFlags.RenderEmbeddedAttachment))
                {
                    sanitizingStringBuilder.Append("id=");
                    sanitizingStringBuilder.Append(Utilities.UrlEncode(itemId));
                    sanitizingStringBuilder.Append("&attid0=");
                    sanitizingStringBuilder.Append(Utilities.UrlEncode(attachmentInfoObject.AttachmentId.ToBase64String()));
                    sanitizingStringBuilder.Append("&attcnt=1");
                }
                else
                {
                    sanitizingStringBuilder.Append(AttachmentWell.RenderEmbeddedQueryString(itemId));
                    sanitizingStringBuilder.Append(Utilities.UrlEncode(attachmentInfoObject.AttachmentId.ToBase64String()));
                }
                sanitizedHtmlString = sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>();
                if (attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.ForceSave)
                {
                    string text2 = AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false);
                    value = SanitizedHtmlString.Format(format2, new object[]
                    {
                        "lnkAtmt",
                        sanitizedHtmlString,
                        "return onClkAtmt(2)",
                        attachmentInfoObject.AttachmentName,
                        text2
                    });
                }
                if (attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.Allow)
                {
                    string text3 = AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false);
                    value = SanitizedHtmlString.Format(format2, new object[]
                    {
                        "lnkAtmt",
                        sanitizedHtmlString,
                        "return onClkAtmt(3)",
                        attachmentInfoObject.AttachmentName,
                        text3
                    });
                }
            }
            if (prependSemicolon)
            {
                output.Write("; ");
            }
            output.Write("<span id=\"spnAtmt\" tabindex=\"-1\" level=\"");
            output.Write((int)attachmentInfoObject.AttachmentLevel);
            if (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink != (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink & attachmentLinkFlag) && (flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) == (AttachmentWell.AttachmentWellFlags) 0)
            {
                output.Write("\" class=\"dsbl");
            }
            output.Write("\">");
            output.Write("<img class=\"sI\" src=\"");
            if (attachmentInfoObject.FileExtension != null)
            {
                fileExtension = attachmentInfoObject.FileExtension;
            }
            SmallIconManager.RenderFileIconUrl(output, userContext, fileExtension);
            output.Write("\" alt=\"\">");
            if (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink == (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink & attachmentLinkFlag) || (flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) != (AttachmentWell.AttachmentWellFlags) 0)
            {
                output.Write(value);
            }
            else
            {
                Utilities.SanitizeHtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(attachmentInfoObject.AttachmentName, previousAttachmentDisplayNames, false), output);
            }
            if (AttachmentWell.AttachmentWellFlags.RenderAttachmentSize == (flags & AttachmentWell.AttachmentWellFlags.RenderAttachmentSize))
            {
                long size = attachmentInfoObject.Size;
                if (size > 0L)
                {
                    output.Write(userContext.DirectionMark);
                    output.Write(" ");
                    output.Write(SanitizedHtmlString.FromStringId(6409762));
                    Utilities.RenderSizeWithUnits(output, size, true);
                    output.Write(userContext.DirectionMark);
                    output.Write(SanitizedHtmlString.FromStringId(-1023695022));
                }
            }
            output.Write("</a>");
            if (AttachmentUtility.AttachmentLinkFlags.OpenAsWebPageLink == (AttachmentUtility.AttachmentLinkFlags.OpenAsWebPageLink & attachmentLinkFlag))
            {
                output.Write("<span class=\"wvsn\">[<a id=\"wvLnk\" href=\"#\" onclick=\"");
                output.Write("opnWin('WebReadyView.aspx?t=att&");
                output.Write(sanitizedHtmlString);
                output.Write("')\">");
                output.Write(SanitizedHtmlString.FromStringId(1547877601));
                output.Write("</a>]</span>");
            }
            output.Write("</span>");
        }
Beispiel #9
0
        internal static void RenderAttachmentLinkForItem(TextWriter output, AttachmentWellInfo attachmentInfoObject, Item item, string itemId, UserContext userContext, ArrayList previousAttachmentDisplayNames, AttachmentWell.AttachmentWellFlags flags, bool prependSemicolon = false)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (attachmentInfoObject == null)
            {
                throw new ArgumentNullException("attachmentInfoObject");
            }
            if (item == null)
            {
                throw new ArgumentNullException("item");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            SanitizedHtmlString value;
            bool flag;

            if ((attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.ForceSave || attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.Allow) && AttachmentWell.AttachmentWellFlags.RenderEmbeddedItem == (flags & AttachmentWell.AttachmentWellFlags.RenderEmbeddedItem))
            {
                string format = string.Empty;
                if (attachmentInfoObject.AttachmentLevel == AttachmentPolicy.Level.Allow)
                {
                    format = "<a id=\"{0}\" href=\"#\" onclick=\"{1}\" title=\"{2}\" oncontextmenu=\"return false;\">{3}</a>";
                }
                else
                {
                    format = "<a id=\"{0}\" href=\"#\" onclick=\"{1}\" title=\"{2}\">{3}</a>";
                }
                SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder = new SanitizingStringBuilder <OwaHtml>();
                sanitizingStringBuilder.Append("?ae=Item&t=");
                sanitizingStringBuilder.Append(Utilities.UrlEncode(item.ClassName));
                sanitizingStringBuilder.Append("&atttyp=embdd");
                if (ObjectClass.IsCalendarItemCalendarItemOccurrenceOrRecurrenceException(item.ClassName))
                {
                    sanitizingStringBuilder.Append("&a=Read");
                }
                SanitizingStringBuilder <OwaHtml> sanitizingStringBuilder2 = new SanitizingStringBuilder <OwaHtml>();
                if ((flags & AttachmentWell.AttachmentWellFlags.RenderReachedMaxEmbeddedDepth) == (AttachmentWell.AttachmentWellFlags) 0)
                {
                    sanitizingStringBuilder2.Append("return onClkEmbItem('");
                    sanitizingStringBuilder2.Append <SanitizedHtmlString>(sanitizingStringBuilder.ToSanitizedString <SanitizedHtmlString>());
                    sanitizingStringBuilder2.Append("','");
                    sanitizingStringBuilder2.Append(Utilities.UrlEncode(attachmentInfoObject.AttachmentId.ToBase64String()));
                    sanitizingStringBuilder2.Append("');");
                }
                else
                {
                    sanitizingStringBuilder2.Append("return alert(L_ErrRchMxEmbDpth)");
                }
                string embeddedAttachmentDisplayName = AttachmentUtility.GetEmbeddedAttachmentDisplayName(item);
                value = SanitizedHtmlString.Format(format, new object[]
                {
                    "lnkAtmt",
                    sanitizingStringBuilder2.ToSanitizedString <SanitizedHtmlString>(),
                    embeddedAttachmentDisplayName,
                    AttachmentUtility.TrimAttachmentDisplayName(embeddedAttachmentDisplayName, previousAttachmentDisplayNames, true)
                });
                flag = false;
            }
            else
            {
                value = Utilities.SanitizeHtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(AttachmentUtility.GetEmbeddedAttachmentDisplayName(item), previousAttachmentDisplayNames, true));
                flag  = true;
            }
            if (prependSemicolon)
            {
                output.Write("; ");
            }
            output.Write("<span id=\"spnAtmt\" tabindex=\"-1\" level=\"3\"");
            if (flag)
            {
                output.Write(" class=\"dsbl\"");
            }
            output.Write(">");
            output.Write("<img class=\"sI\" src=\"");
            SmallIconManager.RenderItemIconUrl(output, userContext, item.ClassName);
            output.Write("\" alt=\"\">");
            output.Write(value);
            output.Write("</span>");
        }
        internal static bool GetReminderItemsInternal(UserContext userContext, ExDateTime actualizationTime, TextWriter output)
        {
            bool            result = false;
            string          name   = userContext.UserCulture.Name;
            List <object[]> list   = RemindersRenderingUtilities.QueryReminders(actualizationTime, userContext);

            if (list.Count == 0)
            {
                return(false);
            }
            foreach (object[] reminder in list)
            {
                ExDateTime exDateTime  = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, ItemSchema.ReminderDueBy, ExDateTime.MinValue);
                ExDateTime exDateTime2 = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, ItemSchema.ReminderNextTime, ExDateTime.MinValue);
                if (!(exDateTime == ExDateTime.MinValue) && !(exDateTime2 == ExDateTime.MinValue) && !(exDateTime2 == RemindersRenderingUtilities.MaxOutlookDate))
                {
                    string itemProperty  = RemindersRenderingUtilities.GetItemProperty <string>(reminder, StoreObjectSchema.ItemClass, string.Empty);
                    bool   itemProperty2 = RemindersRenderingUtilities.GetItemProperty <bool>(reminder, MessageItemSchema.IsDraft, false);
                    int    itemProperty3 = RemindersRenderingUtilities.GetItemProperty <int>(reminder, MessageItemSchema.SwappedToDoStore, -1);
                    if (itemProperty.IndexOf("IPM.Schedule.Meeting", StringComparison.OrdinalIgnoreCase) == -1 && (itemProperty.IndexOf("IPM.Note", StringComparison.OrdinalIgnoreCase) == -1 || !itemProperty2) && itemProperty3 == -1)
                    {
                        ExDateTime itemProperty4 = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, CalendarItemInstanceSchema.StartTime, ExDateTime.MinValue);
                        ExDateTime itemProperty5 = RemindersRenderingUtilities.GetItemProperty <ExDateTime>(reminder, CalendarItemInstanceSchema.EndTime, ExDateTime.MinValue);
                        int        num           = (int)(itemProperty5 - itemProperty4).TotalMinutes;
                        if (num < 0)
                        {
                            num = 0;
                        }
                        bool        flag          = ObjectClass.IsCalendarItem(itemProperty);
                        VersionedId itemProperty6 = RemindersRenderingUtilities.GetItemProperty <VersionedId>(reminder, ItemSchema.Id);
                        bool        flag2         = false;
                        if (flag)
                        {
                            CalendarItemType itemProperty7 = RemindersRenderingUtilities.GetItemProperty <CalendarItemType>(reminder, CalendarItemBaseSchema.CalendarItemType, CalendarItemType.Single);
                            flag2 = (itemProperty7 == CalendarItemType.RecurringMaster);
                        }
                        VersionedId versionedId = null;
                        string      text;
                        string      text2;
                        if (flag2)
                        {
                            CalendarItemOccurrence calendarItemOccurrence = null;
                            Item item = null;
                            try
                            {
                                try
                                {
                                    item = Utilities.GetItem <Item>(userContext, itemProperty6.ObjectId, new PropertyDefinition[0]);
                                    if (item.Reminder != null)
                                    {
                                        calendarItemOccurrence = (item.Reminder.GetPertinentItem(actualizationTime) as CalendarItemOccurrence);
                                    }
                                    if (calendarItemOccurrence == null)
                                    {
                                        continue;
                                    }
                                    object obj  = calendarItemOccurrence.Reminder.DueBy;
                                    object obj2 = calendarItemOccurrence.Reminder.ReminderNextTime;
                                    if (obj == null || obj2 == null)
                                    {
                                        continue;
                                    }
                                    exDateTime2 = (ExDateTime)obj2;
                                    exDateTime  = (ExDateTime)obj;
                                    versionedId = calendarItemOccurrence.Id;
                                    text        = calendarItemOccurrence.Subject;
                                    text2       = calendarItemOccurrence.Location;
                                }
                                catch (StoragePermanentException ex)
                                {
                                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Unable to retrieve calendar item occurence for this reminder.  Exception: {0}", ex.Message);
                                    result = true;
                                    continue;
                                }
                                catch (StorageTransientException ex2)
                                {
                                    ExTraceGlobals.CalendarDataTracer.TraceDebug <string>(0L, "Unable to retrieve calendar item occurence for this reminder.  Exception: {0}", ex2.Message);
                                    result = true;
                                    continue;
                                }
                                goto IL_289;
                            }
                            finally
                            {
                                if (item != null)
                                {
                                    item.Dispose();
                                    item = null;
                                }
                                if (calendarItemOccurrence != null)
                                {
                                    calendarItemOccurrence.Dispose();
                                    calendarItemOccurrence = null;
                                }
                            }
                            goto IL_26D;
                        }
                        goto IL_26D;
IL_289:
                        using (StringWriter stringWriter = new StringWriter())
                        {
                            stringWriter.Write("<div _lnk=1 class=\"divNotificationsItem\" id=\"b");
                            Utilities.HtmlEncode(itemProperty6.ObjectId.ToBase64String(), stringWriter);
                            stringWriter.Write("\" ck=\"");
                            Utilities.HtmlEncode(itemProperty6.ChangeKeyAsBase64String(), stringWriter);
                            if (flag2)
                            {
                                stringWriter.Write("\" oid=\"");
                                Utilities.HtmlEncode(versionedId.ObjectId.ToBase64String(), stringWriter);
                            }
                            stringWriter.Write("\" t=\"");
                            Utilities.HtmlEncode(DateTimeUtilities.GetJavascriptDate(exDateTime), stringWriter);
                            stringWriter.Write("\" c=\"");
                            Utilities.HtmlEncode(itemProperty, stringWriter);
                            stringWriter.Write("\" r=\"");
                            Utilities.HtmlEncode(DateTimeUtilities.GetJavascriptDate(exDateTime2), stringWriter);
                            stringWriter.Write("\" d=\"");
                            stringWriter.Write(num);
                            SanitizedHtmlString sanitizedHtmlString = null;
                            if (!string.IsNullOrEmpty(text))
                            {
                                sanitizedHtmlString = Utilities.SanitizeHtmlEncode(text);
                            }
                            SanitizedHtmlString sanitizedHtmlString2 = null;
                            if (!string.IsNullOrEmpty(text2))
                            {
                                sanitizedHtmlString2 = Utilities.SanitizeHtmlEncode(text2);
                            }
                            stringWriter.Write("\" subj=\"");
                            stringWriter.Write(sanitizedHtmlString);
                            stringWriter.Write("\" loc=\"");
                            stringWriter.Write(sanitizedHtmlString2);
                            string text3 = string.Format(userContext.UserCulture, LocalizedStrings.GetHtmlEncodedFromKey(name, 580192567), new object[]
                            {
                                Utilities.HtmlEncode(exDateTime.ToString(DateTimeFormatInfo.CurrentInfo.LongDatePattern)),
                                Utilities.HtmlEncode(exDateTime.ToString(userContext.UserOptions.TimeFormat))
                            });
                            stringWriter.Write("\" due=\"");
                            stringWriter.Write(text3);
                            stringWriter.Write("\" tabindex=0>");
                            SmallIconManager.RenderItemIcon(stringWriter, userContext, itemProperty, false, -1, string.Empty, new string[]
                            {
                                "id=\"imgNtfyEnt\""
                            });
                            stringWriter.Write("<DIV id=\"c3\" class=\"divNotificationsColumn3\"><div id=\"c3Time\" class=\"divRemindersDueInTime\"></div><div id=\"c3Text\" class=\"divRemindersDueInText\"></div></div>");
                            stringWriter.Write("<DIV id=\"c2\" class=\"divNotificationsColumn2\"><div id=\"c2Time\" class=\"divRemindersDueInTime\"></div><div id=\"c2Text\" class=\"divRemindersDueInText\"></div></div>");
                            stringWriter.Write("<DIV id=\"c1\" class=\"divNotificationsColumn1\"><div id=\"c1Row1\" class=\"divNotificationsColumn1Row1\">{0}</div><div id=\"c1Row2\" class=\"divNotificationsColumn1Row2\">{1}</div>", (sanitizedHtmlString != null) ? sanitizedHtmlString.ToString() : string.Empty, text3);
                            if (sanitizedHtmlString2 != null)
                            {
                                stringWriter.Write("<div id=\"c1Row3\" class=\"divNotificationsColumn1Row3\">");
                                stringWriter.Write(sanitizedHtmlString2);
                                stringWriter.Write("</div>");
                            }
                            stringWriter.Write("</div></div>");
                            Utilities.JavascriptEncode(stringWriter.ToString(), output);
                        }
                        continue;
IL_26D:
                        text  = RemindersRenderingUtilities.GetItemProperty <string>(reminder, ItemSchema.Subject, null);
                        text2 = RemindersRenderingUtilities.GetItemProperty <string>(reminder, CalendarItemBaseSchema.Location, null);
                        goto IL_289;
                    }
                }
            }
            return(result);
        }
        // Token: 0x06001E1F RID: 7711 RVA: 0x000AE510 File Offset: 0x000AC710
        public static void RenderAttachments(TextWriter output, AttachmentWellType wellType, ArrayList attachmentList, UserContext userContext, bool isConversationAndIrmCopyRestricted)
        {
            if (output == null)
            {
                throw new ArgumentNullException("output");
            }
            if (userContext == null)
            {
                throw new ArgumentNullException("userContext");
            }
            if (attachmentList == null || attachmentList.Count <= 0)
            {
                return;
            }
            bool flag = true;

            Utilities.GetEmbeddedDepth(HttpContext.Current.Request);
            ArrayList previousAttachmentDisplayNames = new ArrayList();
            Item      item = null;

            try
            {
                foreach (object obj in attachmentList)
                {
                    AttachmentWellInfo attachmentWellInfo = (AttachmentWellInfo)obj;
                    AttachmentUtility.AttachmentLinkFlags attachmentLinkFlag = AttachmentUtility.GetAttachmentLinkFlag(wellType, attachmentWellInfo);
                    if (AttachmentUtility.AttachmentLinkFlags.Skip != (AttachmentUtility.AttachmentLinkFlags.Skip & attachmentLinkFlag))
                    {
                        ItemAttachment itemAttachment = null;
                        Item           item2          = null;
                        try
                        {
                            if (attachmentWellInfo.AttachmentType == AttachmentType.EmbeddedMessage)
                            {
                                if (attachmentWellInfo.MessageId != null)
                                {
                                    if (item != null)
                                    {
                                        StoreObjectId storeObjectId = StoreId.GetStoreObjectId(item.Id);
                                        if (!storeObjectId.Equals(attachmentWellInfo.MessageId.StoreObjectId))
                                        {
                                            item.Dispose();
                                            item = null;
                                        }
                                    }
                                    if (item == null)
                                    {
                                        item = Utilities.GetItem <Item>(userContext, attachmentWellInfo.MessageId, false, null);
                                    }
                                    AttachmentCollection attachmentCollection = item.AttachmentCollection;
                                    if (userContext.IsIrmEnabled && Utilities.IrmDecryptIfRestricted(item, userContext))
                                    {
                                        attachmentCollection = ((RightsManagedMessageItem)item).ProtectedAttachmentCollection;
                                    }
                                    itemAttachment = (ItemAttachment)attachmentCollection.Open(attachmentWellInfo.AttachmentId);
                                }
                                else
                                {
                                    itemAttachment = (ItemAttachment)attachmentWellInfo.OpenAttachment();
                                }
                                item2 = itemAttachment.GetItemAsReadOnly(new PropertyDefinition[]
                                {
                                    TaskSchema.TaskType
                                });
                            }
                            if (!flag)
                            {
                                output.Write("; ");
                            }
                            else
                            {
                                flag = false;
                            }
                            output.Write("<span id=spnAtmt tabindex=\"-1\" ");
                            if (wellType == AttachmentWellType.ReadOnly && AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink != (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink & attachmentLinkFlag))
                            {
                                output.Write("class=\"dsbl\"");
                            }
                            if (attachmentWellInfo.MessageId != null)
                            {
                                output.Write(" _sId=\"");
                                Utilities.SanitizeHtmlEncode(attachmentWellInfo.MessageId.ToString(), output);
                                output.Write("\"");
                            }
                            string text;
                            if (item2 != null)
                            {
                                text = AttachmentUtility.GetEmbeddedAttachmentDisplayName(item2);
                            }
                            else
                            {
                                text = attachmentWellInfo.AttachmentName;
                            }
                            output.Write(" _attid=\"");
                            output.Write(Utilities.SanitizeHtmlEncode(attachmentWellInfo.AttachmentId.ToBase64String()));
                            output.Write("\" _level=");
                            output.Write((int)attachmentWellInfo.AttachmentLevel);
                            output.Write(" _attname=\"");
                            output.Write(Utilities.SanitizeHtmlEncode(text));
                            output.Write("\" _attsize=\"");
                            output.Write(attachmentWellInfo.Size);
                            output.Write("\" _fIsItem=\"");
                            output.Write(item2 != null);
                            output.Write("\"");
                            if (attachmentWellInfo.AttachmentType != AttachmentType.EmbeddedMessage)
                            {
                                output.Write(" _protectable=\"");
                                bool flag2 = false;
                                try
                                {
                                    flag2 = ProtectorsManager.Instance.IsProtectorRegistered(attachmentWellInfo.FileExtension);
                                }
                                catch (AttachmentProtectionException)
                                {
                                }
                                output.Write(flag2 ? "1" : "0");
                                output.Write("\"");
                            }
                            if (item2 != null)
                            {
                                Task task = item2 as Task;
                                if ((task != null && !TaskUtilities.IsAssignedTask(task)) || item2 is Contact || item2 is DistributionList)
                                {
                                    output.Write(" _qs=\"ae=PreFormAction&a=OpenEmbedded&t=");
                                }
                                else
                                {
                                    output.Write(" _qs=\"ae=Item&t=");
                                }
                                Utilities.SanitizeHtmlEncode(Utilities.UrlEncode(item2.ClassName), output);
                                if (task != null && TaskUtilities.IsAssignedTask(task))
                                {
                                    output.Write("&s=Assigned");
                                }
                                output.Write("\"");
                            }
                            output.Write(">");
                            bool flag3 = AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink == (AttachmentUtility.AttachmentLinkFlags.AttachmentClickLink & attachmentLinkFlag);
                            if (flag3)
                            {
                                string text2 = null;
                                if (item2 != null || attachmentWellInfo.AttachmentLevel == AttachmentPolicy.Level.Allow)
                                {
                                    text2 = "3";
                                }
                                else if (attachmentWellInfo.AttachmentLevel == AttachmentPolicy.Level.ForceSave)
                                {
                                    text2 = "2";
                                }
                                if (text2 != null)
                                {
                                    output.Write("<a class=\"lnkClickAtmt\" id=\"lnkAtmt\" _fAllwCM=\"1\" href=\"#\" target=_blank ");
                                    Utilities.RenderScriptHandler(output, "onclick", string.Concat(new string[]
                                    {
                                        "atLnk(event, ",
                                        text2,
                                        ", ",
                                        isConversationAndIrmCopyRestricted ? "1" : "0",
                                        ");"
                                    }));
                                    output.Write(" title=\"");
                                    Utilities.SanitizeHtmlEncode(text, output);
                                    if (text2 == "3" & item2 != null)
                                    {
                                        output.Write("\" oncontextmenu=\"return false;");
                                    }
                                    output.Write("\">");
                                }
                            }
                            if (item2 != null)
                            {
                                SmallIconManager.RenderItemIcon(output, userContext, item2.ClassName, false, "sI", new string[0]);
                            }
                            else
                            {
                                string fileExtension = string.Empty;
                                if (attachmentWellInfo.FileExtension != null)
                                {
                                    fileExtension = attachmentWellInfo.FileExtension;
                                }
                                SmallIconManager.RenderFileIcon(output, userContext, fileExtension, "sI", new string[0]);
                            }
                            if (item2 != null)
                            {
                                Utilities.SanitizeHtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(text, previousAttachmentDisplayNames, true), output);
                            }
                            else
                            {
                                Utilities.SanitizeHtmlEncode(AttachmentUtility.TrimAttachmentDisplayName(text, previousAttachmentDisplayNames, false), output);
                                long size = attachmentWellInfo.Size;
                                if (size > 0L)
                                {
                                    output.Write(userContext.DirectionMark);
                                    output.Write(" ");
                                    output.Write(SanitizedHtmlString.FromStringId(6409762));
                                    Utilities.RenderSizeWithUnits(output, size, true);
                                    output.Write(userContext.DirectionMark);
                                    output.Write(SanitizedHtmlString.FromStringId(-1023695022));
                                }
                            }
                            if (flag3)
                            {
                                output.Write("</a>");
                            }
                            if (item2 == null && AttachmentUtility.AttachmentLinkFlags.OpenAsWebPageLink == (AttachmentUtility.AttachmentLinkFlags.OpenAsWebPageLink & attachmentLinkFlag))
                            {
                                AttachmentWell.RenderWebReadyLink(output, userContext);
                            }
                            if (wellType == AttachmentWellType.ReadWrite)
                            {
                                output.Write("<span class=\"delLnk\">");
                                userContext.RenderThemeImage(output, ThemeFileId.DeleteSmall, null, new object[]
                                {
                                    "id=delImg"
                                });
                                output.Write("</span>");
                            }
                            output.Write("</span>");
                        }
                        catch (ObjectNotFoundException)
                        {
                        }
                        catch (StorageTransientException)
                        {
                        }
                        finally
                        {
                            if (item2 != null)
                            {
                                item2.Dispose();
                                item2 = null;
                            }
                            if (itemAttachment != null)
                            {
                                itemAttachment.Dispose();
                                itemAttachment = null;
                            }
                        }
                    }
                }
            }
            finally
            {
                if (item != null)
                {
                    item.Dispose();
                    item = null;
                }
            }
        }