Beispiel #1
0
        // Token: 0x060014B8 RID: 5304 RVA: 0x0007E554 File Offset: 0x0007C754
        public static void RenderThemePreviewUrl(TextWriter writer, string themeStorageId)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            bool flag            = false;
            uint idFromStorageId = ThemeManager.GetIdFromStorageId(themeStorageId);

            if (idFromStorageId != 4294967295U)
            {
                Theme theme = ThemeManager.themes[(int)((UIntPtr)idFromStorageId)];
                flag = theme.IsFileInTheme(23);
                if (flag)
                {
                    ThemeManager.RenderThemeFilePath(writer, ThemeManager.GetIdFromStorageId(themeStorageId), 23);
                    writer.Write(ThemeFileList.GetNameFromId(23));
                }
            }
            if (!flag)
            {
                ThemeManager.RenderThemeFilePath(writer, ThemeManager.baseTheme.Id, 22);
                writer.Write(ThemeFileList.GetNameFromId(22));
            }
        }
Beispiel #2
0
        // Token: 0x060014B7 RID: 5303 RVA: 0x0007E4B4 File Offset: 0x0007C6B4
        private static bool RenderThemeFilePath(TextWriter writer, uint themeId, int themeFileIndex, bool isBasicExperience, bool useCDN)
        {
            if (writer == null)
            {
                throw new ArgumentNullException("writer");
            }
            if (themeId == 4294967295U)
            {
                return(false);
            }
            Theme theme = ThemeManager.themes[(int)((UIntPtr)themeId)];

            if (useCDN && !string.IsNullOrEmpty(Globals.ContentDeliveryNetworkEndpoint) && ThemeManager.CheckFileExtensionsForCDN(ThemeFileList.GetNameFromId(themeFileIndex)))
            {
                writer.Write(Globals.ContentDeliveryNetworkEndpoint);
            }
            writer.Write(ThemeManager.themesFolderPath);
            bool flag = ThemeFileList.IsResourceFile(themeFileIndex);

            if (flag)
            {
                writer.Write(ThemeManager.ResourcesFolderName);
            }
            else if (isBasicExperience)
            {
                writer.Write(ThemeManager.BasicFilesFolderName);
            }
            else
            {
                writer.Write(theme.FolderName);
            }
            writer.Write("/");
            return(!flag);
        }
Beispiel #3
0
 // Token: 0x060000A7 RID: 167 RVA: 0x00004A9F File Offset: 0x00002C9F
 public static void RenderThemeFileUrl(TextWriter writer, int themeFileIndex, bool isBasicExperience, bool useCDN)
 {
     if (writer == null)
     {
         throw new ArgumentNullException("writer");
     }
     ThemeManager.RenderThemeFilePath(writer, themeFileIndex, isBasicExperience, useCDN);
     writer.Write(ThemeFileList.GetNameFromId(themeFileIndex));
 }
Beispiel #4
0
        private string InternalGetThemeFileClass(ThemeFileId themeFileId)
        {
            string        classNameFromId = ThemeFileList.GetClassNameFromId((int)themeFileId);
            StringBuilder stringBuilder   = new StringBuilder(classNameFromId.Length + 16);

            stringBuilder.Append("csimgbg");
            stringBuilder.Append(" ");
            stringBuilder.Append(classNameFromId);
            return(stringBuilder.ToString());
        }
Beispiel #5
0
        internal bool IsFileInTheme(int themeFileIndex)
        {
            if (this.themeFileTable.ContainsKey(themeFileIndex))
            {
                return(this.themeFileTable[themeFileIndex]);
            }
            string nameFromId = ThemeFileList.GetNameFromId(themeFileIndex);
            bool   flag       = File.Exists(Path.Combine(this.folderPath, nameFromId));

            this.themeFileTable[themeFileIndex] = flag;
            return(flag);
        }
Beispiel #6
0
        // Token: 0x060000A8 RID: 168 RVA: 0x00004AC8 File Offset: 0x00002CC8
        private static bool RenderThemeFilePath(TextWriter writer, int themeFileIndex, bool isBasicExperience, bool useCDN)
        {
            writer.Write(ThemeManager.themesFolderPath);
            bool flag = ThemeFileList.IsResourceFile(themeFileIndex);

            if (flag)
            {
                writer.Write(ThemeManager.ResourcesFolderName);
            }
            else if (isBasicExperience)
            {
                writer.Write(ThemeManager.BasicFilesFolderName);
            }
            else
            {
                writer.Write(ThemeManager.BaseThemeFolderName);
            }
            writer.Write("/");
            return(!flag);
        }
