コード例 #1
0
ファイル: ConsoleManager.cs プロジェクト: uitchinhln/PacChat
        public ConsoleManager()
        {
            Setup();
            consoleReader = new Thread(() =>
            {
                String input;
                while (!IsStop)
                {
                    try
                    {
                        input = Console.ReadLine();
                        DeletePrevConsoleLine();
                        PacChatServer.GetServer().Logger.Info(input);

                        if (input == null || input.Trim().Length == 0)
                        {
                            continue;
                        }

                        CommandManager.Instance.ExecuteCommand(ConsoleSender.Instance, input);
                    } catch (Exception e)
                    {
                        PacChatServer.GetServer().Logger.Error(e);
                    }
                }
            });
            consoleReader.Start();
        }
コード例 #2
0
        public static ChatUser LoadUser(Guid id)
        {
            if (OnlineUsers.ContainsKey(id))
            {
                return(OnlineUsers[id]);
            }

            ChatUser result = null;

            try
            {
                result = new ChatUserStore().Load(id);
                if (result != null)
                {
                    ConversationStore conversationStore = new ConversationStore();
                    long time = 0;
                    foreach (Guid cid in result.ConversationID)
                    {
                        time = conversationStore.GetLastActive(cid);
                        result.Conversations.TryAdd(cid, time);
                    }
                }
            } catch (Exception e)
            {
                PacChatServer.GetServer().Logger.Error(e);
            }

            return(result);
        }
コード例 #3
0
ファイル: PacChatServer.cs プロジェクト: uitchinhln/PacChat
        public PacChatServer()
        {
            instance = this;
            new ServerSettings();

            protocolProvider = new ProtocolProvider();
            SessionRegistry  = new SessionRegistry();

            Mongo.StartService();
            ProfileCache.StartService();
            CommandManager.StartService();

            RegisterCommand();

            Sticker.StartService();

            StartNetworkService();
        }