Esempio n. 1
0
        static void LoadQualities(FileInfo fInfo)
        {
            Element element = _elements.Find(Path.GetFileNameWithoutExtension(fInfo.FullName));

            if (element.Name == "Phosphorus")
            {
                //System.Diagnostics.Debugger.Break();
            }
            XElement xHtml = XElement.Load(fInfo.FullName);
            IEnumerable <XElement> tbls =
                from xe in xHtml.Descendants("table") select xe;
            XElement infoBox = tbls.First(xe => xe.Attributes("class").Any() && xe.Attributes("class").First().Value == "infobox");

            if (infoBox != null)
            {
                if (LoadQualities(element, infoBox))
                {
                    WriteSuccess("{0} scraped", element.Name);
                }
                else
                {
                    WriteError("{0} failed", element.Name);
                }
            }
            else
            {
                WriteError("infoBox not found:\t{0}", element.Name);
            }
        }