public static ProgramArguments Parse(params string[] args)
		{
			ProgramArguments arguments = new ProgramArguments();
			if (Parser.ParseArgumentsWithUsage(args, arguments))
				return arguments;
			return null;
		}
Beispiel #2
0
		private static void FindImages(ProgramArguments arguments, List<string> images)
		{
			List<string> inputFiles = new List<string>();

			if (!string.IsNullOrEmpty(arguments.il))
			{
				using (StreamReader reader = new StreamReader(arguments.il))
				{
					while (!reader.EndOfStream)
					{
						inputFiles.Add(reader.ReadLine());
					}
				}
			}

			if (arguments.input != null)
			{
				inputFiles.AddRange(arguments.input);
			}

            foreach (var wildcard in inputFiles.Where(p => p.Contains('*')).ToList()) {
                string pattern = Path.GetFileName(wildcard);
                string relDir = wildcard.Substring(0, wildcard.Length - pattern.Length);
                string absPath = Path.GetFullPath(Path.Combine(Directory.GetCurrentDirectory(), relDir));
                inputFiles.AddRange(Directory.GetFiles(absPath, pattern));
                inputFiles.Remove(wildcard);
            }

			foreach (var str in inputFiles)
			{
				if (MiscHelper.IsImageFile(str))
				{
					images.Add(str);
				}
				else
				{
					Console.WriteLine("WARN: {0} is not an image file", str);
				}
			}
		}
        private static void FindImages(ProgramArguments arguments, List<string> images)
        {
            List<string> inputFiles = new List<string>();

            if (!string.IsNullOrEmpty(arguments.il))
            {
                using (StreamReader reader = new StreamReader(arguments.il))
                {
                    while (!reader.EndOfStream)
                    {
                        inputFiles.Add(reader.ReadLine());
                    }
                }
            }

            if (arguments.input != null)
            {
                inputFiles.AddRange(arguments.input);
            }

            foreach (var str in inputFiles)
            {
                if (MiscHelper.IsImageFile(str))
                {
                    images.Add(str);
                }
                else
                {
                    Console.WriteLine("WARN: {0} is not an image file", str);
                }
            }
        }