Ejemplo n.º 1
0
 public GameConnection(Socket socket)
     : base(socket, new MessageProtocol(GamePacketFactory.GetInstance()))
 {
     log         = LogManager.GetLogger(GetType());
     IsRead      = false;
     IsWrite     = false;
     _state      = State.CONNECTED;
     readPackets = new Queue <GsClientPacket>();
     sendPackets = new Queue <GsServerPacket>();
 }
Ejemplo n.º 2
0
        public static void Main()
        {
            try
            {
                log4net.Config.XmlConfigurator.Configure(new System.IO.FileInfo("log4net.config"));
                System.Text.Encoding.RegisterProvider(System.Text.CodePagesEncodingProvider.Instance);

                //try
                //{
                //    Test();
                //}
                //catch (Exception err)
                //{

                //}

                AppDomain.CurrentDomain.UnhandledException += UnhandledException;
                Util.RemoveMenu();
                Util.RegeditCloseEvent(ref handler, add: true);
                Console.Title = title;
                Util.SystemInfo();
                Stopwatch stopwatch = Stopwatch.StartNew();
                CronService.GetInstance().Initialize();
                Util.Section("服务配置");
                Configs.LoadConfig();
                Util.Section("核心服务");
                DAOManager.Initialize();
                KeyGen.Initial();
                GameService.LoadGameservers();
                BannedIpController.Initialize();
                LunaController.GetInstance().Initial();
                Util.Section("网络服务");
                AionPacketFactory.GetInstance();
                LoginListener.GetInstance().Start();
                GamePacketFactory.GetInstance();
                GameListener.GetInstance().Start();
                Util.Section("充值奖励");
                PayRewardService.GetInstance();
                Util.Section("");
                stopwatch.Stop();
                string text  = string.Format("登陆服务器启动完成,耗时{0}秒!", ((double)stopwatch.ElapsedMilliseconds / 1000.0).ToString("0.00"));
                string text2 = "使用快捷键 Ctrl + C 关闭服务并保存数据!";
                Console.WriteLine(new string(' ', Conversions.ToInteger(Util.StringLength(text))) + text);
                Console.WriteLine(new string(' ', Conversions.ToInteger(Util.StringLength(text2))) + text2);
                Util.Section("");
                if (LoginConfig.WORKING_MEMORY_SET_ENABLE)
                {
                    WorkingMemorySet.GetInstance().Initialize(LoginConfig.WORKING_MEMORY_SET_CRON);
                }
            }
            catch (Exception err)
            {
                log.Error(err.Message, err);
            }
        }
Ejemplo n.º 3
0
 public GsServerPacket()
 {
     base.OpCode = GamePacketFactory.GetInstance().GetOpCode(GetType());
 }