我正在编写一个小程序,用作特定游戏引擎的数字分发平台。
这个游戏引擎的版本很旧,这似乎导致了一些兼容性问题。
如果我直接从资源管理器运行特定游戏(即 dbl 单击 exe),运行特定游戏似乎可以正常工作,但如果我从程序中将其作为进程运行,它会立即崩溃。
那么 .NET 中的进程和从 shell 中运行它有什么区别呢?
这是我当前的代码:
(为了记录这个版本的引擎不需要dosbox,所以不是dosbox搞砸了。)
if (Status == "Ready")
{
System.Diagnostics.Process Proc = new System.Diagnostics.Process();
if (NeedsDosBox)
{
Proc.StartInfo.FileName = String.Format("{0}\\dosbox.exe", Globals.AppDir);
Proc.StartInfo.Arguments = String.Format("{2}\\{0}\\{1}", GameId, Executable, Globals.Gamecache);
}
else
{
Proc.StartInfo.FileName = String.Format("{2}\\{0}\\{1}", GameId, Executable, Globals.Gamecache);
}
Proc.StartInfo.UseShellExecute = true;
Proc.EnableRaisingEvents = true;
Proc.Exited += new EventHandler(Proc_Exited);
Status = "In Game";
Proc.Start();
}