public static Locations[] Read_Locations(Stream s) { helper help = new helper(); Locations l = new Locations(); Locations[] result = new Locations[Header.LocationCount]; uint[] index = new uint[Header.LocationCount]; ulong[] offset = new ulong[Header.LocationCount]; uint pos = 0; byte[] block = ReturnBlock(s, l.SizeOf); for (uint i = 0; i < Header.LocationCount; i++) { offset[i] = help.ReadBits(block, pos, Header.LocationBitCount); pos += Header.LocationBitCount; index[i] = i; } Array.Sort(offset, index); for (uint i = 0; i < Header.LocationCount; i++) { result[i] = new Locations(); result[i].index = index[i]; result[i].offset = offset[i]; } return(result); }
public static SortedFileInfo[] Read_SortedFileInfo(Stream s) { SortedFileInfo[] result = new SortedFileInfo[Header.FileCount]; helper help = new helper(); SortedFileInfo sfi = new SortedFileInfo(); s.Position = HeaderSize; byte[] Htable = ReturnBlock(s, sfi.SizeOf); uint position = 0; for (uint i = 0; i < Header.FileCount; i++) { result[i] = new SortedFileInfo(); result[i].dwHash = help.ReadBits(Htable, position, 64); position += 64; result[i].nSize = (uint)help.ReadBits(Htable, position, Header.FileSizeBitCount); position += Header.FileSizeBitCount; result[i].nLocationCount = (uint)help.ReadBits(Htable, position, Header.FileLocationCountBitCount); position += Header.FileLocationCountBitCount; result[i].nLocationIndex = (uint)help.ReadBits(Htable, position, Header.FileLocationIndexBitCount); position += Header.FileLocationIndexBitCount; } return(result); }
public static CompressedSectorToDecompressedOffset[] Read_CompressedSectorToDecompressedOffset(Stream s) { helper help = new helper(); CompressedSectorToDecompressedOffset c = new CompressedSectorToDecompressedOffset(); uint pos = 0; byte[] block = ReturnBlock(s, c.SizeOf); CompressedSectorToDecompressedOffset[] result = new CompressedSectorToDecompressedOffset[Header.CompSectorCount]; for (uint i = 0; i < Header.CompSectorCount; i++) { result[i] = new CompressedSectorToDecompressedOffset(); result[i].SectorIndex = i; result[i].DecompressedOffset = help.ReadBits(block, pos, Header.LocationBitCount); pos += Header.LocationBitCount; } return(result); }
public static DecompressedSectorToCompressedSector[] Read_DecompressedSectorToCompressedSector(Stream s) { helper help = new helper(); uint temp = help.GetHighestBit(Header.CompSectorCount); DecompressedSectorToCompressedSector d = new DecompressedSectorToCompressedSector(); uint sector = (((uint)Header.DecompressedFileSize + (uint)Header.CompSectorSize - 1) / (uint)Header.CompSectorSize); uint pos = 0; byte[] block = ReturnBlock(s, d.SizeOf); DecompressedSectorToCompressedSector[] result = new DecompressedSectorToCompressedSector[sector]; for (uint i = 0; i < sector; i++) { result[i] = new DecompressedSectorToCompressedSector(); result[i].DecompressedSector = i; result[i].CompressedSector = help.ReadBits(block, pos, temp); pos += temp; } return(result); }