public static TAHEntry Load(BinaryReader br, TAHFile file) { TAHEntry h = new TAHEntry(); h.Read(br, file); return(h); }
public void Read(BinaryReader br, TAHFile file) { Entries = new List <TAHEntry>(file.Header.NumEntries); EntryMap = new Dictionary <uint, TAHEntry>(); for (int i = 0, n = file.Header.NumEntries; i < n; ++i) { TAHEntry e = TAHEntry.Load(br, file); if (i != 0) { TailEntry.Length = (int)(e.DataOffset - TailEntry.DataOffset); } //Console.WriteLine(e.ToString()); Entries.Add(e); if (EntryMap.ContainsKey(e.Hash)) { Console.WriteLine("Error: delect hashkey collision. " + e.Hash.ToString("X8") + ": " + e.DataOffset.ToString()); } else { EntryMap.Add(e.Hash, e); } } TailEntry.Length = (int)(br.BaseStream.Length - TailEntry.DataOffset); }
public static byte[] ReadEntryData(BinaryReader br, TAHEntry e) { br.BaseStream.Seek(e.DataOffset, SeekOrigin.Begin); byte[] output = new byte[br.ReadInt32()]; byte[] input = br.ReadBytes(e.Length - 4); TAHUtil.Decrypt(input, output); return(output); }
public void Read(BinaryReader br, TAHFile file) { Entries = new List <TAHEntry>(file.Header.NumEntries); EntryMap = new Dictionary <uint, TAHEntry>(); for (int i = 0, n = file.Header.NumEntries; i < n; ++i) { TAHEntry e = TAHEntry.Load(br, file); if (i != 0) { TailEntry.Length = (int)(e.DataOffset - TailEntry.DataOffset); } Entries.Add(e); EntryMap.Add(e.Hash, e); } TailEntry.Length = (int)(br.BaseStream.Length - TailEntry.DataOffset); }
public static void Main(string[] args) { if (args.Length != 1) { System.Console.WriteLine("Usage: TAHDump <zip file>"); return; } TAHEntry.ReadExternalFileList(); string source_file = args[0]; try { string ext = Path.GetExtension(source_file).ToUpper(); if (ext == ".TAH") { DumpTAHEntries(source_file); } else if (ext == ".ZIP") { DumpZipEntries(source_file); } else if (ext == ".RAR") { DumpRarEntries(source_file); } else if (ext == ".LZH") { DumpLzhEntries(source_file); } else if (Directory.Exists(source_file)) { DumpDirEntries(source_file); } } catch (Exception ex) { Console.WriteLine("Error: " + ex); } }
public static byte[] ReadRawEntryData(BinaryReader br, TAHEntry e, out uint len) { br.BaseStream.Seek(e.DataOffset, SeekOrigin.Begin); len = br.ReadUInt32(); return(br.ReadBytes(e.Length - 4)); }
public TAHContent LoadContent(BinaryReader br, TAHEntry e) { return(new TAHContent(e, TAHUtil.ReadEntryData(br, e))); }
public TAHContent(TAHEntry e, byte[] data) { Entry = e; Data = data; }
public bool TryGetValue(uint hash, out TAHEntry e) { return(EntryMap.TryGetValue(hash, out e)); }