public long UnpackLong() { byte markerByte = _in.ReadByte(); if ((sbyte)markerByte >= MINUS_2_TO_THE_4) { return((sbyte)markerByte); } switch (markerByte) { case INT_8: return(_in.ReadSByte()); case INT_16: return(_in.ReadShort()); case INT_32: return(_in.ReadInt()); case INT_64: return(_in.ReadLong()); default: throw new ArgumentOutOfRangeException(nameof(markerByte), markerByte, $"Expected an integer, but got: 0x{markerByte.ToString("X2")}"); } }
public void Read(IInputStream input) { this.head = input.ReadBytes(4); this.headerSize = input.ReadInt(); this.versionNum = input.ReadInt(); this.archiveSize = input.ReadInt(); this.entriesCount = input.ReadInt(); this.entriesOffset = input.ReadInt(); this.blocksOffset = input.ReadInt(); }
public static Index Parse(IInputStream stream) { byte[][] data = new byte[stream.ReadUnsignedShort()][]; { int[] offsets = new int[data.Length + 1]; int offSize = stream.ReadByte(); for (int index = 0, count = offsets.Length; index < count; index++) { offsets[index] = stream.ReadInt(offSize); } for (int index = 0, count = data.Length; index < count; index++) { stream.Read(data[index] = new byte[offsets[index + 1] - offsets[index]]); } } return(new Index(data)); }
public void Read(IInputStream input) { this.hashA = input.ReadLong(); this.hashB = input.ReadLong(); this.index = input.ReadInt(); this.keySize = input.ReadInt(); this.key = UTF8Encoding.UTF8.GetString(input.ReadBytes(keySize), 0, keySize); this.fileDate = input.ReadInt(); this.fileMD5Size = input.ReadInt(); this.fileMD5 = UTF8Encoding.UTF8.GetString(input.ReadBytes(fileMD5Size), 0, fileMD5Size); this.fileOffset = input.ReadInt(); this.fileSize = input.ReadInt(); }