private void ReadHeader(FileStream fs) { TRPReader.TRPHeader trpHeader = new TRPReader.TRPHeader(); trpHeader.magic = new byte[4]; trpHeader.version = new byte[4]; trpHeader.file_size = new byte[8]; trpHeader.files_count = new byte[4]; trpHeader.element_size = new byte[4]; trpHeader.dev_flag = new byte[4]; trpHeader.sha1 = new byte[20]; trpHeader.padding = new byte[36]; fs.Read(trpHeader.magic, 0, trpHeader.magic.Length); fs.Read(trpHeader.version, 0, trpHeader.version.Length); fs.Read(trpHeader.file_size, 0, trpHeader.file_size.Length); fs.Read(trpHeader.files_count, 0, trpHeader.files_count.Length); fs.Read(trpHeader.element_size, 0, trpHeader.element_size.Length); fs.Read(trpHeader.dev_flag, 0, trpHeader.dev_flag.Length); switch (TRPReader.byteArrayToLittleEndianInteger(trpHeader.version)) { case 1: fs.Read(trpHeader.padding, 0, trpHeader.padding.Length); break; case 2: fs.Read(trpHeader.sha1, 0, trpHeader.sha1.Length); trpHeader.padding = new byte[16]; fs.Read(trpHeader.padding, 0, trpHeader.padding.Length); break; case 3: fs.Read(trpHeader.sha1, 0, trpHeader.sha1.Length); trpHeader.padding = new byte[48]; fs.Read(trpHeader.padding, 0, trpHeader.padding.Length); break; } this._hdr = trpHeader; }
private void ReadContent(FileStream fs) { byte[] numArray1 = new byte[36]; byte[] numArray2 = new byte[4]; byte[] numArray3 = new byte[8]; byte[] array = new byte[4]; int num1 = checked (this.FileCount - 1); int m_Index = 0; while (m_Index <= num1) { fs.Read(numArray1, 0, numArray1.Length); fs.Read(numArray2, 0, numArray2.Length); fs.Read(numArray3, 0, numArray3.Length); fs.Read(array, 0, array.Length); fs.Seek(12L, SeekOrigin.Current); string m_Name = TRPReader.byteArrayToUTF8String(numArray1).Replace("\0", (string)null); long offset = TRPReader.hexStringToLong(TRPReader.byteArrayToHexString(numArray2)); long num2 = TRPReader.hexStringToLong(TRPReader.byteArrayToHexString(numArray3)); if (this._readbytes) { using (FileStream fileStream = new FileStream(this._inputfile, FileMode.Open, FileAccess.Read, FileShare.Read)) { byte[] numArray4 = new byte[checked ((int)(num2 - 1L) + 1)]; fileStream.Seek(offset, SeekOrigin.Begin); fileStream.Read(numArray4, 0, numArray4.Length); this._trophyList.Add(new Archiver(m_Index, m_Name, checked ((uint)offset), checked ((ulong)num2), numArray4)); } } else { this._trophyList.Add(new Archiver(m_Index, m_Name, checked ((uint)offset), checked ((ulong)num2), (byte[])null)); } checked { ++m_Index; } } }