using System;
using System.Reflection;
using System.IO;
using System.Diagnostics;
class App
{
static int Main(string[] args)
{
string comName = Process.GetCurrentProcess().MainModule.FileName;
if (Path.GetExtension(comName).ToLower() == ".exe")
{
Console.Error.WriteLine("This file must have a .COM extension");
return 1;
}
string exeName = Path.ChangeExtension(comName, ".exe");
if (!File.Exists(exeName))
{
Console.Error.WriteLine("Target executable '{0}' does not exist", exeName);
return 1;
}
if (args.Length == 0)
{
Process.Start(exeName);
return 0;
}
else
{
return AppDomain.CurrentDomain.ExecuteAssembly(exeName, null, args);
}
}
}