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); } }