private static void ParseCssFont(string originalStyleValue, Hashtable localProperties)
        {
            string text = originalStyleValue.ToLower();
            int    num  = 0;

            HtmlCssParser.ParseCssFontStyle(text, ref num, localProperties);
            HtmlCssParser.ParseCssFontVariant(text, ref num, localProperties);
            HtmlCssParser.ParseCssFontWeight(text, ref num, localProperties);
            HtmlCssParser.ParseCssSize(text, ref num, localProperties, "font-size", true);
            HtmlCssParser.ParseWhiteSpace(text, ref num);
            if (num < text.Length && text[num] == '/')
            {
                num++;
                HtmlCssParser.ParseCssSize(text, ref num, localProperties, "line-height", true);
            }
            HtmlCssParser.ParseCssFontFamily(originalStyleValue, ref num, localProperties);
        }
 private static bool ParseWord(string word, string styleValue, ref int nextIndex)
 {
     HtmlCssParser.ParseWhiteSpace(styleValue, ref nextIndex);
     for (int i = 0; i < word.Length; i++)
     {
         if (nextIndex + i >= styleValue.Length || word[i] != styleValue[nextIndex + i])
         {
             return(false);
         }
     }
     if (nextIndex + word.Length < styleValue.Length && char.IsLetterOrDigit(styleValue[nextIndex + word.Length]))
     {
         return(false);
     }
     nextIndex += word.Length;
     return(true);
 }
        private static string ParseCssSize(string styleValue, ref int nextIndex, bool mustBeNonNegative)
        {
            HtmlCssParser.ParseWhiteSpace(styleValue, ref nextIndex);
            int num = nextIndex;

            if (nextIndex < styleValue.Length && styleValue[nextIndex] == '-')
            {
                nextIndex++;
            }
            if (nextIndex < styleValue.Length)
            {
                if (!char.IsDigit(styleValue[nextIndex]))
                {
                    if (styleValue[nextIndex] != '.')
                    {
                        goto IL_EB;
                    }
                }
                while (nextIndex < styleValue.Length && (char.IsDigit(styleValue[nextIndex]) || styleValue[nextIndex] == '.'))
                {
                    nextIndex++;
                }
                string str = styleValue.Substring(num, nextIndex - num);
                if ((nextIndex > 0 && styleValue[nextIndex - 1] == '.') || (nextIndex < styleValue.Length && styleValue[nextIndex] == ','))
                {
                    str = "0";
                }
                string text = HtmlCssParser.ParseWordEnumeration(HtmlCssParser._fontSizeUnits, styleValue, ref nextIndex);
                if (text == null)
                {
                    text = "px";
                }
                if (mustBeNonNegative && styleValue[num] == '-')
                {
                    return("0");
                }
                return(str + text);
            }
IL_EB:
            return(null);
        }
        private static void ParseCssFontFamily(string styleValue, ref int nextIndex, Hashtable localProperties)
        {
            string text = null;

            while (nextIndex < styleValue.Length)
            {
                string text2 = HtmlCssParser.ParseWordEnumeration(HtmlCssParser._fontGenericFamilies, styleValue, ref nextIndex);
                if (text2 == null)
                {
                    if (nextIndex < styleValue.Length && (styleValue[nextIndex] == '"' || styleValue[nextIndex] == '\''))
                    {
                        char c = styleValue[nextIndex];
                        nextIndex++;
                        int num = nextIndex;
                        while (nextIndex < styleValue.Length && styleValue[nextIndex] != c)
                        {
                            nextIndex++;
                        }
                        text2 = '"' + styleValue.Substring(num, nextIndex - num) + '"';
                        nextIndex++;
                    }
                    if (text2 == null)
                    {
                        int num2 = nextIndex;
                        while (nextIndex < styleValue.Length && styleValue[nextIndex] != ',' && styleValue[nextIndex] != ';')
                        {
                            nextIndex++;
                        }
                        if (nextIndex > num2)
                        {
                            text2 = styleValue.Substring(num2, nextIndex - num2).Trim();
                            if (text2.Length == 0)
                            {
                                text2 = null;
                            }
                        }
                    }
                }
                HtmlCssParser.ParseWhiteSpace(styleValue, ref nextIndex);
                if (nextIndex < styleValue.Length && styleValue[nextIndex] == ',')
                {
                    nextIndex++;
                }
                if (text2 == null)
                {
                    break;
                }
                if (text == null && text2.Length > 0)
                {
                    if (text2[0] == '"' || text2[0] == '\'')
                    {
                        text2 = text2.Substring(1, text2.Length - 2);
                    }
                    text = text2;
                }
            }
            if (text != null)
            {
                localProperties["font-family"] = text;
            }
        }
        private static string ParseCssColor(string styleValue, ref int nextIndex)
        {
            HtmlCssParser.ParseWhiteSpace(styleValue, ref nextIndex);
            string text = null;

            if (nextIndex < styleValue.Length)
            {
                int  num = nextIndex;
                char c   = styleValue[nextIndex];
                if (c == '#')
                {
                    for (nextIndex++; nextIndex < styleValue.Length; nextIndex++)
                    {
                        c = char.ToUpper(styleValue[nextIndex]);
                        if (('0' > c || c > '9') && ('A' > c || c > 'F'))
                        {
                            break;
                        }
                    }
                    if (nextIndex > num + 1)
                    {
                        text = styleValue.Substring(num, nextIndex - num);
                    }
                }
                else
                {
                    if (styleValue.Substring(nextIndex, 3).ToLower() == "rgb")
                    {
                        text = "gray";
                        while (nextIndex < styleValue.Length && styleValue[nextIndex] != ')')
                        {
                            nextIndex++;
                        }
                        if (nextIndex < styleValue.Length)
                        {
                            nextIndex++;
                        }
                        Match match = HtmlCssParser.regexRGB.Match(styleValue);
                        if (match.Success)
                        {
                            int num2 = 128;
                            int num3 = 128;
                            int num4 = 128;
                            if (int.TryParse(match.Groups["red"].ToString(), out num2) && int.TryParse(match.Groups["green"].ToString(), out num3) && int.TryParse(match.Groups["blue"].ToString(), out num4))
                            {
                                text = string.Format("#{0:X2}{1:X2}{2:X2}", num2, num3, num4);
                            }
                        }
                        else
                        {
                            match = HtmlCssParser.regexRGBA.Match(styleValue);
                            if (match.Success)
                            {
                                int    num5 = 128;
                                int    num6 = 128;
                                int    num7 = 128;
                                double num8 = 1.0;
                                if (int.TryParse(match.Groups["red"].ToString(), out num5) && int.TryParse(match.Groups["green"].ToString(), out num6) && int.TryParse(match.Groups["blue"].ToString(), out num7) && double.TryParse(match.Groups["alpha"].ToString(), out num8))
                                {
                                    text = string.Format("#{3:X2}{0:X2}{1:X2}{2:X2}", new object[]
                                    {
                                        num5,
                                        num6,
                                        num7,
                                        Math.Max(255, (int)(num8 * 255.0))
                                    });
                                }
                            }
                        }
                    }
                    else
                    {
                        if (char.IsLetter(c))
                        {
                            text = HtmlCssParser.ParseWordEnumeration(HtmlCssParser._colors, styleValue, ref nextIndex);
                            if (text == null)
                            {
                                text = HtmlCssParser.ParseWordEnumeration(HtmlCssParser._systemColors, styleValue, ref nextIndex);
                                if (text != null)
                                {
                                    text = "black";
                                }
                            }
                        }
                    }
                }
            }
            return(text);
        }