Esempio n. 1
0
        public void DumpResources(string outRoot)
        {
            // dump the abnd's, and track which ones we've already seen
            var processed = new HashSet <string>();

            foreach (var f in ResourceDB)
            {
                // Get the file's location on the disk
                var fn = f.Value.ContainerName;
                if (processed.Contains(fn))
                {
                    continue;
                }

                var folder = fn[0].ToString();
                var file   = Path.Combine(DownloadPath, folder, fn);

                if (!File.Exists(file))
                {
                    Debug.WriteLine("Unable to find file (optional?): " + fn);
                    continue;
                }

                // Read ABND
                var data = File.ReadAllBytes(file);
                var abnd = new ABND(data);

                // Dump ABND to final location
                var outPath = outRoot; //  Path.Combine(outRoot, fn); -- don't bother using the ABND zip name; just get everything in one folder
                DumpABND(abnd, outPath);

                processed.Add(fn);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// Spits out all contents of the <see cref="abnd"/> to the <see cref="outPath"/>
        /// </summary>
        /// <param name="abnd">Archive</param>
        /// <param name="outPath">Location to dump to</param>
        private static void DumpABND(ABND abnd, string outPath)
        {
            Directory.CreateDirectory(outPath);
            for (int i = 0; i < abnd.ExtHeader.FileCount; i++)
            {
                var fi = abnd.GetFileInfo(i);
                var fn = abnd.GetFileName(fi);
                var fd = abnd.GetFileData(fi);

                var path = Path.Combine(outPath, fn);
                var di   = Path.GetDirectoryName(path);
                if (di != null)
                {
                    Directory.CreateDirectory(di);
                }

                File.WriteAllBytes(path, fd);
            }
        }
Esempio n. 3
0
        public void LoadShard(string path)
        {
            var data = File.ReadAllBytes(path);

            AssetShard = new ABND(data);
        }