Exemple #1
0
        private void Parse(string s)
        {
            // КОМАНДА=ЗНАЧЕНИЕ (LOGIN=Иван)
            char[] sep = { '=' };
            var    cd  = s.Split(sep, 2);

            switch (cd[0])
            {
            case "LOGIN":
            {
                LoginCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "MESSAGE":
            {
                MessageCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "USERLIST":
            {
                UserListCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "START":
            {
                StartCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }
            }
        }
Exemple #2
0
        private void Parse(string s)
        {
            // КОМАНДА=ЗНАЧЕНИЕ (LOGIN=Иван)
            char[] sep = { '=' };
            var    cd  = s.Split(sep, 2);

            switch (cd[0])
            {
            case "LOGIN":
            {
                LoginCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "LOGIN1":
            {
                EventError?.Invoke(0);
                break;
            }

            case "MESSAGE":
            {
                MessageCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "MESSAGE1":
            {
                PrivateMessage?.Invoke(cd[0], cd[1]);
                break;
            }

            case "USERLIST":
            {
                UserListCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "START":
            {
                StartCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "ERROR":
            {
                EventComment?.Invoke("Нет пользователя");
                break;
            }
            }
        }
Exemple #3
0
        private void Parse(string s)
        {
            // КОМАНДА=ЗНАЧЕНИЕ (LOGIN=Иван)
            char[] sep = { '=' };
            var    cd  = s.Split(sep, 2);

            switch (cd[0])
            {
            case "LOGIN":
            {
                LoginCmdReceived?.Invoke(cd[0], cd[1]);
                //UserListCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "MESSAGE":
            {
                MessageCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "USERLIST":
            {
                UserListCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "START":
            {
                StartCmdReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "ERROR":
            {
                ErrorReceived?.Invoke(cd[0], cd[1]);
                break;
            }

            case "PRIVATEMESSAGE":
            {
                var pm = cd[1].Split('@');
                PrivateReceived?.Invoke(pm[0], pm[1]);
                break;
            }
            }
        }