예제 #1
0
        private static List <string> FindSearchLinks(FireFox browser)
        {
            ElementCollection elementCollection = browser.ElementsWithTag("h3", (string[])null);

            // ISSUE: reference to a compiler-generated field
            if (Program.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate1 == null)
            {
                // ISSUE: reference to a compiler-generated field
                // ISSUE: method pointer
                Program.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate1 = new Func <Element, bool>((object)null, __methodptr(\u003CFindSearchLinks\u003Eb__0));
            }
            // ISSUE: reference to a compiler-generated field
            Func <Element, bool>  anonymousMethodDelegate1 = Program.CS\u0024\u003C\u003E9__CachedAnonymousMethodDelegate1;
            IEnumerable <Element> elements   = (IEnumerable <Element>)Enumerable.Where <Element>((IEnumerable <M0>)elementCollection, (Func <M0, bool>)anonymousMethodDelegate1);
            List <string>         stringList = new List <string>();

            foreach (Element element in elements)
            {
                if (Regex.IsMatch(element.InnerHtml.ToString(), "href=\\\".*\\\""))
                {
                    string input = Regex.Match(element.InnerHtml.ToString(), "href=\\\".*\\\"").Captures[0].ToString().Replace("href=\"", "").Replace("\"", "");
                    if (Regex.IsMatch(input, "/url.*&amp;sa="))
                    {
                        string str = HttpUtility.UrlDecode(Regex.Match(input, "/url.*&amp;sa=").Captures[0].ToString().Replace("/url?q=", "").Replace("&amp;sa=", ""));
                        Console.WriteLine(string.Format("Link found: {0}", (object)str));
                        stringList.Add(str);
                    }
                }
            }
            return(stringList);
        }