Exemplo n.º 1
0
        public static HowTo get_how_to(string s)
        {
            List <HowTo> list = new List <HowTo>();

            list = how_to();
            int   a    = 9999;
            HowTo temp = new HowTo();

            foreach (HowTo var in list)
            {
                int l = similar(var.getname(), s);
                if (l < a)
                {
                    a    = l;
                    temp = var;
                }
            }
            return(temp);
        }
Exemplo n.º 2
0
        public static List <HowTo> how_to()
        {
            List <HowTo> list = new List <HowTo>();
            HtmlWeb      hw   = new HtmlWeb();
            HtmlDocument doc  = hw.Load("https://wiki.metakgp.org/w/List_of_how-tos");

            foreach (HtmlNode link in doc.DocumentNode.SelectNodes("//a[@href]"))
            {
                if (link.InnerText.Length > 6)
                {
                    if (link.InnerText.Substring(0, 6).Equals("How to"))
                    {
                        HowTo temp = new HowTo();
                        temp.setname(link.InnerText);
                        temp.seturl(string.Concat("https://wiki.metakgp.org", link.GetAttributeValue("href", string.Empty)));
                        list.Add(temp);
                    }
                }
            }
            return(list);
        }