public static void Main() { try { log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config")); System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance); AppDomain.CurrentDomain.UnhandledException += UnhandledException; Console.Title = title; Util.SystemInfo(); Stopwatch stopwatch = Stopwatch.StartNew(); CronService.GetInstance().Initialize(); Util.Section("核心配置"); Configs.LoadConfig(); Util.Section("数据连接"); DAOManager.Initialize(); Util.Section("注册服务"); GameService.Load(); Util.Section("网络服务"); NewLateBinding.LateCall(SlbService.GetInstance(), null, "Start", new object[0], null, null, null, IgnoreReturn: true); ChatPacketFactory.GetInstance(); AionListener.GetInstance().Start(); GamePacketFactory.GetInstance(); GameListener.GetInstance().Start(); Util.Section(""); stopwatch.Stop(); string text = string.Format("聊天服务器启动完成,耗时{0}秒!", ((double)stopwatch.ElapsedMilliseconds / 1000.0).ToString("0.00")); Console.WriteLine(new string(' ', Conversions.ToInteger(Util.StringLength(text))) + text); Util.Section(""); if (ChatConfig.WORKING_MEMORY_SET_ENABLE) { WorkingMemorySet.GetInstance().Initialize(ChatConfig.WORKING_MEMORY_SET_CRON); } } catch (Exception err) { log.Error(err.Message, err); } }
public static object GetInstance() { object @lock = _lock; ObjectFlowControl.CheckForSyncLockOnValueType(@lock); bool lockTaken = false; try { Monitor.Enter(@lock, ref lockTaken); if (Information.IsNothing(instance)) { instance = new SlbService(); } return(instance); } finally { if (lockTaken) { Monitor.Exit(@lock); } } }