public void Start()
        {
            _handler = HandlerManager.For(this);
            try
            {
                var ports = new List <int>();
                if (Hosts.Count == 0)
                {
                    throw new InvalidOperationException(
                              "Hosts were empty, please add at least 1 SimpleServerHost before you attempt to start SimpleServer. Error Code: 0x48737430");
                }

                Log.WriteLine("Checking port availability and bind permission...");
                _engines = Hosts.ToDictionary(x => x.Endpoint, x => x.ToServer());
                // Everybody START YOUR ENGINES!
                foreach (var minimalServer in _engines.Values.ToList())
                {
                    minimalServer.Start();
                }
                Log.WriteLine("SimpleServer is now active.");
            }
            catch (Exception ex)
            {
                Log.Error(ex);
            }
        }
        private void SubscribeToProductEntitiesUpdatedQueue(string queueName)
        {
            var responseType = typeof(EntitiesChangedResponse <>);

            //This is where we store the handlers to pass to busManager
            HandlerManager handlerManager = new HandlerManager();

            //Loop through entity types and create QueueMessageHandler of type
            foreach (var entityType in EntityTypes.EntityBaseTypes)
            {
                //Get onRequest method with appropriate request and entity type
                var entityResponseType    = responseType.MakeGenericType(entityType);
                var onResponseMethod      = GenericHelpers.GetMethodExt(this.GetType(), "OnAllEntitiesUpdatedResponse", typeof(void), new Type[] { entityResponseType, typeof(MessageReceivedInfo) });
                var onResponseMethodTyped = onResponseMethod.MakeGenericMethod(entityType);

                //Create action delegate from typed onRequest method
                var actionType = typeof(Action <,>).MakeGenericType(entityResponseType, typeof(MessageReceivedInfo));
                var action     = Delegate.CreateDelegate(actionType, this, onResponseMethodTyped);

                //Create QueueMessageHandler of approriate type and pass in action and queueName
                var queueMessageHandlerType = typeof(QueueMessageHandler <>).MakeGenericType(entityResponseType);
                var accessor            = TypeAccessor.Create(queueMessageHandlerType);
                var queueMessageHandler = accessor.CreateNew();
                accessor[queueMessageHandler, "Handler"]   = action;
                accessor[queueMessageHandler, "QueueName"] = queueName;

                //Get AddHandler method from handlerManager to add appropriate request type and invoke
                var addHandlerMethod      = GenericHelpers.GetMethodExt(handlerManager.GetType(), "AddHandler", typeof(void), new Type[] { queueMessageHandlerType });
                var addHandlerMethodTyped = addHandlerMethod.MakeGenericMethod(entityResponseType);
                addHandlerMethodTyped.Invoke(handlerManager, new object[] { queueMessageHandler });
            }

            //Subscribe with our filled up handlerManager
            _busManager.Subscribe(_busManager.TopicExchange, queueName, handlerManager);
        }
Esempio n. 3
0
 public static void Start()
 {
     HandlerManager.RegisterHandler(120133, handler_120133);
     HandlerManager.RegisterHandler(120141, handler_120141);
     HandlerManager.RegisterHandler(120134, handler_120134);//Concursos
     HandlerManager.RegisterHandler(210120, handler_210120);
     HandlerManager.RegisterHandler(120132, Actualizar_avatar);
     HandlerManager.RegisterHandler(148122, Validar_Email);
     HandlerManager.RegisterHandler(148128, Cambiar_Email);
     HandlerManager.RegisterHandler(148131, cambiar_contraseña_1);
     HandlerManager.RegisterHandler(148126, cambiar_contraseña_2);
     HandlerManager.RegisterHandler(148132, opciones_conexion);
     HandlerManager.RegisterHandler(148127, desactivar_cuenta);
     HandlerManager.RegisterHandler(148120, activar_clave_seguridad);
     HandlerManager.RegisterHandler(148125, validar_clave_seguridad);
     HandlerManager.RegisterHandler(148121, Desactivar_Seguridad);
     HandlerManager.RegisterHandler(148123, Cancelar_Desactivacion_Seguridad);
     HandlerManager.RegisterHandler(126122, comprar_vip);
     HandlerManager.RegisterHandler(126123, detalles_vip);
     //HandlerManager.RegisterHandler(164, ComprarCreditos);
     HandlerManager.RegisterHandler(120147120, handler_120147120Gen); //Regalo Grande
     HandlerManager.RegisterHandler(120147121, handler_120147121);    //Abrir Regalo Grande
     HandlerManager.RegisterHandler(120137, handler_120137);          //Abrir regalo peque
     HandlerManager.RegisterHandler(120146, handler_120146);          //Cambiar nombre de usuario
 }
