Beispiel #1
0
 private static void OnProcessExit(object sender, EventArgs e)
 {
     Logger.Log("Exiting...");
     Logger.Trace(config.ToJson());
     Config.Save(config);
     // LogReader.Dispose();
     // IPC.Launcher.Dispose();
     ExternalConsole.Dispose();
     Application.Exit();
     System.Diagnostics.Process.GetCurrentProcess().Kill();
 }
Beispiel #2
0
        private static void Main(string[] args)
        {
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(OnProcessExit);
            var assembly = System.Reflection.Assembly.GetEntryAssembly().GetName();

            Logger.Debug("{0} v{1} ({2}) with args: {3}", assembly.Name, assembly.Version, assembly.ProcessorArchitecture, string.Join(" ", args));
            Logger.Debug("Current Date and Time: {0} (UTC: {1})", DateTime.Now, DateTime.UtcNow);
            Parser.Default.ParseArguments <Options>(args).WithParsed(o => Arguments = o).WithNotParsed(o => Logger.Error("Unable to parse arguments: {0}", o.First().Tag));
            if (Arguments.ConsoleEnabled)
            {
                ExternalConsole.InitConsole();
            }
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            mainWindow = new UI.MainForm();
            Application.Run(mainWindow);
            Logger.Debug("Ended");
            OnProcessExit(false, new EventArgs());
        }