Ejemplo n.º 1
0
            public static WatchMessage Parse(byte[] Data)
            {
                var parsedWatchMessage = new WatchMessage();

                parsedWatchMessage.Unused_0 = BitConverter.ToInt32(Data, 0);
                parsedWatchMessage.Unkown_0 = BitConverter.ToInt32(Data, 4);

                parsedWatchMessage.Username = getString(Data, 8, Data.Length - 0 - 8);

                parsedWatchMessage.Unkown_1 = Data.Last();
                return(parsedWatchMessage);
            }
Ejemplo n.º 2
0
        public static IMessageStruct ParseMessageData(Message message)
        {
            switch ((Message.TYPE_ID)message.TypeID)
            {
            case Message.TYPE_ID.FIRST_SECURE_MESSAGE:
                return(FirstSecureMessage.Parse(message.Data));

            case Message.TYPE_ID.FIRST_SECURE_MESSAGE_SERVER:
                return(FirstSecureMessageServer.Parse(message.Data));

            case Message.TYPE_ID.GENERATE_SECURITY_CONTEXT:
                return(GenerateSecurityContext.Parse(message.Data));

            case Message.TYPE_ID.SECURITY_CONTEXT_SERVER_MSG:
                return(SecurityContextServer.Parse(message.Data));

            case Message.TYPE_ID.AUTHENTICATE_MSG:
                return(AuthenticateMessage.Parse(message.Data));

            case Message.TYPE_ID.SERVER_ACCESS_GRANTED:
                return(ServerAccessGranted.Parse(message.Data));

            case Message.TYPE_ID.SERVER_ACCESS_DENIED:
                return(ServerAccessDenied.Parse(message.Data));

            case Message.TYPE_ID.CONNECT_MSG:
                return(ConnectMessage.Parse(message.Data));

            case Message.TYPE_ID.CONNECT_ACK_MSG:
                return(ConnectAckMessage.Parse(message.Data));

            case Message.TYPE_ID.STATE_MSG:
                return(StateMessage.Parse(message.Data));

            case Message.TYPE_ID.USER_MSG:
                return(UserMessage.Parse(message.Data));

            case Message.TYPE_ID.ERROR_MSG:
                return(ErrorMessage.Parse(message.Data));

            case Message.TYPE_ID.WATCH_MSG:
                return(WatchMessage.Parse(message.Data));

            case Message.TYPE_ID.DATA_MSG:
                return(DataMessage.Parse(message.Data));

            default:
                return(null);
            }
        }