Esempio n. 4
0
 public static void Start()
 {
     HandlerManager.RegisterHandler(160120, new ProcessHandler(CargarSabio));
     HandlerManager.RegisterHandler(160121, new ProcessHandler(Inscribir));
     HandlerManager.RegisterHandler(160122, new ProcessHandler(Desinscribir));
     HandlerManager.RegisterHandler(160138122, new ProcessHandler(mGame12_ClickPerson));
 }
        private void Run()
        {
            if (PendingTaskCount < MaxTaskCount && QueueMessager.HasValue())
            {
                var message = (dynamic)QueueMessager.Dequeue();
                IncreasePendingTaskCount();

                Task.Run(() =>
                {
                    if (message.Status != MessgaeStatus.Pending)
                    {
                        MessageManager.AddPendingMessgae(message.Pending());
                    }
                    HandlerManager.Handle(message, CancellationToken.None);
                    MessageManager.AddHistoryMessgae(message.Completed());
                    DecreasePendingTaskCount();
                })
                .ContinueWith((t) =>
                {
                    _logger.Write(t?.Exception?.ToTetailMessage());
                    MessageManager.AddErrorMessgae(message.Error());
                    DecreasePendingTaskCount();
                }, TaskContinuationOptions.OnlyOnFaulted);
            }
            else if (PendingTaskCount == 0 && !QueueMessager.HasValue())
            {
                Task.Delay(DelayTimeWhenNoMessageCome).GetAwaiter().GetResult();
            }
            else
            {
                Task.Delay(TimeSpan.FromMilliseconds(1)).GetAwaiter().GetResult();
            }
        }
Esempio n. 6
0
 // 处理消息
 public void ExecuteMsg(MessageData data)
 {
     if (data != null)
     {
         HandlerManager.Execute(data.body);
     }
 }
Esempio n. 7
0
 static void Main(string[] args)
 {
     try
     {
         UpdateTitle();
         Output.WriteLine($"Emulador Enterprise Edition {vercion}");
         SessionManager.Initialize(server);
         HandlerManager.Initialize();
         SalasManager.Initialize();
         Output.WriteLine("Visualizar la conexión de usuarios: " + (ver_conexion_usuarios == true ? "true" : "false"));
         Output.WriteLine("Servidor iniciado correctamente!");
         Output.WriteLine("_________________________________________________");
         ServerThreads.Initialize();
         Console.Beep();
         if (control_panel == true)
         {
             panel_control form = new panel_control();
             form.ShowDialog();
         }
     }
     catch (Exception ex)
     {
         Output.WriteLine(ex.ToString()); Program.EditorialResponse(ex);
         Console.ReadKey();
     }
 }
Esempio n. 8
0
    /// <summary>
    /// 从服务器下载服务器数据
    /// </summary>
    public void LoadServerData()
    {
        HandlerManager.GetInstance().FindHandler((byte)Module.ServerList, (byte)ServerListOperation.FetchAllServer).OnParseHandler += ServerListUI_OnParseHandler1;
        //向服务器要数据
        C2SMessage msg = new C2SMessage((byte)Module.ServerList, (byte)ServerListOperation.FetchAllServer);

        NetManager.GetInstance().SendMessage(msg);
    }
