Ejemplo n.º 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;
            }
            }
        }
Ejemplo n.º 2
0
        private void Parse(string s)
        {
            // КОМАНДА=ЗНАЧЕНИЕ (LOGIN=Иван)
            char[] sep = { '=' };
            var    cd  = s.Split(sep, 2);

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

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

            case "ERROR":
            {
                EventNeedInverse?.Invoke(cd[1]);
                break;
            }
            }
        }
Ejemplo n.º 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]);
                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;
            }
            }
        }
Ejemplo n.º 4
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;
            }
            }
        }