private static bool parseArguments(string[] args)
{
string processorFilePath = null;
bool help = false;
var p = new OptionSet()
{
{ "b|baseAddress=", "{BASE_ADDRESS} for web service", (string v) => Settings.BaseAddress = new Uri(v)},
{ "p|processors=", "{FILEPATH} for processor definitions file", (string v) => processorFilePath = Path.GetFullPath(v)},
{ "h|help", v => help = v != null }
};
if (help)
{
ShowHelp(p);
return false;
}
try
{
List<string> extra = p.Parse(args);
// check if processorFilePath points to actual file
if (processorFilePath != null)
{
if (File.Exists(processorFilePath))
{
ReadProcessorDefinitions(processorFilePath);
}
else
{
throw new OptionException("Processor file does not exist. Verify file path.", "p");
}
}
// check for unparsed arguments
if (extra.Count > 0)
{
throw new OptionException("Unknown arguments.", "");
}
}
catch (OptionException e)
{
Console.WriteLine(e.Message);
Console.WriteLine("Try \'atuavrt --help\' for more information.");
Console.WriteLine();
return false;
}
return true;
}