Esempio n. 9
0
 public static void Start()
 {
     HandlerManager.RegisterHandler(148130, new ProcessHandler(Cambios));
     HandlerManager.RegisterHandler(199120, new ProcessHandler(PrepararCanjeos));
     HandlerManager.RegisterHandler(199124, new ProcessHandler(CancelarCanjeos));
     HandlerManager.RegisterHandler(199121, new ProcessHandler(PonerObjetos));
     HandlerManager.RegisterHandler(199122, new ProcessHandler(AceptarCambios));
     HandlerManager.RegisterHandler(199123, new ProcessHandler(CambiarObjetos));
 }
Esempio n. 10
0
    protected override void OnAwake()
    {
        base.OnAwake();
        this.InitSkin("UI/LoginUI");
        mInputUser = this.GetComponentByName <InputField>("InputUser");
        mInputPwd  = this.GetComponentByName <InputField>("InputPwd");

        HandlerManager.GetInstance().Add((byte)Module.Login, (byte)LoginOperation.UserLogin).OnParseHandler += OnLoginResponse;
    }
Esempio n. 11
0
 /// <summary>
 ///  初始化全局对象
 /// </summary>
 public static void Init(ILogger logger, string appURL = "")
 {
     mLog          = logger;
     AppRootFolder = appURL;
     HandlerManager.GetInstance().Init();
     DBManager.GetInstance().Init();
     HandlerManager.GetInstance().DisplayAllHandlers();
     Global.Info("【SYS】游戏服务器启动运行中......");
 }
Esempio n. 12
0
        public override async Task ProcessLine(IrcMessage parsedLine)
        {
            var hasHandlers = HandlerManager.HasHandler(parsedLine.CommandMessage.Command);

            Analytics.TrackEvent(hasHandlers ? "Processing Irc Line" : "Processing Unhandled IRC line", new Dictionary <string, string> {
                { "Command", parsedLine.CommandMessage.Command }
            });

            await base.ProcessLine(parsedLine);
        }
Esempio n. 13
0
 // 加载管理类
 void _Load()
 {
     /*
      *  _NetManager = _Create<NetManager>();
      *  这里我们直接在视图里创建 NetManager,方便修改
      */
     _NetManager     = GetComponentInChildren <NetManager>();
     _HandlerManager = _Create <HandlerManager>();
     _PlayerManager  = _Create <PlayerManager>();
 }
Esempio n. 14
0
        private void WebSock_MessageReceived(object sender, MessageReceivedEventArgs e)
        {
            try {
                var message = JsonConvert.DeserializeObject <BaseMessage>(e.Message);
                LastSequence = message.Sequence;

                var newMessage = MessageInitializer.BuildMessage((int)message.OpCode, message.OpCode == GatewayOpCode.Dispatch ? e.Message : message.Data.ToString());
                HandlerManager.GetHandler((int)message.OpCode)?.Invoke(null, newMessage);
            } catch {
            }
        }
