/// <summary>
        /// 初始化
        /// </summary>
        /// <param name="logger"> Logger物件 </param>
        /// <returns> 是否初始化成功 </returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = true;

            this.logger = logger;

            if (msgFunc.Initialize(logger))
            {
                AddMsgFunc((int)C2S_CmdID.emCreateNewPost, msgFunc.OnCreateNewPost);
                AddMsgFunc((int)C2S_CmdID.emUpdatePost, msgFunc.OnUpdatePost);
                AddMsgFunc((int)C2S_CmdID.emDeletePost, msgFunc.OnDeletePost);
                AddMsgFunc((int)C2S_CmdID.emAddLike, msgFunc.OnAddLike);
                AddMsgFunc((int)C2S_CmdID.emReduceLike, msgFunc.OnReduceLike);
                AddMsgFunc((int)C2S_CmdID.emUpdatePostShowList, msgFunc.OnUpdatePostShowList);

                qTimer.Start();

                ret = true;

                SaveLog("[Info] MessageProcessor::Initialize, Initialize Success");
            }
            else
            {
                SaveLog("[Error] MessageProcessor::Initialize, Initialize Fail");
            }

            return(ret);
        }
Exemple #2
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="logger"> Logger物件 </param>
        /// <returns> 是否初始化成功 </returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = true;

            this.logger = logger;

            if (msgFunc.Initialize(logger))
            {
                AddMsgFunc((int)C2S_CmdID.emCreateRideRecord, msgFunc.OnCreateRideRecord);
                AddMsgFunc((int)C2S_CmdID.emUpdateRideGroup, msgFunc.OnUpdateRideGroup);
                AddMsgFunc((int)C2S_CmdID.emUpdateInviteList, msgFunc.OnUpdateInviteList);
                AddMsgFunc((int)C2S_CmdID.emReplyRideGroup, msgFunc.OnReplyRideGroup);
                AddMsgFunc((int)C2S_CmdID.emUpdateCoordinate, msgFunc.OnUpdateCoordinate);
                AddMsgFunc((int)C2S_CmdID.emNotifyRideGroupMember, msgFunc.OnNotifyRideGroupMember);

                qTimer.Start();

                ret = true;

                SaveLog("[Info] MessageProcessor::Initialize, Initialize Success");
            }
            else
            {
                SaveLog("[Error] MessageProcessor::Initialize, Initialize Fail");
            }

            return(ret);
        }
Exemple #3
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns> 是否初始化成功</returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = false;

            try
            {
                gRpcImpl = new GRPCImpl();

                if (this.LoadConfig() && gRpcImpl.Initialize(logger, MessageProcessor.Instance.AddQueue))
                {
                    this.logger = logger;

                    ret = CreatServer(gRpcImpl);
                }
                else
                {
                    SaveLog("[Error] GRPCServer::Initialize, Initialize Fail");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");

                SaveLog($"[Error] GRPCServer::Initialize, Catch Error, Msg:{ex.Message}");
            }

            return(ret);
        }
Exemple #4
0
        public bool Initialize(Logger logger)
        {
            bool ret = false;

            try
            {
                this.logger = logger;

                if (RedisConnect.Instance.Initialize(logger) && RedisConnect.Instance.Connect())
                {
                    ret = true;

                    SaveLog($"[Info] RedisHandler::Initialize, Success");
                }
                else
                {
                    SaveLog($"[Info] RedisHandler::Initialize, Fail");
                }
            }
            catch (Exception ex)
            {
                SaveLog($"[Error] RedisHandler::Initialize, Catch Error, Msg:{ex.Message}");
            }

            return(ret);
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="logger"> Logger物件 </param>
        /// <returns> 是否初始化成功 </returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = true;

            this.logger = logger;

            if (msgFunc.Initialize(logger))
            {
                AddMsgFunc((int)C2S_CmdID.emCreateNewTeam, msgFunc.OnCreateNewTeam);
                AddMsgFunc((int)C2S_CmdID.emUpdateTeamData, msgFunc.OnUpdateTeamData);
                AddMsgFunc((int)C2S_CmdID.emChangeLander, msgFunc.OnChangeLander);
                AddMsgFunc((int)C2S_CmdID.emUpdateViceLeaderList, msgFunc.OnUpdateViceLeaderList);
                //AddMsgFunc((int)C2S_CmdID.emUpdateTeamMemberList, msgFunc.OnUpdateTeamMemberList); 不使用
                AddMsgFunc((int)C2S_CmdID.emUpdateApplyJoinList, msgFunc.OnUpdateApplyJoinList);
                AddMsgFunc((int)C2S_CmdID.emUpdateBulletin, msgFunc.OnUpdateBulletin);
                AddMsgFunc((int)C2S_CmdID.emUpdateActivity, msgFunc.OnUpdateActivity);
                AddMsgFunc((int)C2S_CmdID.emDeleteTeam, msgFunc.OnDeleteTeam);
                AddMsgFunc((int)C2S_CmdID.emJoinOrLeaveTeamActivity, msgFunc.OnJoinOrLeaveTeamActivity);
                AddMsgFunc((int)C2S_CmdID.emJoinOrLeaveTeam, msgFunc.OnJoinOrLeaveTeam);
                AddMsgFunc((int)C2S_CmdID.emKickTeamMember, msgFunc.OnKickTeamMember);

                qTimer.Start();

                ret = true;

                SaveLog("[Info] MessageProcessor::Initialize, Initialize Success");
            }
            else
            {
                SaveLog("[Error] MessageProcessor::Initialize, Initialize Fail");
            }

            return(ret);
        }
