예제 #1
0
        /// <exception cref="System.ArgumentNullException">Null arguments</exception>
        /// <exception cref="System.ArgumentOutOfRangeException">Invalid number of options</exception>
        public static CommandLineArgumentsItem Parse(string[] args)
        {
            if (args == null)
            {
                throw new ArgumentNullException(nameof(args));
            }

            if (args.Length < 4)
            {
                Console.WriteLine("Not enough arguments: -inputsource <source of hashes> -vtkey <virus total key>");

                throw new ArgumentOutOfRangeException(nameof(args));
            }

            if (args.Length % 2 != 0)
            {
                Console.WriteLine("Invalid number of options (even number options are required)");

                throw new ArgumentOutOfRangeException("Invalid number of options");
            }

            var hashSources = typeof(CommandLineParserHelper).Assembly.GetTypes()
                              .Where(a => !a.IsInterface && typeof(IHashList).IsAssignableFrom(a))
                              .Select(b => (IHashList)Activator.CreateInstance(b)).ToList();

            var item = new CommandLineArgumentsItem();

            for (var x = 0; x < args.Length; x += 2)
            {
                var option = args[x].ToLower()[1..];
예제 #2
0
 public Downloader(CommandLineArgumentsItem arguments)
 {
     Arguments = arguments;
 }