Exemple #1
0
        public static void DecodeAllArchivesTest()
        {
            string basePath = GameDataPath;
            var    files    = Directory.GetFiles(basePath, "*.bin", SearchOption.AllDirectories);

            foreach (string file in files)
            {
                Console.WriteLine(file);

                var indexFile = new PackfileIndex().FromFile(Path.ChangeExtension(file, ".idx"));
                var archive   = new PackfileReader(file);

                foreach (var entry in archive.FileEntries)
                {
                    if (!indexFile.ResolvePathByHash(entry.PathHash, out string fn))
                    {
                        throw new Exception();
                    }

                    var physicalPath = Path.Combine(basePath, "extracted", fn);
                    var physicalDir  = Path.GetDirectoryName(physicalPath);

                    Directory.CreateDirectory(physicalDir);
                    archive.ExtractFile(fn, physicalPath);
                }
            }
        }
Exemple #2
0
        static void DecodeArchivesTest()
        {
            string basePath = @"C:\Program Files (x86)\Steam\steamapps\common\Horizon Zero Dawn\Packed_DX12\";

            var archiveList = new string[]
            {
                "DLC1.bin",
                "DLC1_English.bin",
                "Initial.bin",
                "Initial_English.bin",
                "Remainder.bin",
                "Remainder_English.bin",
            };

            foreach (var file in archiveList)
            {
                var indexFile = new PackfileIndex(Path.Combine(basePath, Path.ChangeExtension(file, ".idx")));
                var archive   = new Packfile(Path.Combine(basePath, file));

                foreach (var entry in archive.FileEntries)
                {
                    if (!indexFile.ResolvePathByHash(entry.PathHash, out string fn))
                    {
                        throw new Exception();
                    }

                    var physicalPath = Path.Combine(basePath, "extracted", fn);
                    var physicalDir  = Path.GetDirectoryName(physicalPath);

                    Directory.CreateDirectory(physicalDir);
                    archive.ExtractFile(fn, physicalPath);
                }

                Console.WriteLine(file);
            }
        }