Esempio n. 15
0
 protected void Application_Start(object sender, EventArgs e)
 {
     try
     {
         HandlerManager.Init(Assembly.GetExecutingAssembly());
     }
     catch (Exception ex)
     {
         TraceLog.WriteError("Application_Start error:{0}", ex);
     }
 }
    protected override void OnAwake()
    {
        base.OnAwake();
        this.InitSkin("UI/SelectServerUI");


        txtServerTitle = this.Skin.transform.Find("mServer/title").GetComponent <Text>();

        HandlerManager.GetInstance().Add((byte)Module.ServerList, (byte)ServerListOperation.FetchCurrentServer).OnParseHandler += SelectServerUI_OnParseHandler;;

        C2SMessage msg = new C2SMessage((byte)Module.ServerList, (byte)ServerListOperation.FetchCurrentServer);

        NetManager.GetInstance().SendMessage(msg);
    }
    private void SelectServerUI_OnParseHandler(byte moduleCode, byte opCode, ExitGames.Client.Photon.OperationResponse response)
    {
        //处理获得当前服务器
        HandlerManager.GetInstance().Remove((byte)Module.ServerList, (byte)ServerListOperation.FetchAllServer);
        string json = response.Parameters[(byte)1].ToString();

        //Json序列化成类
        ServerItemVo vo = JsonReader.Deserialize <ServerItemVo>(json);

        //临时存储服务器信息
        Global.GetInstance().mCurrentServerInfo = vo;

        //显示界面
        txtServerTitle.text = (vo.id < 10 ? "0" + vo.id : vo.id + "") + ". " + vo.title;
    }
Esempio n. 18
0
 public static void Start()
 {
     HandlerManager.RegisterHandler(132120, new ProcessHandler(Method_132_120));
     HandlerManager.RegisterHandler(132121, new ProcessHandler(Method_132_121));
     HandlerManager.RegisterHandler(132122, new ProcessHandler(Method_132_122));
     HandlerManager.RegisterHandler(132124, new ProcessHandler(Method_132_124));
     HandlerManager.RegisterHandler(132125, new ProcessHandler(Method_132_125));
     HandlerManager.RegisterHandler(132126, new ProcessHandler(Method_132_126));
     HandlerManager.RegisterHandler(132128, new ProcessHandler(Method_132_128));
     HandlerManager.RegisterHandler(132129, new ProcessHandler(Method_132_129));
     HandlerManager.RegisterHandler(132130, new ProcessHandler(Method_132_130));
     HandlerManager.RegisterHandler(132123, new ProcessHandler(AñadirAmigo));
     HandlerManager.RegisterHandler(132127, new ProcessHandler(EnviarMensaje));
     HandlerManager.RegisterHandler(209127, new ProcessHandler(compartir));//Compartir game
 }
Esempio n. 19
0
    /// <summary>
    /// 初始化
    /// </summary>
    public void Init()
    {
        //初始化UI的根容器
        m_UIRoot = this.transform.Find("UI");

        mCurrentServerInfo = new ServerItemVo();

        //初始化管理器
        HandlerManager.GetInstance().Init();

        UIManager.GetInstance().Init();
        ResManager.GetInstance().Init();
        UIManager.GetInstance().SwitchScene("LoadingUI", "LoginUI");

        NetManager.GetInstance().Init();
    }
Esempio n. 20
0
 public static void Start()
 {
     HandlerManager.RegisterHandler(15432, new ProcessHandler(CargarEscenarios));
     HandlerManager.RegisterHandler(15433, new ProcessHandler(CargarSalas));
     HandlerManager.RegisterHandler(128120, new ProcessHandler(GoRoom_Subareas));
     HandlerManager.RegisterHandler(128125, new ProcessHandler(GoRoom));
     HandlerManager.RegisterHandler(128121, new ProcessHandler(LoadObjects));
     HandlerManager.RegisterHandler(128124, new ProcessHandler(SalirSala));
     HandlerManager.RegisterHandler(191, new ProcessHandler(Favoritos));
     HandlerManager.RegisterHandler(192, new ProcessHandler(AñadirFavorito));
     HandlerManager.RegisterHandler(193, new ProcessHandler(MisIslas));
     HandlerManager.RegisterHandler(194, new ProcessHandler(IslasPorUsuario));
     HandlerManager.RegisterHandler(195, new ProcessHandler(IslasPorNombre));
     HandlerManager.RegisterHandler(196, new ProcessHandler(EliminarFavorito));
     HandlerManager.RegisterHandler(187, new ProcessHandler(Islas));
 }
