/// <summary> /// Load file from Stream /// </summary> /// <param name="stream">The stream to read data from</param> /// <param name="autoDecompress">Automatically check for full file compression</param> /// <param name="keepOpen">Should the stream be kept open?</param> public virtual void Load(Stream stream, bool autoDecompress = true, bool keepOpen = false) { var reader = new ExtendedBinaryReader(stream); if (autoDecompress) { // Decompress Zlib stream if (reader.PeekSignature() == "ZLIB") { // Skip ZLIB Header reader.JumpAhead(14); // Decompress stream using (var deflate = new DeflateStream(reader.BaseStream, CompressionMode.Decompress, false)) reader.SetStream(deflate.CacheStream()); // Set Endianness of the reader reader.SetEndian(UseBigEndian); // Parse file Load(reader); return; } } // Set Endianness of the reader reader.SetEndian(UseBigEndian); // Parse File Load(reader, keepOpen); }