Beispiel #1
0
        public static void Main(string[] args)
        {
            CommandLineOptions options = new CommandLineOptions();

            if (!CommandLine.Parser.Default.ParseArguments(args, options))
            {
                return;
            }

            DirectoryInfo      destDirectory     = new DirectoryInfo(options.DestDirectory);
            ISaver             saver             = new Saver(destDirectory);
            IRestrictionHelper restrictionHelper = GetRestrictionHelper(options);
            ILogger            logger            = null;

            if (options.Verbose)
            {
                logger = new Logger();
            }

            ISimpleWGet wGet = new WGet(saver, restrictionHelper, logger, options.DepthLevel);

            try
            {
                wGet.DownloadSite(options.Url);
            }
            catch (Exception ex)
            {
                logger.Log($"Some error occured during site downloading: {ex.Message}");
            }

            Console.WriteLine("Finish downloading. Press enter to exit.");
            Console.ReadLine();
        }
Beispiel #2
0
 public WGet(
     ISaver saver,
     IRestrictionHelper restrictionHelper,
     ILogger logger,
     int maxDepthLevel = 0)
 {
     _saver             = saver;
     _restrictionHelper = restrictionHelper;
     _logger            = logger;
     _maxDepthLevel     = maxDepthLevel;
 }