Esempio n. 21
0
        private void SubscribeToEntityQueues()
        {
            //Add message handlers for all request types and entity types
            foreach (var requestType in EntityTypes.EntityRequestTypes)
            {
                //This is where we store the handlers to pass to busManager
                HandlerManager handlerManager = new HandlerManager();

                //Do one queue/request type at a time
                string requestQueue = null;

                foreach (var entityType in EntityTypes.EntityBaseTypes)
                {
                    //Get onRequest method (below) with appropriate request and entity type
                    var entityRequestType    = requestType.MakeGenericType(entityType);
                    var onRequestMethod      = GenericHelpers.GetMethodExt(this.GetType(), "OnRequest", typeof(void), new Type[] { requestType, typeof(MessageReceivedInfo) });
                    var onRequestMethodTyped = onRequestMethod.MakeGenericMethod(entityType);

                    //Create action delegate from typed onRequest method
                    var actionType = typeof(Action <,>).MakeGenericType(entityRequestType, typeof(MessageReceivedInfo));
                    var action     = Delegate.CreateDelegate(actionType, this, onRequestMethodTyped);

                    //Instantiate a request of appropriate type to get at its request queue
                    if (requestQueue == null)
                    {
                        var requestAccessor = TypeAccessor.Create(entityRequestType);
                        var request         = requestAccessor.CreateNew();
                        requestQueue = (string)requestAccessor[request, "RequestQueue"];
                    }

                    //Create QueueMessageHandler of approriate type and pass in action and queueName
                    var queueMessageHandlerType = typeof(QueueMessageHandler <>).MakeGenericType(entityRequestType);
                    var accessor            = TypeAccessor.Create(queueMessageHandlerType);
                    var queueMessageHandler = accessor.CreateNew();
                    accessor[queueMessageHandler, "Handler"]   = action;
                    accessor[queueMessageHandler, "QueueName"] = requestQueue;

                    //Get AddHandler method from handlerManager to add appropriate request type
                    var addHandlerMethod      = GenericHelpers.GetMethodExt(handlerManager.GetType(), "AddHandler", typeof(void), new Type[] { queueMessageHandlerType });
                    var addHandlerMethodTyped = addHandlerMethod.MakeGenericMethod(entityRequestType);
                    addHandlerMethodTyped.Invoke(handlerManager, new object[] { queueMessageHandler });
                }

                //Subscribe with our filled up handlerManager
                _busManager.Subscribe(_busManager.TopicExchange, requestQueue, handlerManager);
            }
        }
Esempio n. 22
0
    public void OnOperationResponse(OperationResponse operationResponse)
    {
        //获取模块ID
        byte moudle    = (byte)operationResponse.OperationCode;
        byte operation = (byte)operationResponse.Parameters[(byte)80];

        Handler handler = HandlerManager.GetInstance().FindHandler((byte)moudle, (byte)operation);

        if (handler != null)
        {
            handler.Parse(moudle, operation, operationResponse);
        }
        else
        {
            Global.Info("收到未知消息" + moudle + "," + operation);
        }
    }
        public override bool CheckLogin()
        {
            UserToken userToken = null;

            if ((userToken = HandlerManager.GetUserToken(Token, _host, _db)) == null)
            {
                return(false);
            }
            if (userToken.ExpireTime < DateTime.Now)
            {
                return(false);
            }
            PassportID = userToken.PassportId;
            UserID     = userToken.UserId.ToString();
            UserType   = userToken.UserType;
            return(true);
        }
