Sync: Adding shamap and documentation to enable easier sync next time OHM is updated.
3 This Source Code Form is subject to the terms of the Mozilla Public
4 License, v. 2.0. If a copy of the MPL was not distributed with this
5 file, You can obtain one at http://mozilla.org/MPL/2.0/.
7 Copyright (C) 2009-2013 Michael Möller <mmoeller@openhardwaremonitor.org>
13 using System.Threading;
14 using System.Windows.Forms;
15 using OpenHardwareMonitor.GUI;
17 namespace OpenHardwareMonitor {
18 public static class Program {
21 public static void Main() {
23 Application.ThreadException +=
24 new ThreadExceptionEventHandler(Application_ThreadException);
25 Application.SetUnhandledExceptionMode(
26 UnhandledExceptionMode.CatchException);
28 AppDomain.CurrentDomain.UnhandledException +=
29 new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException);
32 if (!AllRequiredFilesAvailable())
35 Application.EnableVisualStyles();
36 Application.SetCompatibleTextRenderingDefault(false);
37 using (GUI.MainForm form = new GUI.MainForm()) {
38 form.FormClosed += delegate(Object sender, FormClosedEventArgs e) {
45 private static bool IsFileAvailable(string fileName) {
46 string path = Path.GetDirectoryName(Application.ExecutablePath) +
47 Path.DirectorySeparatorChar;
49 if (!File.Exists(path + fileName)) {
50 MessageBox.Show("The following file could not be found: " + fileName +
51 "\nPlease extract all files from the archive.", "Error",
52 MessageBoxButtons.OK, MessageBoxIcon.Error);
58 private static bool AllRequiredFilesAvailable() {
59 if (!IsFileAvailable("Aga.Controls.dll"))
61 if (!IsFileAvailable("OpenHardwareMonitorLib.dll"))
63 if (!IsFileAvailable("OxyPlot.dll"))
65 if (!IsFileAvailable("OxyPlot.WindowsForms.dll"))
71 private static void ReportException(Exception e) {
72 CrashForm form = new CrashForm();
77 public static void Application_ThreadException(object sender,
78 ThreadExceptionEventArgs e)
81 ReportException(e.Exception);
88 public static void CurrentDomain_UnhandledException(object sender,
89 UnhandledExceptionEventArgs args)
92 Exception e = args.ExceptionObject as Exception;