public void Read(HsdfFile header, FileReader reader) { Name = ((NameBlock)header.ReadBlock(reader)).Name; uint size = reader.ReadUInt32(); CompressionFlags = reader.ReadUInt32(); Data = reader.ReadBytes((int)size); if (CompressionFlags == 1) { Data = LZ77.Decompress(Data); } }
public void Read(HsdfFile header, FileReader reader) { Name = ((NameBlock)header.ReadBlock(reader)).Name; Format = (NitroTex.NitroTexFormat)reader.ReadUInt32(); Width = reader.ReadUInt16(); Height = reader.ReadUInt16(); Params = reader.ReadUInt32(); uint textureSize = reader.ReadUInt32(); uint tex4x4Size = reader.ReadUInt32(); CompressionFlags = reader.ReadUInt32(); ImageData = reader.ReadBytes((int)textureSize); if (CompressionFlags == 1) { ImageData = LZ77.Decompress(ImageData); } ImageData4x4 = reader.ReadBytes((int)tex4x4Size); }
void Read(string FileName, System.IO.Stream stream) { using (var reader = new FileReader(stream)) { reader.SetByteOrder(false); uint numFiles = reader.ReadUInt32(); for (int i = 0; i < numFiles; i++) { reader.SeekBegin(4 + (i * 8)); uint offset = reader.ReadUInt32(); uint size = reader.ReadUInt32(); reader.SeekBegin(offset + 4); var file = new FileEntry(); file.SetData(LZ77.Decompress(reader.ReadBytes((int)size))); files.Add(file); } } UpdateFileNames(FileName); }