Esempio n. 24
0
        protected override void OnRequest(HttpContext context, ResponseBody body)
        {
            var watch = Stopwatch.StartNew();

            try
            {
                string param;
                if (CheckSign(context.Request, out param))
                {
                    HandlerData handlerData;
                    if (TryUrlQueryParse(param, out handlerData))
                    {
                        body.Handler = handlerData.Name;
                        body.Data    = HandlerManager.Excute(handlerData);
                    }
                    else
                    {
                        body.StateCode        = StateCode.NoHandler;
                        body.StateDescription = StateDescription.NoHandler;
                    }
                }
                else
                {
                    body.StateCode        = StateCode.SignError;
                    body.StateDescription = StateDescription.SignError;//"Sign error.";
                }
            }
            catch (HandlerException handlerError)
            {
                body.StateCode        = handlerError.StateCode;
                body.StateDescription = handlerError.Message;
                TraceLog.WriteError("Request handle error:{0}", handlerError);
            }
            catch (Exception error)
            {
                body.StateCode        = StateCode.Error;
                body.StateDescription = StateDescription.Error;// "Process request fail.";
                TraceLog.WriteError("Request handle error:{0}", error);
            }
            var ms = watch.ElapsedMilliseconds;

            if (ms > 20)
            {
                TraceLog.Write("Request timeout:{0}ms", ms);
            }
        }
Esempio n. 25
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="userId"></param>
        /// <param name="passportId"></param>
        /// <returns></returns>
        protected ResponseData AuthorizeLogin(int userId, string passportId)
        {
            UserToken userToken = new UserToken()
            {
                Token      = GenrateToken(),
                UserId     = userId,
                PassportId = passportId,
                ExpireTime = DateTime.Now.AddDays(1)
            };

            HandlerManager.SaveToken(userToken.Token, userToken);
            return(new LoginToken()
            {
                Token = userToken.Token,
                UserId = userToken.UserId,
                PassportId = userToken.PassportId
            });
        }
Esempio n. 26
0
    /// <summary>
    /// 初始化
    /// </summary>
    public void Init()
    {
        //初始化UI的根容器
        m_UIRoot = this.transform.Find("UI");

        mCurrentServerInfo = new ServerItemVo();

        //初始化管理器
        HandlerManager.GetInstance().Init();

        UIManager.GetInstance().Init();
        SceneManager.GetInstance().Init();
        ResManager.GetInstance().Init();

        NetManager.GetInstance().Init();
        SceneManager.GetInstance().GotoUIScene("LoginUI");
        //SceneManager.GetInstance().GotoScene("MainCity");
    }
Esempio n. 27
0
 public static void Start()
 {
     HandlerManager.RegisterHandler(130, new ProcessHandler(Tutorial_Islas));
     HandlerManager.RegisterHandler(189120, new ProcessHandler(CrearIsla));
     HandlerManager.RegisterHandler(189124, new ProcessHandler(MostrarIsla));
     HandlerManager.RegisterHandler(189121, new ProcessHandler(CrearZona));
     HandlerManager.RegisterHandler(189149, new ProcessHandler(EliminarIsla));
     HandlerManager.RegisterHandler(189132, new ProcessHandler(EliminarZona));
     HandlerManager.RegisterHandler(189130, new ProcessHandler(RenombrarZona));
     HandlerManager.RegisterHandler(189129, new ProcessHandler(RenombrarIsla));
     HandlerManager.RegisterHandler(189126, new ProcessHandler(CambiarDescripcion));
     HandlerManager.RegisterHandler(189147, new ProcessHandler(ExpulsarUsuario));
     HandlerManager.RegisterHandler(189146, new ProcessHandler(CambiarColores));
     HandlerManager.RegisterHandler(189125, new ProcessHandler(CambiarUppercut));
     HandlerManager.RegisterHandler(189150, new ProcessHandler(NoVerlo));
     HandlerManager.RegisterHandler(189127, new ProcessHandler(MAmigos));
     HandlerManager.RegisterHandler(189131, new ProcessHandler(Poner_Clave));
     HandlerManager.RegisterHandler(189123, new ProcessHandler(Validar_Clave_Acceso));
 }
