Пример #1
0
 private void da(string A_0)
 {
     string[] strArray = A_0.Split(new char[1]
     {
         '}'
     });
     for (int index = 0; index < strArray.Length - 1; ++index)
     {
         string text    = strArray[index].Substring(0, strArray[index].IndexOf('{')).ToLower();
         string style   = strArray[index].Substring(strArray[index].IndexOf('{') + 1);
         string forstr1 = HTMLTree.GetCleanText(text);
         if (forstr1.IndexOf('.') > 0)
         {
             string forstr2 = forstr1.IndexOf('.') != 1 ? forstr1.Substring(forstr1.IndexOf(".") + 1) : (forstr1.IndexOf(" ") <= 0 ? forstr1.Substring(1) : forstr1.Substring(1, forstr1.IndexOf(" ") - 1));
             this.ParseStyleString(style, CssType.ForClass, forstr2);
         }
         else
         {
             if (forstr1.IndexOf(",") > 0)
             {
                 forstr1 = "," + forstr1 + ",";
             }
             this.ParseStyleString(style, CssType.ForTag, forstr1);
         }
     }
 }
Пример #2
0
 public async Task ParseCss(Params param)
 {
     if (this.g == null)
     {
         this.g = new Csss();
     }
     else if (this.d.Equals("link"))
     {
         Param  obj = this.Param.ByName("href");
         string url = "";
         if (obj != null)
         {
             url = obj.Value.Trim();
         }
         if (!(url != ""))
         {
             return;
         }
         try
         {
             this.da(new StreamReader(await NetHelper.Get(url)).ReadToEnd());
             this.d = "style";
         }
         catch
         {
         }
     }
     else
     {
         for (int index = 0; index < param.Count; ++index)
         {
             if (param[index].Name.ToLower().Equals("style"))
             {
                 this.ParseStyleString(param[index].Value.ToLower(), CssType.ForAll, "");
             }
             else if (HTMLTree.IsCss2(param[index].Name))
             {
                 this.g.SetNameValue(param[index].Name.ToLower(), param[index].Value.ToLower(), CssType.ForAll, "");
             }
         }
     }
 }
Пример #3
0
        public void ParseStyleString(string style, CssType type, string forstr)
        {
            string str1 = style;

            char[] chArray = new char[1]
            {
                ';'
            };
            foreach (string str2 in str1.Split(chArray))
            {
                string str3   = str2.Replace("\n", "").Trim();
                int    length = str3.IndexOf(":");
                if (length != -1)
                {
                    string str4 = str3.Substring(0, length).Trim();
                    if (HTMLTree.IsCss2(str4))
                    {
                        this.g.SetNameValue(str4, str3.Substring(length + 1).Trim(), type, forstr);
                    }
                }
            }
        }
Пример #4
0
        public HTMLForm(HTMLNode node)
        {
            Param param;

            this.d = 20;
            this.a = HTMLTree.FieldType(node);
            if (this.a == FormFieldType.Form)
            {
                param = node.Param.ByName("action");
            }
            else
            {
                param = node.Param.ByName("value");
            }
            if (param != null)
            {
                this.b = param.Value;
            }
            else
            {
                this.b = "";
            }
            param = node.Param.ByName("name");
            if (param != null)
            {
                this.c = param.Value;
            }
            else
            {
                this.c = "";
            }
            if (this.a == FormFieldType.TextArea)
            {
                param = node.Param.ByName("row");
                if (param != null)
                {
                    this.e = HTMLTree.FontSizeFromHTML(param.Value);
                }
                else
                {
                    this.e = 2;
                }
                param = node.Param.ByName("col");
                if (param != null)
                {
                    this.d = HTMLTree.FontSizeFromHTML(param.Value);
                }
            }
            if ((this.a == FormFieldType.Text) || (this.a == FormFieldType.Password))
            {
                param = node.Param.ByName("size");
                if (param != null)
                {
                    this.d = HTMLTree.FontSizeFromHTML(param.Value);
                }
            }
            if (((this.a == FormFieldType.Text) || (this.a == FormFieldType.Password)) || (this.a == FormFieldType.Select))
            {
                int num = node.Css.Css.IndexOf("width", CssType.ForAll, "");
                if (num != -1)
                {
                    this.f = HTMLTree.FontSizeFromHTML(node.Css.Css[num].Value);
                }
                else
                {
                    this.f = this.d * 15;
                }
            }
        }