protected override void _Read(BinaryReader reader) { FileType = reader.ReadUInt32(); Identifier1 = reader.ReadUInt32(); Identifier2 = reader.ReadUInt32(); reader.BaseStream.Seek(4, SeekOrigin.Current); UnixTimestamp = new DateTime(1970, 1, 1).AddSeconds(reader.ReadInt32()); reader.BaseStream.Seek(4, SeekOrigin.Current); char[] typeBuffer = new char[4]; reader.Read(typeBuffer, 0, 4); RenderType = new string(typeBuffer); reader.BaseStream.Seek(4, SeekOrigin.Current); HeaderChecksum = reader.ReadUInt32(); reader.BaseStream.Seek(4, SeekOrigin.Current); TacSize = reader.ReadUInt32(); reader.BaseStream.Seek(4, SeekOrigin.Current); FileCount = reader.ReadUInt32(); reader.BaseStream.Seek(8, SeekOrigin.Current); //Skip file count duplicate for (int i = 0; i < FileCount; i++) { TADEntry entry = new TADEntry(); entry.Read(reader); entry.Index = (uint)i; Entries.Add(entry); } }
/// <summary> /// Returns the file buffer of the given TAD entry. /// </summary> public byte[] GetFileBuffer(TADEntry entry) { if (m_tacStream == null) { throw new InvalidOperationException("The TAC filestream was already closed!"); } byte[] result = new byte[entry.FileSize]; m_tacStream.Seek(entry.FileOffset, SeekOrigin.Begin); m_tacStream.Read(result, 0, result.Length); return(result); }