Esempio n. 28
0
        public ResponseData Excute(LoginToken data)
        {
            UserToken userToken = null;

            if (string.IsNullOrEmpty(data.Token) || (userToken = HandlerManager.GetUserToken(data.Token)) == null)
            {
                throw new HandlerException(StateCode.NoToken, StateDescription.NoToken);
            }
            if (userToken.ExpireTime < DateTime.Now)
            {
                throw new HandlerException(StateCode.TokenExpired, StateDescription.TokenExpired);
            }
            return(new LoginToken()
            {
                Token = userToken.Token,
                UserId = userToken.UserId,
                PassportId = userToken.PassportId
            });
        }
Esempio n. 29
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Theseus.Core"/> class.
 /// </summary>
 /// <param name="configurationFileName">Configuration file name.</param>
 /// <param name="accountsFileName">Accounts file name.</param>
 public Core(String configurationFileName, String accountsFileName) {
     AppDomain.CurrentDomain.UnhandledException += 
         new UnhandledExceptionEventHandler(delegate(object sender, UnhandledExceptionEventArgs e) {
             Logger.Error(e.ExceptionObject);
         });
     Logger = LogManager.GetLogger("Core");
     Logger.Info("Core initializing...");
     Logger.Info("Configuration initializing...");
     configuration = Configuration.Parse(configurationFileName, cancellationTokenSource.Token).Result;
     Logger.Info("Adapter manager initializing...");
     adapterManager = new AdapterManager(this, configuration.Adapters);
     adapterManager.PluginsDirectory = "./Adapters";
     Logger.Info("Handler manager initializing...");
     handlerManager = new HandlerManager(this, configuration.Handlers);
     handlerManager.PluginsDirectory = "./Handlers";
     Logger.Info("Accounts initializing...");
     accounts = new Accounts(accountsFileName, cancellationTokenSource.Token);
     Logger.Info("Core initialized");
 }
Esempio n. 30
0
        public void Initialize()
        {
            Instance = this;

            GCSettings.LatencyMode = GCSettings.IsServerGC ? GCLatencyMode.Batch : GCLatencyMode.Interactive;

            NLogHelper.DefineLogProfile(true, true);
            NLogHelper.EnableLogging();

            logger.Info("Initializing Database...");
            DBAccessor = new DatabaseAccessor(DatabaseConfiguration);
            DBAccessor.RegisterMappingAssembly(Assembly.GetExecutingAssembly());
            DBAccessor.Initialize();

            logger.Info("Opening Database...");
            DBAccessor.OpenConnection();
            DBAccessor.Database.ExecutingCommand += OnExecutingDBCommand;

            MessageReceiver.Initialize();
            ProtocolTypeManager.Initialize();

            HandlerManager = ServerPacketHandler.Instance;
            HandlerManager.RegisterAll(Assembly.GetExecutingAssembly());

            ClientManager.Instance.Initialize(CreateClient);
            ClientManager.Instance.Start("x.x.x.x", 9250);

            WebServer.Initialize();

            IOTaskPool = new SelfRunningTaskPool(50, "Main TaskPool");
            IOTaskPool.CallPeriodically((int)TimeSpan.FromSeconds(10).TotalMilliseconds, KeepSQLConnectionAlive);
            IOTaskPool.CallPeriodically((int)TimeSpan.FromSeconds(10).TotalMilliseconds, WriteBufferLogs);

            IOTaskPool.Start();

            logger.Info("Server listening at port 9250");
            logger.Info("WebServer listening at port 9251");


            //     TeknoServer server = new TeknoServer("test", "test");
        }
Esempio n. 31
0
        private string HandlerInit()
        {
            try{
                var err = HandlerManager.AddHandler(NET_CMD.INSTALL, new Game.HandlerInstall());
                if (err != null)
                {
                    return(err);
                }

                err = HandlerManager.AddHandler(NET_CMD.SYNC, new Game.HandlerSync());
                if (err != null)
                {
                    return(err);
                }
            }
            catch {
                return("unknown error");
            }

            return(null);
        }