Пример #1
0
 private static bool TryParseKeyword(string rawStr, out StyleValueKeyword value)
 {
     if (StyleSheetImporterImpl.s_NameCache == null)
     {
         StyleSheetImporterImpl.s_NameCache = new Dictionary <string, StyleValueKeyword>();
         IEnumerator enumerator = Enum.GetValues(typeof(StyleValueKeyword)).GetEnumerator();
         try
         {
             while (enumerator.MoveNext())
             {
                 StyleValueKeyword value2 = (StyleValueKeyword)enumerator.Current;
                 StyleSheetImporterImpl.s_NameCache[value2.ToString().ToLower()] = value2;
             }
         }
         finally
         {
             IDisposable disposable;
             if ((disposable = (enumerator as IDisposable)) != null)
             {
                 disposable.Dispose();
             }
         }
     }
     return(StyleSheetImporterImpl.s_NameCache.TryGetValue(rawStr.ToLower(), out value));
 }
Пример #2
0
        public StyleBackground ReadStyleBackground(int index)
        {
            ImageSource        imageSource        = default(ImageSource);
            StylePropertyValue stylePropertyValue = this.m_Values[this.m_CurrentValueIndex + index];
            bool flag = stylePropertyValue.handle.valueType == StyleValueType.Keyword;

            if (flag)
            {
                bool flag2 = stylePropertyValue.handle.valueIndex != 6;
                if (flag2)
                {
                    string            arg_68_0   = "Invalid keyword for image source ";
                    StyleValueKeyword valueIndex = (StyleValueKeyword)stylePropertyValue.handle.valueIndex;
                    Debug.LogWarning(arg_68_0 + valueIndex.ToString());
                }
            }
            else
            {
                bool flag3 = !StylePropertyReader.TryGetImageSourceFromValue(stylePropertyValue, this.dpiScaling, out imageSource);
                if (flag3)
                {
                    imageSource.texture = (Panel.LoadResource("d_console.warnicon", typeof(Texture2D), this.dpiScaling) as Texture2D);
                }
            }
            bool            flag4 = imageSource.texture != null;
            StyleBackground result;

            if (flag4)
            {
                result = new StyleBackground(imageSource.texture);
            }
            else
            {
                bool flag5 = imageSource.vectorImage != null;
                if (flag5)
                {
                    result = new StyleBackground(imageSource.vectorImage);
                }
                else
                {
                    result = default(StyleBackground);
                }
            }
            return(result);
        }