public static Initialize ( string args ) : void | ||
args | string | |
return | void |
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"); } }