public static void Initialize() { if (Interface.CallHook("IOnRconInitialize") != null) { return; } if (Port == 0) { Port = Server.port; } Password = CommandLine.GetSwitch("-rcon.password", CommandLine.GetSwitch("+rcon.password", "")); if (Password == "password" || Password == "") { return; } Output.OnMessage += OnMessage; if (Web) { listenerNew = new Listener(); if (!string.IsNullOrEmpty(Ip)) { listenerNew.Address = Ip; } listenerNew.Password = Password; listenerNew.Port = Port; listenerNew.SslCertificate = CommandLine.GetSwitch("-rcon.ssl", null); listenerNew.SslCertificatePassword = CommandLine.GetSwitch("-rcon.sslpwd", null); listenerNew.OnMessage = delegate(IPAddress ip, int id, string msg) { lock (Commands) { Command item = JsonConvert.DeserializeObject <Command>(msg); item.Ip = ip; item.ConnectionId = id; Commands.Enqueue(item); } }; listenerNew.Start(); Debug.Log("WebSocket RCon Started on " + Port); } else { listener = new RConListener(); Debug.Log("RCon Started on " + Port); Debug.Log("Source style TCP Rcon is deprecated. Please switch to Websocket Rcon before it goes away."); } }
public static void Initialize() { if (Interface.CallHook("IOnRconInitialize") != null) { return; } if (RCon.Port == 0) { RCon.Port = Server.port; } RCon.Password = CommandLine.GetSwitch("-rcon.password", CommandLine.GetSwitch("+rcon.password", "")); if (RCon.Password == "password" || RCon.Password == "") { return; } Output.OnMessage += new Action <string, string, UnityEngine.LogType>(RCon.OnMessage); if (RCon.Web) { RCon.listenerNew = new Listener(); if (!string.IsNullOrEmpty(RCon.Ip)) { RCon.listenerNew.Address = (__Null)RCon.Ip; } RCon.listenerNew.Password = (__Null)RCon.Password; RCon.listenerNew.Port = (__Null)RCon.Port; RCon.listenerNew.SslCertificate = (__Null)CommandLine.GetSwitch("-rcon.ssl", (string)null); RCon.listenerNew.SslCertificatePassword = (__Null)CommandLine.GetSwitch("-rcon.sslpwd", (string)null); RCon.listenerNew.OnMessage = (__Null)((ip, id, msg) => { lock (RCon.Commands) { RCon.Command command = (RCon.Command)JsonConvert.DeserializeObject <RCon.Command>(msg); command.Ip = ip; command.ConnectionId = id; RCon.Commands.Enqueue(command); } }); RCon.listenerNew.Start(); Debug.Log((object)("WebSocket RCon Started on " + (object)RCon.Port)); } else { RCon.listener = new RCon.RConListener(); Debug.Log((object)("RCon Started on " + (object)RCon.Port)); Debug.Log((object)"Source style TCP Rcon is deprecated. Please switch to Websocket Rcon before it goes away."); } }