コード例 #1
0
        //---------------------------------------------------------------------------------------------------
        public override Event Import(IImportRepository repository)
        {
            var home_page = GetResultsPage();

            // Create and commit the event section
            Event ev = GetEventSection(home_page);
            repository.Event(ref ev);

            // If there are links in the data table this is a multi-page event
            if (home_page.DocumentNode.SelectSingleNode("//table[@class=\"data\"]//a[text()=\"Results\"]") != null) {
                // If there is a link with the text "Splits" the event probably has splits
                if (home_page.DocumentNode.SelectSingleNode("//table[@class=\"data\"]//a[text()=\"Splits\"]") != null) {
                    ParseMultiplePageWithSplits(repository, home_page, ev);
                    return ev;
                } else {
                    // This seems to only appear when there are multiple runs per class which I can't currently handle
                    throw new Exception("Import of this type of event is not currently supported");
                    //ParseMutiplePage(repository, home_page, ev);
                }
            }

            // If there is a course title then this is a single-page event
            if (home_page.DocumentNode.SelectSingleNode("//div[@class=\"course-title\"]") != null) {
                ParseSinglePage(repository, home_page, ev);
                return ev;
            }

            throw new Exception("Import of this type of event is not currently supported");
        }