internal static Rcon Authorize(IPEndPoint address, string msg) { RconSource obj = new RconSource(address); byte[] recvData = new byte[50]; RconSrcPacket packet = new RconSrcPacket() { Body = msg, Id = (int)PacketId.ExecCmd, Type = (int)PacketType.Auth }; recvData = obj.socket.GetResponse(RconUtil.GetBytes(packet)); int header; try { header = BitConverter.ToInt32(recvData, 4); } catch (Exception e) { e.Data.Add("ReceivedData", recvData); throw; } if (header != -1) { return obj; } else { throw new System.Exception(); } obj.socket.Dispose(); return obj; }
internal static Rcon Authorize(IPEndPoint address, string msg) { RconSource obj = new RconSource(address); byte[] recvData = new byte[50]; RconSrcPacket packet = new RconSrcPacket() { Body = msg, Id = (int)PacketId.ExecCmd, Type = (int)PacketType.Auth }; recvData = obj.socket.GetResponse(RconUtil.GetBytes(packet)); int header; try { header = BitConverter.ToInt32(recvData, 4); } catch (Exception e) { e.Data.Add("ReceivedData", recvData); throw; } if (header != -1) { return(obj); } obj.socket.Dispose(); return(obj); }
public override Rcon GetControl(string pass) { RConObj = RconSource.Authorize(socket.Address, pass); return(RConObj); }