Exemple #1
0
        static ArtDownloaderOptions ParseArguments(string[] args, out bool result)
        {
            result = true;
              ArtDownloaderOptions res = new ArtDownloaderOptions();

              int count = args.Length;
              for (int index = 0; index < count; index++){
            string s = args[index];
            if (s == "--path" || s == "-p") {
              if (index < count) {
            res.Path = args[++index];
              } else {
            Console.WriteLine(string.Format("Missing value for {0}", s));
            result = false;
              }
            }else if (s == "--file" || s == "-f") {
              if (index < count) {
            res.FileName = args[++index];
              } else {
            Console.WriteLine(string.Format("Missing value for {0}", s));
            result = false;
              }
            }else if (s == "-r") {
              res.Recursive = true;
            } else if (s == "-o") {
              res.Overwrite = true;
            }
              }

              if (string.IsNullOrEmpty(res.Path)) {
            Console.WriteLine("Missing argument -p,--path");
            result = false;
              }

              return res;
        }
 public ArtDownloader(ArtDownloaderOptions opt)
 {
     m_Options = opt;
 }