public static ServerAccessDenied Parse(byte[] Data) { var parsedMessage = new ServerAccessDenied(); parsedMessage.Unused_0 = BitConverter.ToInt32(Data, 0); parsedMessage.Reason = BitConverter.ToInt32(Data, 4); return(parsedMessage); }
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); } }
private static void ServerManager_MessageReceived(ServerMessage msg) { switch (msg.Name) { case "mudhack_users": UsersReceived?.Invoke(JsonConvert.DeserializeObject <List <OnlineUser> >(msg.Contents)); break; case "mudhack_init": ServerPasswordGenerated?.Invoke(msg.Contents); break; case "mudhack_denied": ServerAccessDenied?.Invoke(); break; case "mudhack_granted": ServerAccessGranted?.Invoke(); break; case "getguid_fromserver": if (SaveSystem.CurrentSave.Username == msg.Contents) { client.Send(new NetObject("yes_i_am", new ServerMessage { Name = "getguid_reply", GUID = msg.GUID, Contents = thisGuid.ToString(), })); } break; case "getguid_reply": GUIDReceived?.Invoke(msg.Contents); break; } }