1.1 --- a/Program.cs Fri Apr 30 20:53:40 2010 +0000
1.2 +++ b/Program.cs Sat May 01 12:12:37 2010 +0000
1.3 @@ -57,6 +57,9 @@
1.4 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
1.5 #endif
1.6
1.7 + if (!AllRequiredFilesAvailable())
1.8 + Environment.Exit(0);
1.9 +
1.10 Application.EnableVisualStyles();
1.11 Application.SetCompatibleTextRenderingDefault(false);
1.12 using (GUI.MainForm form = new GUI.MainForm()) {
1.13 @@ -67,6 +70,37 @@
1.14 }
1.15 }
1.16
1.17 + private static bool IsFileAvailable(string fileName) {
1.18 + string path = Path.GetDirectoryName(Application.ExecutablePath) +
1.19 + Path.DirectorySeparatorChar;
1.20 +
1.21 + if (!File.Exists(path + fileName)) {
1.22 + MessageBox.Show("The following file could not be found: " + fileName +
1.23 + "\nPlease extract all files from the zip archive.", "Error",
1.24 + MessageBoxButtons.OK, MessageBoxIcon.Error);
1.25 + return false;
1.26 + }
1.27 + return true;
1.28 + }
1.29 +
1.30 + private static bool AllRequiredFilesAvailable() {
1.31 + if (!IsFileAvailable("Aga.Controls.dll"))
1.32 + return false;
1.33 +
1.34 + if (IntPtr.Size == 4) {
1.35 + if (!IsFileAvailable("WinRing0.dll"))
1.36 + return false;
1.37 + if (!IsFileAvailable("WinRing0.sys"))
1.38 + return false;
1.39 + } else {
1.40 + if (!IsFileAvailable("WinRing0x64.dll"))
1.41 + return false;
1.42 + if (!IsFileAvailable("WinRing0x64.sys"))
1.43 + return false;
1.44 + }
1.45 + return true;
1.46 + }
1.47 +
1.48 private static void ReportException(Exception e) {
1.49 CrashReportForm form = new CrashReportForm();
1.50 form.Exception = e;