Exemple #6
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="logger"> Logger物件 </param>
        /// <returns> 是否成功初始化 </returns>
        public bool Initialize(Logger logger)
        {
            bool bReturn = true;

            try
            {
                this.logger = logger;

                if (LoadingConfig())
                {
                    bReturn = true;

                    SaveLog($"[Info] NotifyMessage::Initialize, Initialize Success");
                }
                else
                {
                    SaveLog("[Error] NotifyMessage::Initialize, LoadingConfig Fail");
                }
            }
            catch (Exception ex)
            {
                SaveLog($"[Error] NotifyMessage::Initialize, Catch Error Msg:{ex.Message}");
            }

            return(bReturn);
        }
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="logger"> Logger物件 </param>
        /// <returns> 是否初始化成功 </returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = true;

            this.logger = logger;

            if (msgFunc.Initialize(logger))
            {
                AddMsgFunc((int)C2S_CmdID.emUserLogin, msgFunc.OnUserLogin);
                AddMsgFunc((int)C2S_CmdID.emUpdateUserInfo, msgFunc.OnUpdateUserInfo);
                AddMsgFunc((int)C2S_CmdID.emUpdateFriendList, msgFunc.OnUpdateFriendList);
                AddMsgFunc((int)C2S_CmdID.emUpdateBlackList, msgFunc.OnUpdateBlackList);
                AddMsgFunc((int)C2S_CmdID.emUpdateNotifyToken, msgFunc.OnUpdateNotifyToken);
                AddMsgFunc((int)C2S_CmdID.emGetNewFriendList, msgFunc.onGetNewFriendList);

                qTimer.Start();

                ret = true;

                SaveLog("[Info] MessageProcessor::Initialize, Initialize Success");
            }
            else
            {
                SaveLog("[Error] MessageProcessor::Initialize, Initialize Fail");
            }

            return(ret);
        }
Exemple #8
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns> 是否初始化成功</returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = false;

            try
            {
                if (this.LoadConfig())
                {
                    this.logger = logger;

                    ret = true;
                }
                else
                {
                    SaveLog("[Error] GRPCClient::Initialize, Initialize Fail");
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");

                SaveLog($"[Error] GRPCClient::Initialize, Catch Error, Msg:{ex.Message}");
            }

            return(ret);
        }
Exemple #9
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <param name="logger"> Logger物件 </param>
        /// <returns> 是否初始化成功 </returns>
        public bool Initialize(Tools.Logger logger)
        {
            bool ret = true;

            this.logger = logger;

            AddAlgorithmFunc(AlgorithmType.ByDateTime, this.GetPostShowListByDateTime);

            ret = true;

            SaveLog("[Info] MessageProcessor::Initialize, Initialize Success");

            return(ret);
        }
Exemple #10
0
        /**
         * 初始化
         */
        public bool Initialize(Tools.Logger logger, AddQueueDelegate AddQueue)
        {
            bool ret = false;

            try
            {
                if (LoadingConfig())
                {
                    this.logger = logger;

                    this.AddQueue = AddQueue;

                    wsServer = new WebSocketServer($"ws://{serverIp}:{serverPort}");
                    wsServer.AddWebSocketService(serviceName, () => new Handler(SaveLog, AddJob));

                    wsServer.Start();
                    if (wsServer.IsListening)
                    {
                        ret = true;

                        SaveLog($"[Info] Create Client Handler Success");

                        Console.WriteLine("[Info] Listening on port {0}, and providing WebSocket services:", wsServer.Port);
                        foreach (var path in wsServer.WebSocketServices.Paths)
                        {
                            Console.WriteLine("- {0}", path);
                        }
                    }
                }
                else
                {
                    SaveLog($"[Error] Create Client Handler Fail");
                }
            }
            catch (Exception ex)
            {
                SaveLog($"[Error] ClientHandler::Initialize, Catch Msg: {ex.Message}");
            }

            return(ret);
        }
Exemple #11
0
        /// <summary>
        /// 初始化
        /// </summary>
        /// <returns> 是否初始化成功</returns>
        public bool Initialize(Tools.Logger logger, AddQueueDelegate addQueue)
        {
            bool ret = false;

            try
            {
                this.logger = logger;

                this.addQueue = addQueue;

                ret = true;
            }
            catch (Exception ex)
            {
                Console.WriteLine($"{ex.Message}");

                SaveLog("[Error] gRpcImpl::Initialize, Initialize Fail");
            }

            return(ret);
        }