Exemplo n.º 1
0
 public BankExplorer(BankFile bank) : base(new Guid("dc1d3a1f-22da-4aae-954b-cf07f971cf02"))
 {
     InspectedBank = bank;
     CanGetContent = true;
     Location      = "SoundBank";
     _files.AddRange(bank.Files.Select(f => new SetFile()
     {
         Name   = f.Name,
         Length = f.Length,
         Data   = f
     }));
 }
Exemplo n.º 2
0
        private void ExportFileEntry(FarFile file, string Dir)
        {
            var filedata = file.Data ?? GetFileData(file);

            if (file.IsDirectory)
            {
                Directory.CreateDirectory(Dir);
                if (filedata is PakExplorer index)
                {
                    index._files.ForEach(f => ExportFileEntry(f, Path.Combine(Dir, f.Name)));
                }
            }
            else if (file.Name.EndsWith(".bnk") && filedata is FPakEntry entry)
            {
                UE4.VorbisBank.BankFile bank = null;
                var data     = InspectedFile.ReadEntry(entry);
                var bankinfo = _files.Where(f => f.Name == "SoundbanksInfo.xml").SingleOrDefault();
                if (bankinfo != null)
                {
                    var bankData = InspectedFile.ReadEntry(bankinfo.Data);
                    var doc      = new XmlDocument();
                    var xml      = Encoding.UTF8.GetString(bankData);
                    doc.LoadXml(xml);
                    var info = new SoundBankInfo(doc);
                    bank = new UE4.VorbisBank.BankFile(data, info);
                }
                else
                {
                    bank = new UE4.VorbisBank.BankFile(data);
                }

                File.WriteAllBytes(Dir, data);
                var folder = Path.Combine(Path.GetDirectoryName(Dir), Path.GetFileNameWithoutExtension(Dir));
                Directory.CreateDirectory(folder);
                bank.Files.ForEach(track => File.WriteAllBytes(Path.Combine(folder, track.Name), bank.ReadTrack(track)));
            }
            else
            {
                var data = InspectedFile.ReadEntry(filedata);
                if (data != null)
                {
                    File.WriteAllBytes(Dir, data);
                }
            }
        }