Esempio n. 1
0
        private static SmallIconManager.SmallIcon PrefixMatchLookupSmallIcon(string itemClass, int iconFlag)
        {
            ExTraceGlobals.SmallIconCallTracer.TraceDebug <string, int>(0L, "PrefixMatchLookupSmallIcon: ItemClass = '{0}', IconFlag = '{1}'", itemClass, iconFlag);
            Dictionary <string, SmallIconManager.SmallIcon> dictionary = null;

            if (!SmallIconManager.prefixMatchSmallIconTable.TryGetValue(iconFlag, out dictionary))
            {
                ExTraceGlobals.SmallIconTracer.TraceDebug <int>(0L, "Can not find IconFlag from the prefixMatchSmallIconTable: IconFlag = '{0}'", iconFlag);
                return(null);
            }
            if (dictionary.ContainsKey(itemClass))
            {
                SmallIconManager.SmallIcon smallIcon = dictionary[itemClass];
                ExTraceGlobals.SmallIconTracer.TraceDebug <string, int, Strings.IDs>(0L, "Found exact match of ItemClass: ItemClass = '{0}', ThemeFileIndex = '{1}', Alt = '{2}'", itemClass, smallIcon.ThemeId, smallIcon.AltId);
                return(smallIcon);
            }
            foreach (string text in dictionary.Keys)
            {
                if (string.Compare(text, 0, itemClass, 0, text.Length, StringComparison.OrdinalIgnoreCase) == 0)
                {
                    SmallIconManager.SmallIcon smallIcon2 = dictionary[text];
                    ExTraceGlobals.SmallIconTracer.TraceDebug <string, int, Strings.IDs>(0L, "Found prefix match of ItemClass: ItemClass = '{0}', ThemeFileIndex = '{1}', Alt = '{2}'", itemClass, smallIcon2.ThemeId, smallIcon2.AltId);
                    return(smallIcon2);
                }
            }
            return(null);
        }
Esempio n. 2
0
 private static SmallIconManager.SmallIcon GetFileSmallIcon(UserContext userContext, string fileExtension, int iconFlag)
 {
     SmallIconManager.SmallIcon smallIcon = SmallIconManager.LookupSmallIcon(fileExtension, iconFlag);
     if (smallIcon == null)
     {
         smallIcon = new SmallIconManager.SmallIcon(129, -1018465893);
     }
     return(smallIcon);
 }
Esempio n. 3
0
 public static SmallIconManager.SmallIcon GetItemSmallIcon(string itemClass, string defaultItemClass, bool isInConflict, bool isRead, int iconFlag)
 {
     if (isInConflict)
     {
         return(new SmallIconManager.SmallIcon(82, -1240042979));
     }
     if (!EnumValidator.IsValidValue <IconIndex>((IconIndex)iconFlag))
     {
         iconFlag = -1;
     }
     if (iconFlag == -1 && isRead)
     {
         iconFlag = 256;
     }
     else if (iconFlag == 306 && isRead)
     {
         iconFlag = 256;
     }
     SmallIconManager.SmallIcon smallIcon = SmallIconManager.LookupSmallIcon(itemClass, iconFlag);
     if (smallIcon == null && iconFlag == 256)
     {
         iconFlag  = -1;
         smallIcon = SmallIconManager.LookupSmallIcon(itemClass, iconFlag);
     }
     if (iconFlag == -1 && isRead && smallIcon == null)
     {
         smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(itemClass, 256);
     }
     if (smallIcon == null)
     {
         smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(itemClass, iconFlag);
     }
     if (smallIcon == null)
     {
         smallIcon = SmallIconManager.LookupSmallIcon(itemClass, -1);
     }
     if (smallIcon == null && defaultItemClass != null)
     {
         smallIcon = SmallIconManager.LookupSmallIcon(defaultItemClass, iconFlag);
     }
     if (smallIcon == null && defaultItemClass != null)
     {
         smallIcon = SmallIconManager.PrefixMatchLookupSmallIcon(defaultItemClass, iconFlag);
     }
     if (smallIcon == null && (iconFlag == 261 || iconFlag == 262))
     {
         smallIcon = SmallIconManager.LookupSmallIcon("IPM.Note", iconFlag);
     }
     if (smallIcon == null)
     {
         smallIcon = (isRead ? new SmallIconManager.SmallIcon(132, -1075414859) : new SmallIconManager.SmallIcon(133, -1679159840));
     }
     return(smallIcon);
 }
