public void Handle(object data, Server_ServerClient client) { Console.WriteLine("DB - Data type recieved of type " + data.GetType().ToString()); if (commandHandler.Contains(data.GetType())) { commandHandler.Execute(data.GetType(), data, client); } }
/// <summary> /// The method responsible for getting a serialized object /// and giving it to the correct handler /// </summary> /// <param name="data"></param> /// <param name="client"></param> public void Handle(object data, Server_ServerClient client) { Console.WriteLine("Data type recieved of type " + data.GetType().ToString()); if (commandHandler.Contains(data.GetType())) { commandHandler.Execute(data.GetType(), data, client); } else { Console.WriteLine("Data type UNKNOWN! Type: " + data.GetType().ToString()); throw new Exception("Data type UNKNOWN! Type: " + data.GetType().ToString()); } }