protected Boolean ExecuteCLICommand(String FilePath, String args)
{
string CliExecutable = FilePath;
string CliArguments = args;
try
{
Process p = new Process();
p.StartInfo.CreateNoWindow = true;
p.StartInfo.UseShellExecute = false;
p.StartInfo.RedirectStandardOutput = true;
p.StartInfo.RedirectStandardError = true;
Log.write("#Launch:" + CliExecutable + CliArguments);
p.StartInfo.FileName = CliExecutable;
p.StartInfo.Arguments = CliArguments;
p.Start();
p.WaitForExit();
if (p.ExitCode != 0)
{
Log.write(String.Format("Error Executing {0} with Args: {1}", FilePath, args));
Log.write("Error output:");
Log.write(p.StandardError.ReadToEnd());
Log.write(p.StandardOutput.ReadToEnd());
return false;
}
return true;
}
catch (Exception ex)
{
Log.write("Exception: " + ex.Message);
return false;
}
}