mono を使用して外部システム コールを実行しようとしています。以下の例のようなものをエミュレートできるかどうか知りたいです (もちろん、クロスプラットフォームのサポートを探しています)。
public static int ExecuteExternalApp()
{
int ExitCode = -1;
Process Process = new Process(); ;
//Defining the filename of the app
Process.StartInfo.FileName = "java";
//Assigning the args to the filename
Process.StartInfo.Arguments = @"-jar """ + ConfigurationManager.AppSettings["JarPath"].ToString();
try
{
//Starting the process
Process.Start();
//Waiting for the process to exit
Process.WaitForExit();
//Grabbing the exit code
ExitCode = Process.ExitCode;
//Close the process
Process.Close();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
return ExitCode;
}
**更新: このコードはモノラルで動作します。System.Diagnostics 名前空間が使用されている限り、このコード ブロックは機能します。