static void Main(string[] args) { if (args.Length == 0) { // Automatically use the default address InitializeDatabaseConnection(); LinkScraper linkScraper = new LinkScraper(_dbCtx, "http://Stbezo.info/"); linkScraper.Scrape(); Exit(0); } if (args.Length == 1 && args[0].Equals("-h")) { // Show help and exit PrintHelp(); Exit(0); } if (args.Length > 2) { // Wrong arg length PrintHelp(); Exit(1); } string method = args[0]; string path = args[1]; ScraperBase scraper; InitializeDatabaseConnection(); if (method.Equals("-l")) { scraper = new LinkScraper(_dbCtx, path); } else if (method.Equals("-d")) { scraper = new DirectoryScraper(_dbCtx, path); } else { PrintHelp(); Exit(1); return; } scraper.Scrape(); Exit(0); }
static void Main(string[] args) { if (args.Length == 0) { // Automatically use the default address InitializeDatabaseConnection(); LinkScraper linkScraper = new LinkScraper(_dbCtx, "http://Stbezo.info/"); linkScraper.Scrape(); Exit(0); } if (args.Length == 1 && args[0].Equals ("-h")) { // Show help and exit PrintHelp (); Exit (0); } if (args.Length > 2) { // Wrong arg length PrintHelp (); Exit (1); } string method = args[0]; string path = args[1]; ScraperBase scraper; InitializeDatabaseConnection(); if (method.Equals ("-l")) { scraper = new LinkScraper(_dbCtx, path); } else if (method.Equals ("-d")) { scraper = new DirectoryScraper(_dbCtx, path); } else { PrintHelp (); Exit (1); return; } scraper.Scrape(); Exit (0); }