in StaticModuleVerifier/Program.cs [55:205]
static bool ProcessArgs(string[] args)
{
bool help = false;
bool unsupportedArgument = false;
for (int i = 0; i < args.Length;)
{
if (args[i].Equals("/help", StringComparison.InvariantCultureIgnoreCase) || args[i].Equals("/?"))
{
help = true;
PrintHelp();
break;
}
else if (args[i].Equals("/cloud", StringComparison.InvariantCultureIgnoreCase))
{
Log.LogInfo("Using cloud.");
cloud = true;
Utility.schedulerType = "cloud";
i++;
}
else if (args[i].Equals("/db", StringComparison.InvariantCultureIgnoreCase))
{
Log.LogInfo("Using db.");
useDb = true;
Utility.useDb = true;
i++;
}
else if (args[i].Equals("/jobobject", StringComparison.InvariantCultureIgnoreCase))
{
Log.LogInfo("Using job objects.");
Utility.useJobObject = true;
i++;
}
else if (args[i].StartsWith("/config:", StringComparison.InvariantCulture) || args[i].StartsWith("/log:", StringComparison.InvariantCulture))
{
String[] tokens = args[i].Split(new char[] { ':' }, 2);
if (tokens.Length == 2)
{
string value = tokens[1].Replace(@"""", String.Empty);
if (tokens[0].Equals("/config"))
{
Utility.SetSmvVar("configFilePath", value);
}
else if (tokens[0].Equals("/log"))
{
if (!Directory.Exists(value))
{
Log.LogFatalError("Log path does not exist.");
}
Log.SetLogPath(value);
}
}
i++;
}
else if (args[i].Equals("/analyze"))
{
doAnalysis = true;
i++;
}
else if (args[i].StartsWith("/plugin:", StringComparison.InvariantCulture))
{
String[] tokens = args[i].Split(new char[] { ':' }, 2);
if (File.Exists(tokens[1]))
{
Utility.pluginPath = tokens[1].Replace(Environment.GetEnvironmentVariable("smv"), "%smv%");
Assembly assembly = Assembly.LoadFrom(tokens[1]);
string fullName = assembly.ExportedTypes.ToList().Find(t => t.GetInterface(typeof(ISMVPlugin).FullName) != null).FullName;
Utility.plugin = (ISMVPlugin)assembly.CreateInstance(fullName);
if (Utility.plugin == null)
{
Log.LogFatalError("Could not load plugin.");
}
Utility.plugin.Initialize();
}
else
{
Log.LogFatalError("Plugin not found.");
}
i++;
}
else if (args[i].StartsWith("/projectfile:", StringComparison.InvariantCulture))
{
String[] tokens = args[i].Split(new char[] { ':' }, 2);
Utility.SetSmvVar("projectFileArg", tokens[1]);
i++;
}
else if (args[i].Equals("/debug"))
{
Utility.debugMode = true;
Utility.SetSmvVar("debugMode", "true");
i++;
}
else if (args[i].StartsWith("/sessionID:", StringComparison.InvariantCultureIgnoreCase))
{
String[] tokens = args[i].Split(new char[] { ':' }, 2);
if (!String.IsNullOrEmpty(tokens[1]))
{
Log.LogInfo("Setting session ID : " + tokens[1]);
Utility.sessionId = tokens[1];
}
else
{
Log.LogError("Session ID not found");
}
i++;
}
else if (args[i].StartsWith("/taskID:", StringComparison.InvariantCultureIgnoreCase))
{
String[] tokens = args[i].Split(new char[] { ':' }, 2);
if (!String.IsNullOrEmpty(tokens[1]))
{
Log.LogInfo("Setting task ID : " + tokens[1]);
Utility.taskId = tokens[1];
}
else
{
Log.LogError("Task ID not found");
}
i++;
}
else
{
unsupportedArgument = true;
i++;
}
}
if (Utility.plugin != null)
{
Utility.plugin.ProcessPluginArgument(args);
}
else if (unsupportedArgument)
{
Log.LogFatalError("Unsupported arguments. Please provide a Plugin.");
}
if (help)
{
if (Utility.plugin != null)
{
Utility.plugin.PrintPluginHelp();
}
return false;
}
return true;
}