Esempio n. 4
0
        private static SmallIconManager.SmallIcon LookupSmallIcon(string itemClass, int iconFlag)
        {
            ExTraceGlobals.SmallIconCallTracer.TraceDebug <string, int>(0L, "LookupSmallIcon: ItemClass = '{0}', IconFlag = '{1}'", itemClass, iconFlag);
            Dictionary <string, SmallIconManager.SmallIcon> dictionary = null;

            if (SmallIconManager.smallIconTable.TryGetValue(iconFlag, out dictionary) && dictionary.ContainsKey(itemClass))
            {
                SmallIconManager.SmallIcon smallIcon = dictionary[itemClass];
                ExTraceGlobals.SmallIconTracer.TraceDebug <string, int, Strings.IDs>(0L, "Found exact match of ItemClass: ItemClass = '{0}', ThemeFileIndex = '{1}', Alt = {2}", itemClass, smallIcon.ThemeId, smallIcon.AltId);
                return(smallIcon);
            }
            return(null);
        }
Esempio n. 5
0
 internal static void RenderIcon(TextWriter writer, UserContext userContext, SmallIconManager.SmallIcon smallIcon, bool showTooltip, string styleClass, params string[] extraAttributes)
 {
     if (smallIcon.IsCustom)
     {
         writer.Write("<img src=\"");
         writer.Write(smallIcon.CustomUrl);
         writer.Write("\"");
         foreach (string value in extraAttributes)
         {
             writer.Write(" ");
             writer.Write(value);
         }
         writer.Write(">");
         return;
     }
     if (showTooltip)
     {
         userContext.RenderThemeImageWithToolTip(writer, (ThemeFileId)smallIcon.ThemeId, null, smallIcon.AltId, extraAttributes);
         return;
     }
     userContext.RenderThemeImage(writer, (ThemeFileId)smallIcon.ThemeId, null, extraAttributes);
 }
Esempio n. 6
0
 private static void RenderIconUrl(TextWriter writer, UserContext userContext, SmallIconManager.SmallIcon smallIcon)
 {
     if (smallIcon.IsCustom)
     {
         writer.Write(smallIcon.CustomUrl);
         return;
     }
     userContext.RenderThemeFileUrl(writer, smallIcon.ThemeId);
 }
Esempio n. 7
0
        private static void ParseMappingElement(XmlTextReader xmlTextReader, string folderName, StringBuilder invalidAltIds, Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > prefixIconTable, Dictionary <int, Dictionary <string, SmallIconManager.SmallIcon> > iconTable)
        {
            ExTraceGlobals.SmallIconCallTracer.TraceDebug(0L, "ParseMappingElement");
            string text  = null;
            int    num   = -1;
            string text2 = null;
            bool   flag  = false;

            Strings.IDs ds = -1018465893;
            if (xmlTextReader.MoveToAttribute(xmlTextReader.NameTable.Get("ItemClass")))
            {
                text = xmlTextReader.Value;
            }
            if (xmlTextReader.MoveToAttribute(xmlTextReader.NameTable.Get("SmallIcon")))
            {
                text2 = xmlTextReader.Value;
            }
            if (string.IsNullOrEmpty(text) || string.IsNullOrEmpty(text2))
            {
                ExTraceGlobals.SmallIconTracer.TraceDebug <string, string>(0L, "Either ItemClass:'{0}' or SmallIcon:'{1}' is not valid.", text, text2);
                return;
            }
            if (xmlTextReader.MoveToAttribute(xmlTextReader.NameTable.Get("IconFlag")))
            {
                string value = xmlTextReader.Value;
                try
                {
                    num = (int)Enum.Parse(typeof(IconIndex), value, true);
                    goto IL_C9;
                }
                catch (ArgumentException)
                {
                    num = value.GetHashCode();
                    goto IL_C9;
                }
            }
            num = -1;
IL_C9:
            flag = (xmlTextReader.MoveToAttribute(xmlTextReader.NameTable.Get("PrefixMatch")) && string.Equals(xmlTextReader.Value, "true", StringComparison.OrdinalIgnoreCase));
            if (xmlTextReader.MoveToAttribute(xmlTextReader.NameTable.Get("Alt")))
            {
                string value2 = xmlTextReader.Value;
                try
                {
                    ds = (Strings.IDs)Enum.Parse(typeof(Strings.IDs), value2, true);
                    goto IL_160;
                }
                catch (ArgumentException)
                {
                    if (invalidAltIds.Length != 0)
                    {
                        invalidAltIds.Append(",");
                    }
                    invalidAltIds.Append(value2);
                    ds = -1018465893;
                    goto IL_160;
                }
            }
            ds = -1018465893;
IL_160:
            SmallIconManager.SmallIcon smallIcon = (folderName == null) ? new SmallIconManager.SmallIcon(ThemeFileList.Add(text2, true), ds) : new SmallIconManager.SmallIcon(OwaUrl.ApplicationRoot.ImplicitUrl + folderName + text2, ds);
            if (flag)
            {
                if (!prefixIconTable.ContainsKey(num))
                {
                    prefixIconTable[num] = new Dictionary <string, SmallIconManager.SmallIcon>(StringComparer.OrdinalIgnoreCase);
                }
                prefixIconTable[num][text] = smallIcon;
            }
            else
            {
                if (!iconTable.ContainsKey(num))
                {
                    iconTable[num] = new Dictionary <string, SmallIconManager.SmallIcon>(StringComparer.OrdinalIgnoreCase);
                }
                iconTable[num][text] = smallIcon;
            }
            ExTraceGlobals.SmallIconDataTracer.TraceDebug(0L, "Add {0}PrefixMatch mapping: IconFlag = '{1}', ItemClass = '{2}' or SmallIcon:'{3}', Alt:'{4}'.", new object[]
            {
                flag?string.Empty: "Non-",
                num,
                text,
                (folderName == null) ? ("Index " + smallIcon.ThemeId) : text2,
                ds
            });
        }
