protected virtual bool HasMagic(Stream stream, byte[] magic, int offset) { if (stream.Length <= magic.Length) { return(false); } var buffer = new byte[magic.Length]; var pos = stream.Position; stream.Position = offset; stream.Read(buffer, 0, buffer.Length); var result = ByteUtils.BuffersAreEqual(magic, buffer); stream.Position = pos; return(result); }