static void Main(string[] args) { Core.Platform.Instance = new Eddie.Platform.MacOS.Platform(); // Due to a bug in Xamarin, that don't recognize resources inside Core library if Mono is bundled, we embed some resources in entry assembly. Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "license.txt", "License.txt"); Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "thirdparty.txt", "ThirdParty.txt"); Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "tos.txt", "TOS.txt"); Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "AirVPN.xml", "AirVPN.xml"); Core.ResourcesFiles.LoadString(Assembly.GetEntryAssembly(), "OpenVPN.xml", "OpenVPN.xml"); Core.ResourcesFiles.Count(); if (new CommandLine(Environment.CommandLine, true, false).Exists("cli")) // TOFIX, not need anymore when every OS have a CLI executable. { Core.ConsoleEdition.UiClient client = new Core.ConsoleEdition.UiClient(); AppDomain.CurrentDomain.UnhandledException += (object sender, UnhandledExceptionEventArgs e) => { Exception ex = (Exception)e.ExceptionObject; client.OnUnhandledException("CurrentDomain", ex); }; client.Init(Environment.CommandLine); } else { NSApplication.Init(); NSApplication.Main(args); } }
static void Main(string[] args) { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Core.Platform.Instance = new Eddie.Platform.Linux.Platform(); m_client = new Core.ConsoleEdition.UiClient(); m_client.Init(Environment.CommandLine); }
static void Main() { try { if (Environment.OSVersion.Version.Major >= 6) { NativeMethods.SetProcessDPIAware(); } //Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(ApplicationThreadException); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Core.Platform.Instance = new Eddie.Platform.Windows.Platform(); if (new CommandLine(Environment.CommandLine, true, false).Exists("cli")) // TOFIX, not need anymore when every OS have a CLI executable. { Core.ConsoleEdition.UiClient client = new Core.ConsoleEdition.UiClient(); client.Init(Environment.CommandLine); } else { m_client = new UiClient(); m_client.Init(Environment.CommandLine); } } catch (Exception e) { MessageBox.Show(e.Message, Constants.Name, MessageBoxButtons.OK, MessageBoxIcon.Error); } // Application.Run must be outside the catch above, otherwise it's not unhandled if ((m_client != null) && (m_client.AppContext != null)) { Application.Run(m_client.AppContext); } }
static void Main() { try { //Application.EnableVisualStyles(); System.Windows.Forms.Application.SetCompatibleTextRenderingDefault(false); Application.ThreadException += new ThreadExceptionEventHandler(ApplicationThreadException); //Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException); // Mono Not Supported AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Core.Platform.Instance = new Eddie.Platform.Linux.Platform(); if (new CommandLine(Environment.CommandLine, true, false).Exists("cli")) // TOFIX, not need anymore when every OS have a CLI executable. { Core.ConsoleEdition.UiClient client = new Core.ConsoleEdition.UiClient(); client.Init(Environment.CommandLine); } else { m_client = new UiClient(); m_client.Engine = new Engine(Environment.CommandLine); m_client.Init(Environment.CommandLine); } } catch (Exception e) { Console.WriteLine(e.StackTrace); MessageBox.Show(e.Message, Constants.Name, MessageBoxButtons.OK, MessageBoxIcon.Error); } // Application.Run must be outside the catch above, otherwise it's not unhandled if ((m_client != null) && (m_client.AppContext != null)) { System.Windows.Forms.Application.Run(m_client.AppContext); } }