static public void ThrowIfFalse(bool flag, string msg, AppWebSocketBehavior behavior) { if (!flag) { ThrowError(msg, behavior); } }
static public void ThrowIfNotNull(object obj, string msg, AppWebSocketBehavior behavior) { if (obj != null) { ThrowError(msg, behavior); } }
static private void LogMessage(string message, AppWebSocketBehavior behavior) { Player currentPlayer = behavior.GetCurrentSessionPlayer(); string playerName = currentPlayer != null ? currentPlayer.Name : "unknown"; string connection = ""; try { connection = behavior.Context.UserEndPoint.ToString(); } catch { }; Console.WriteLine($"{DateTime.Now},{connection},{playerName},{message}"); }
public MessageHandler(AppWebSocketBehavior serviceBehavior) { _websocket = serviceBehavior; _server = Server.Instance; }
public GuestRequestFullStateMessageHandler(AppWebSocketBehavior serviceBehavior) : base(serviceBehavior) { }
public AuthenticationHandler(AppWebSocketBehavior serviceBehavior) : base(serviceBehavior) { }
public GameCommandChangeHandler(AppWebSocketBehavior serviceBehavior) : base(serviceBehavior) { }
static private void ThrowError(string msg, AppWebSocketBehavior behavior) { LogMessage($"{msg},{Environment.StackTrace}", behavior); throw new Exception(msg); }
public ChatMessageHandler(AppWebSocketBehavior serviceBehavior) : base(serviceBehavior) { }
public StateChangeMessageHandler(AppWebSocketBehavior serviceBehavior) : base(serviceBehavior) { }
public MiceChangeHandler(AppWebSocketBehavior serviceBehavior) : base(serviceBehavior) { }