Esempio n. 8
0
 internal static void RenderFileIconUrl(TextWriter writer, UserContext userContext, string fileExtension, int iconFlag)
 {
     SmallIconManager.SmallIcon fileSmallIcon = SmallIconManager.GetFileSmallIcon(userContext, fileExtension, iconFlag);
     SmallIconManager.RenderIconUrl(writer, userContext, fileSmallIcon);
 }
Esempio n. 9
0
 internal static void RenderFileIcon(TextWriter writer, UserContext userContext, string fileExtension, int iconFlag, bool showTooltip, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.SmallIcon fileSmallIcon = SmallIconManager.GetFileSmallIcon(userContext, fileExtension, iconFlag);
     SmallIconManager.RenderIcon(writer, userContext, fileSmallIcon, showTooltip, styleClass, extraAttributes);
 }
Esempio n. 10
0
 internal static void RenderFolderIcon(TextWriter writer, UserContext userContext, string containerClass, FolderSharingFlag sharingFlag, bool showTooltip, params string[] extraAttributes)
 {
     SmallIconManager.SmallIcon folderSmallIcon = SmallIconManager.GetFolderSmallIcon(userContext, containerClass, sharingFlag);
     SmallIconManager.RenderIcon(writer, userContext, folderSmallIcon, showTooltip, string.Empty, extraAttributes);
 }
Esempio n. 11
0
 internal static void RenderFolderIconUrl(TextWriter writer, UserContext userContext, string containerClass, FolderSharingFlag sharingFlag)
 {
     SmallIconManager.SmallIcon folderSmallIcon = SmallIconManager.GetFolderSmallIcon(userContext, containerClass, sharingFlag);
     SmallIconManager.RenderIconUrl(writer, userContext, folderSmallIcon);
 }
Esempio n. 12
0
 internal static void RenderItemIcon(TextWriter writer, UserContext userContext, string itemClass, bool showTooltip, string defaultItemClass, bool isInConflict, bool isRead, int iconFlag, string styleClass, params string[] extraAttributes)
 {
     SmallIconManager.SmallIcon itemSmallIcon = SmallIconManager.GetItemSmallIcon(itemClass, defaultItemClass, isInConflict, isRead, iconFlag);
     SmallIconManager.RenderIcon(writer, userContext, itemSmallIcon, showTooltip, styleClass, extraAttributes);
 }
Esempio n. 13
0
 internal static void RenderItemIconUrl(TextWriter writer, UserContext userContext, string itemClass, string defaultItemClass, bool isInConflict, bool isRead, int iconFlag)
 {
     SmallIconManager.SmallIcon itemSmallIcon = SmallIconManager.GetItemSmallIcon(itemClass, defaultItemClass, isInConflict, isRead, iconFlag);
     SmallIconManager.RenderIconUrl(writer, userContext, itemSmallIcon);
 }