static void Main(string[] args) { System.Net.ServicePointManager.SecurityProtocol = System.Net.SecurityProtocolType.Tls12; // send log to console log4net.Config.BasicConfigurator.Configure(); bool onlyInstance = false; mutex = new Mutex(true, "SuperPutty", out onlyInstance); Log.InfoFormat( "IsFirstRun={0}, SingleInstanceMode={1}, onlyInstance={2}", SuperPuTTY.IsFirstRun, SuperPuTTY.Settings.SingleInstanceMode, onlyInstance); if ((EnforceSingleInstance || SuperPuTTY.Settings.SingleInstanceMode) && !SuperPuTTY.IsFirstRun && !onlyInstance) { SingleInstanceHelper.LaunchInExistingInstance(args); Log.InfoFormat("Sent Command to Existing Instance: [{0}]", String.Join(" ", args)); Environment.Exit(0); } // open full file log4net.Config.XmlConfigurator.Configure(); #if DEBUG Logger.OnLog += delegate(string logMessage) { //Console.WriteLine(logMessage); Log.Info(logMessage); }; #endif try { Log.Info("Starting"); SuperPuTTY.Initialize(args); AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.ThreadException += new ThreadExceptionEventHandler(Application_ThreadException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); frmSuperPutty mainForm = new frmSuperPutty(); SetDefaultIcon(mainForm); Application.Run(SuperPuTTY.MainForm = mainForm); SuperPuTTY.Shutdown(); } catch (Exception ex) { Log.Error("Error in Main", ex); } finally { Log.Info("Shutdown"); } }
static void Main(string [] args) { Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Form applicationMainWindow = new frmMainWindow(); ApplicationSettings.ApplicationMainForm = applicationMainWindow; if (Debugger.IsAttached) { LogWriter = new DebugLogger(); LogWriter.Log("DebugLogger wurde aktiviert!"); } else { LogWriter = new LoggerMock(); } SingleInstanceHelper.RegisterRemotingService(); if (ApplicationSettings.RuninSingleInstanceMode) { bool onlyInstance = false; Mutex mutex = new Mutex(true, "PuttyServerManager", out onlyInstance); LogWriter.Log("Running in single instance mode - is first instance: {0}", onlyInstance); if (!onlyInstance) { SingleInstanceHelper.LaunchInExistingInstance(args); Environment.Exit(0); } } Application.Run(applicationMainWindow); }