コード例 #1
0
ファイル: TAHFile.cs プロジェクト: xvok16/TDCGExplorer
        public static TAHEntry Load(BinaryReader br, TAHFile file)
        {
            TAHEntry h = new TAHEntry();

            h.Read(br, file);
            return(h);
        }
コード例 #2
0
ファイル: TAHFile.cs プロジェクト: xvok16/TDCGExplorer
        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);
        }
コード例 #3
0
ファイル: TAHUtil.cs プロジェクト: xvok16/TDCGExplorer
        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);
        }
コード例 #4
0
ファイル: TAHFile.cs プロジェクト: xvok16/TDCGExplorer
        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);
        }
コード例 #5
0
        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);
            }
        }
コード例 #6
0
ファイル: TAHUtil.cs プロジェクト: xvok16/TDCGExplorer
 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));
 }
コード例 #7
0
ファイル: TAHFile.cs プロジェクト: xvok16/TDCGExplorer
 public TAHContent LoadContent(BinaryReader br, TAHEntry e)
 {
     return(new TAHContent(e, TAHUtil.ReadEntryData(br, e)));
 }
コード例 #8
0
ファイル: TAHFile.cs プロジェクト: xvok16/TDCGExplorer
 public TAHContent(TAHEntry e, byte[] data)
 {
     Entry = e;
     Data  = data;
 }
コード例 #9
0
ファイル: TAHFile.cs プロジェクト: xvok16/TDCGExplorer
 public bool TryGetValue(uint hash, out TAHEntry e)
 {
     return(EntryMap.TryGetValue(hash, out e));
 }