示例#1
0
 private static ArgsReader ParseParameters(string[] args)
 {
     ArgsReader reader = new ArgsReader(args);
       reader.MoveNext();
       templateFileName = reader.Current;
       if (!File.Exists(templateFileName))
     Messages.TemplateFileNotFound(templateFileName);
       reader.MoveNext();
       while (!reader.EOF && !reader.Error)
       {
     switch (reader.Current.ToLower())
     {
       case "-input":
     LoadInputs(reader);
     break;
       case "-excel":
       case "-xml":
       case "-html":
     string method = reader.Current.ToLower();
     if (!reader.MoveNext() || reader.Current.StartsWith("-"))
     {
       Messages.NoExportName(method);
       reader.Error = true;
     }
     exportFiles[method] = reader.Current;
     reader.MoveNext();
     break;
       default:
     Messages.UnknownSpecifier(reader.Current);
     reader.Error = true;
     break;
     }
       }
       if (!reader.Error && exportFiles.Count == 0)
       {
     Messages.NoExportFilenames();
     reader.Error = true;
       }
       return reader;
 }
示例#2
0
 private static void LoadInputs(ArgsReader reader)
 {
     while (reader.MoveNext() && IsExportSpec(reader.Current))
       {
     Uri uri;
     if (Uri.TryCreate(reader.Current, UriKind.Absolute, out uri) ||
       Uri.TryCreate("http://" + reader.Current, UriKind.Absolute, out uri))
     {
       positions.Add(new WebPosition(uri));
     }
     else
     {
       Messages.BadUri(reader.Current);
       reader.Error = true;
       break;
     }
       }
 }