static void Main(string[] args) { ConsoleUtil.ApplyCustomFont(); ConsoleUtil.AllocConsole(); ConsoleUtil.InstallCustomFontAndApply(); Assembly a = Assembly.GetExecutingAssembly(); Icon icon = new Icon(a.GetManifestResourceStream("WCell.Terminal.Resources.WCell.Terminal.ico")); ConsoleUtil.SetConsoleIcon(icon); AppUtil.AddApplicationExitHandler(ConsoleEventHandler); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("({0}) <Terminal> Initializing...", DateTime.Now.ToString("hh:mm")); Version vrs = new Version(Application.ProductVersion); try { String ExePath = Directory.GetCurrentDirectory(); String SourcePath = Directory.GetParent(Directory.GetParent(ExePath).FullName).FullName; int Revision = WCell.Util.SvnUtil.GetVersionNumber(SourcePath); Console.Title = String.Format("WCell.Terminal v{0}.{1} rev {2}", vrs.Major, vrs.Minor, Revision); } catch (DirectoryNotFoundException) { Console.Title = String.Format("WCell.Terminal v{0}.{1}", vrs.Major, vrs.Minor); } catch (NullReferenceException) { Console.Title = String.Format("WCell.Terminal v{0}.{1}", vrs.Major, vrs.Minor); } Application.Run(new TerminalMain()); }
static void InitEnvironment() { log.Info("Initialize environment..."); ServerUtil.DisabledCloseBtn(); AppUtil.AddApplicationExitHandler(ServerExitHandler); }
protected ServerApp() { Log.Debug(WCell_Core.ServerStarting); AppUtil.AddApplicationExitHandler(_OnShutdown); AppDomain.CurrentDomain.UnhandledException += (UnhandledExceptionEventHandler)((sender, args) => LogUtil.FatalException(args.ExceptionObject as Exception, WCell_Core.FatalUnhandledException)); LogUtil.SystemInfoLogger = LogSystemInfo; }
protected ServerApp() { ServerApp <T> .Log.Debug(WCell_Core.ServerStarting); AppUtil.AddApplicationExitHandler(new Action(this._OnShutdown)); AppDomain.CurrentDomain.UnhandledException += (UnhandledExceptionEventHandler)((sender, args) => LogUtil.FatalException(args.ExceptionObject as Exception, WCell_Core.FatalUnhandledException, new object[0])); LogUtil.SystemInfoLogger = new Action <Action <string> >(this.LogSystemInfo); }
protected ServerApp() { Log.Debug(Resources.ServerStarting); AppUtil.AddApplicationExitHandler(_OnShutdown); //#if !DEBUG AppDomain.CurrentDomain.UnhandledException += (sender, args) => LogUtil.FatalException(args.ExceptionObject as Exception, Resources.FatalUnhandledException); //#endif LogUtil.SystemInfoLogger = LogSystemInfo; }
public void Startup() { //禁用关闭按钮 ServerUtil.DisabledCloseBtn(); //SerializationUtil.Save(new ModuleInfo { ID="Module1", File="Command.dll", CLS="CommandModule", Startup=false}, "module.mod"); //导出日志配置文件 ResourceUtil.ExtractResourceSafe("LogConfig.xml", "LogConfig.xml", Assembly.GetAssembly(typeof(JLauncher))); //启动模块环境 ModuleStartup.Startup(); //注册应用程序关闭系统钩子 AppUtil.AddApplicationExitHandler(ServerExitHandler); //挂起线程 ServerUtil.WaitingCmd("JTest"); }