WIP
DirectOutput framework for virtual pinball cabinets WIP
Go to:
Overview 
Program.cs
Go to the documentation of this file.
1 using System;
2 using System.IO;
3 using System.Windows.Forms;
4 
9 {
13  class Program
14  {
18  static void Main(string[] args)
19  {
20  string Result = "";
21 
22  string RegAsm = Path.Combine(Environment.ExpandEnvironmentVariables("%systemroot%"), "Microsoft.NET", "Framework", System.Runtime.InteropServices.RuntimeEnvironment.GetSystemVersion(), "regasm.exe");
23  if (File.Exists(RegAsm))
24  {
25  string ComObject = Path.Combine(new FileInfo(System.Reflection.Assembly.GetEntryAssembly().Location).Directory.FullName, "DirectOutputComObject.dll");
26  if (File.Exists(ComObject))
27  {
28 
29  System.Diagnostics.ProcessStartInfo ProcStartInfo = new System.Diagnostics.ProcessStartInfo();
30  ProcStartInfo.FileName = RegAsm;
31  ProcStartInfo.Arguments = "\"" + ComObject + "\" /silent /nologo /codebase";
32 
33  ProcStartInfo.RedirectStandardOutput = true;
34  ProcStartInfo.UseShellExecute = false;
35  // Do not create the black window.
36  ProcStartInfo.CreateNoWindow = true;
37 
38  // Now we create a process, assign its ProcessStartInfo and start it
39  System.Diagnostics.Process Proc = new System.Diagnostics.Process();
40  Proc.StartInfo = ProcStartInfo;
41  Proc.Start();
42 
43  Result = Proc.StandardOutput.ReadToEnd();
44 
45 
46  if (Proc.ExitCode == 0 && Result.Length == 0)
47  {
48  MessageBox.Show("DirectOutput COM object successfully registered.", "DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Information);
49  }
50  else
51  {
52  MessageBox.Show(string.Format("Registering the DirectOutput COM object returned the following information:\nExit Code: {0}\nMessage: {1}", Proc.ExitCode, Result), "DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Error);
53  }
54  }
55  else
56  {
57  MessageBox.Show(string.Format("Could not register the DirectOutput COM object, since the file could not be found.\nMissing file: {0}", ComObject), "DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Error);
58  }
59  }
60  else
61  {
62  MessageBox.Show(string.Format("Could not register the DirectOutput COM object, since the regasm.exe could not be found.\nMissing file: {0}", RegAsm), "DirectOutput", MessageBoxButtons.OK, MessageBoxIcon.Error);
63 
64  }
65 
66 
67  }
68  }
69 }
Namespace for the DirectOutputComObjectRegister application.
Definition: Program.cs:8
Main class of the DirectOutputComObjectRegister application.
Definition: Program.cs:13