public static bool IsResource(Stream stream) { var rh = new ResourceHeader(); rh.Read(new BinaryReader(stream)); return(rh.Magic == ResourceHeader.MagicValue); }
public static void GetResourceData(Stream stream, out uint flags, out ResourceType type) { var rh = new ResourceHeader(); rh.Read(new BinaryReader(stream)); flags = rh.Flags; type = rh.Type; }
public static void GetResourceData(Stream stream, out uint flags, out ResourceType type) { var rh = new ResourceHeader(); rh.Read(new BinaryReader(stream)); flags = rh.Flags; type = rh.Type; }
public void Read(Stream data) { _header = new ResourceHeader(); var br = new BinaryReader(data); _header.Read(br); if (_header.Magic != ResourceHeader.MagicValue) { throw new Exception("Not a valid resource"); } switch (_header.CompressCodec) { case CompressionType.LZX: _codec = CompressionCodecFactory.LZX; break; case CompressionType.Deflate: _codec = CompressionCodecFactory.Deflate; break; default: throw new ArgumentOutOfRangeException(); } var ms = new MemoryStream(); _codec.Decompress(data, ms); ms.Seek(0, SeekOrigin.Begin); _systemMemData = new byte[SystemMemSize]; ms.Read(_systemMemData, 0, SystemMemSize); _graphicsMemData = new byte[GraphicsMemSize]; ms.Read(_graphicsMemData, 0, GraphicsMemSize); ms.Close(); }
public void Read(Stream data) { _header = new ResourceHeader(); var br = new BinaryReader(data); _header.Read(br); if (_header.Magic != ResourceHeader.MagicValue) { throw new Exception("Not a valid resource"); } switch (_header.CompressCodec) { case CompressionType.LZX: _codec = CompressionCodecFactory.LZX; break; case CompressionType.Deflate: _codec = CompressionCodecFactory.Deflate; break; default: throw new ArgumentOutOfRangeException(); } var ms = new MemoryStream(); _codec.Decompress( data, ms ); ms.Seek(0, SeekOrigin.Begin); _systemMemData = new byte[SystemMemSize]; ms.Read(_systemMemData, 0, SystemMemSize); _graphicsMemData = new byte[GraphicsMemSize]; ms.Read(_graphicsMemData, 0, GraphicsMemSize); ms.Close(); }
public static bool IsResource(Stream stream) { var rh = new ResourceHeader(); rh.Read(new BinaryReader(stream)); return rh.Magic == ResourceHeader.MagicValue; }