public bool SendCryptKey() { byte[] array = new byte[] { 7, 0, 0, 37, 10, 69, 110, 99, 114, 121, 112, 116, 105, 111, 110, 255 }; RustProtectFlag rustProtectFlag = RustProtectFlag.Disabled; if (Truth.RustProtect) { rustProtectFlag = RustProtectFlag.Enabled; if (Truth.RustProtectSteamHWID) { rustProtectFlag |= RustProtectFlag.UserHWID; } if (Truth.RustProtectSnapshots) { rustProtectFlag |= RustProtectFlag.Snapshot; } } bool result; using (MemoryStream memoryStream = new MemoryStream()) { using (BinaryWriter binaryWriter = new BinaryWriter(memoryStream)) { binaryWriter.Write(array, 0, array.Length); binaryWriter.Write((byte)rustProtectFlag); binaryWriter.Write(Truth.RustProtectSnapshotsPacketSize); binaryWriter.Write(this.byte_0); if (this.socket_0 != null && this.endPoint_0 != null && this.socket_0.Connected) { if (server.log >= 2 && Core.Debug) { Helper.Log("RustProtect: Packet with crypt key sended for '" + this.endPoint_0 + "'", true); } result = ((long)this.socket_0.SendTo(memoryStream.GetBuffer(), 0, (int)memoryStream.Length, SocketFlags.None, this.endPoint_0) == memoryStream.Length); return(result); } } } result = false; return(result); }
public bool SendCryptKey() { byte[] buffer = new byte[] { 7, 0, 0, 0x25, 10, 0x45, 110, 0x63, 0x72, 0x79, 0x70, 0x74, 0x69, 0x6f, 110, 0xff }; RustProtectFlag disabled = RustProtectFlag.Disabled; if (Truth.RustProtect) { disabled = RustProtectFlag.Enabled; if (Truth.RustProtectSteamHWID) { disabled = (RustProtectFlag)((byte)(disabled | RustProtectFlag.UserHWID)); } if (Truth.RustProtectSnapshots) { disabled = (RustProtectFlag)((byte)(disabled | RustProtectFlag.Snapshot)); } } using (MemoryStream stream = new MemoryStream()) { using (BinaryWriter writer = new BinaryWriter(stream)) { writer.Write(buffer, 0, buffer.Length); writer.Write((byte)disabled); writer.Write(Truth.RustProtectSnapshotsPacketSize); writer.Write(this.byte_0); if (((this.socket_0 != null) && (this.endPoint_0 != null)) && this.socket_0.Connected) { if ((server.log >= 2) && Core.Debug) { Helper.Log("RustProtect: Packet with crypt key sended for '" + this.endPoint_0 + "'", true); } return(this.socket_0.SendTo(stream.GetBuffer(), 0, (int)stream.Length, SocketFlags.None, this.endPoint_0) == stream.Length); } } } return(false); }