我正在从xna编写一个多维数组,我需要3个值才能从用户创建它。在Initialize()
我使用了
ProcessStartInfo p = new ProcessStartInfo();
p.FileName = @"C:\Sean\Adventures!\PlayerInput.exe";
p.RedirectStandardOutput = true;
p.UseShellExecute = false;
using (Process process = Process.Start(p))
{
using (StreamReader reader = process.StandardOutput)
{
string result = reader.ReadToEnd();
Console.Write(result);
}
}
playerinput exe文件是
static void Main(string[] args)
{
Console.BackgroundColor = ConsoleColor.White;
Console.ForegroundColor = ConsoleColor.Black;
Console.Clear();
Console.WriteLine("# of layers?");
int layers = int.Parse(Console.ReadLine());
Console.Clear();
Console.WriteLine("# of rows?");
int rows = int.Parse(Console.ReadLine());
Console.Clear();
Console.WriteLine("# of columns?");
int columns = int.Parse(Console.ReadLine());
Console.Clear();
}
}
我知道有办法做到这一点,但我遇到了很大的麻烦。如何从XNA C#代码执行exe并接收int层,行和列?