public static object CheckAndProcessMessage(this WorldModel world, User user, dynamic message, out string errorMessage) { // fark why don't contracts work omg //Contract.Requires<ArgumentNullException>(message != null); // world and user are set as context so that process message doesn't need to pass them for every call _world = world; _user = user; errorMessage = null; /* // new connection... only allow login); if (!user.Authenticated && !(message is Login)) { errorMessage = "Non-login message " + message.GetType(); return null; } if (user.Avatar == null && !(message is Login)) { errorMessage = "ERROR: Non-posses message " + message.GetType(); return null; } */ try { var result = ProcessMessage(message); _log.Debug("Processed message " + message); return result; } catch (Exception exception) { _log.Warn("Unable to process message " + message, exception); errorMessage = exception.Message; } return null; }
public CommandPending(int id, User user, object command) { Id = id; User = user; Command = command; }