Beispiel #7
0
 internal static bool IsResourceFile(ThemeFileId themeFileId)
 {
     return(ThemeFileList.IsResourceFile((int)themeFileId));
 }
Beispiel #8
0
 internal static bool CanUseCssSprites(ThemeFileId themeFileId)
 {
     return(ThemeFileList.CanUseCssSprites((int)themeFileId));
 }
Beispiel #9
0
 private bool InternalShouldUseCssSprites(ThemeFileId themeFileId)
 {
     return(ThemeFileList.CanUseCssSprites(themeFileId) && (this.IsFileInTheme(ThemeFileId.CssSpritesCss) || !this.IsFileInTheme(themeFileId)));
 }
Beispiel #10
0
        private void Load(string folderPath)
        {
            ExTraceGlobals.ThemesCallTracer.TraceDebug <string>(0L, "Theme.Load. folderPath={0}", folderPath);
            string text = Path.Combine(folderPath, "themeinfo.xml");

            this.folderName = Path.GetFileNameWithoutExtension(folderPath);
            this.folderPath = folderPath;
            string text2 = null;

            Strings.IDs ds       = -1018465893;
            int         maxValue = int.MaxValue;

            if (File.Exists(text))
            {
                Theme.ParseThemeInfoFile(text, this.folderName, out text2, out ds, out maxValue);
            }
            if (text2 != null)
            {
                this.displayName = text2;
            }
            else
            {
                this.displayName = this.folderName;
            }
            this.localizedDisplayName = ds;
            this.sortOrder            = maxValue;
            if (string.Equals(this.folderName, ThemeManager.BaseThemeFolderName, StringComparison.OrdinalIgnoreCase))
            {
                this.isBase = true;
            }
            this.themeFileTable = new Dictionary <int, bool>(ThemeFileList.Count);
            for (int i = 0; i < ThemeFileList.Count; i++)
            {
                this.themeFileTable[i] = false;
            }
            string[] array = null;
            try
            {
                array = Directory.GetFiles(folderPath);
            }
            catch (Exception ex)
            {
                ExTraceGlobals.ThemesTracer.TraceDebug <Exception, string>(0L, "Exception thrown by Directory.GetFiles. {0}. Callstack = {1}", ex, ex.StackTrace);
                throw;
            }
            ExTraceGlobals.ThemesTracer.TraceDebug <int, string>(0L, "Inspecting {0} files in theme folder '{1}'", array.Length, this.folderName);
            for (int j = 0; j < array.Length; j++)
            {
                string fileName = Path.GetFileName(array[j]);
                if (!string.IsNullOrEmpty(fileName))
                {
                    int idFromName = ThemeFileList.GetIdFromName(fileName);
                    if (idFromName == 0)
                    {
                        ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Skipping unknown file '{0}'", fileName);
                    }
                    else
                    {
                        ExTraceGlobals.ThemesTracer.TraceDebug <string>(0L, "Succesfully added theme file '{0}'", fileName);
                        this.themeFileTable[idFromName] = true;
                    }
                }
            }
            this.url = ThemeManager.ThemesFolderPath + this.folderName + "/";
        }
Beispiel #11
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
            });
        }
Beispiel #12
0
        // Token: 0x06000055 RID: 85 RVA: 0x000034EC File Offset: 0x000016EC
        protected string InlineCss(ThemeFileId themeFileId)
        {
            string nameFromId = ThemeFileList.GetNameFromId(themeFileId);

            return(this.InlineCss(nameFromId));
        }
Beispiel #13
0
        // Token: 0x06000054 RID: 84 RVA: 0x000034A8 File Offset: 0x000016A8
        protected string InlineImage(ThemeFileId themeFileId)
        {
            string fileName = ThemeFileList.GetNameFromId(themeFileId);

            return(this.InlineResource(fileName, "themes\\resources", (string fullFilePath) => "data:" + MimeMapping.GetMimeMapping(fileName) + ";base64," + Convert.ToBase64String(File.ReadAllBytes(fullFilePath)), OwaPage.inlineImages));
        }