public NoxBinaryWriter(Stream stream, CryptApi.NoxCryptFormat format) : base(stream) { this.format = format; }
public NoxBinaryReader(Stream stream, CryptApi.NoxCryptFormat format) : base(CryptApi.DecryptStream(stream, format)) { }
public static Stream DecryptStream(Stream stream, CryptApi.NoxCryptFormat format) { //return original stream if no encryption if (format == CryptApi.NoxCryptFormat.NONE) return stream; int length = (int) stream.Length; byte[] buffer = new byte[length]; stream.Read(buffer, 0, length); stream.Close(); buffer = CryptApi.NoxDecrypt(buffer, format); return new MemoryStream(buffer); }