private void BatchExtractLUA(object sender, EventArgs e) { FolderSelectDialog ofd = new FolderSelectDialog(); if (ofd.ShowDialog() == DialogResult.OK) { string folderPath = ofd.SelectedPath; foreach (string file in Directory.GetFiles(folderPath)) { Console.WriteLine(file); if (Path.GetExtension(file) == ".bea") { BEA bea = new BEA(); bea.Data = File.ReadAllBytes(file); bea.FileName = file; bea.Load(); foreach (var asset in beaFile.FileList.Values) { if (Path.GetExtension(asset.FileName) == ".lua") { try { if (!String.IsNullOrWhiteSpace(Path.GetDirectoryName($"{folderPath}/{beaFile.Name}/{asset.FileName}"))) { if (!File.Exists(asset.FileName)) { if (!Directory.Exists($"{folderPath}/{beaFile.Name}/{asset.FileName}")) { Directory.CreateDirectory(Path.GetDirectoryName($"{folderPath}/{beaFile.Name}/{asset.FileName}")); } } } File.WriteAllBytes($"{folderPath}/{beaFile.Name}/{asset.FileName}", GetASSTData(asset.FileName)); } catch { } } } } } } }
private void BatchExtractLUA(object sender, EventArgs e) { FolderSelectDialog ofd = new FolderSelectDialog(); if (ofd.ShowDialog() == DialogResult.OK) { string folderPath = ofd.SelectedPath; foreach (string file in Directory.GetFiles(folderPath)) { Console.WriteLine(file); if (Path.GetExtension(file) == ".bea") { BEA bea = STFileLoader.OpenFileFormat(file) as BEA; foreach (FileEntry asset in bea.Files) { if (Path.GetExtension(asset.FileName) == ".lua") { try { if (!String.IsNullOrWhiteSpace(Path.GetDirectoryName($"{folderPath}/{asset.FileName}"))) { if (!File.Exists(asset.FileName)) { if (!Directory.Exists($"{folderPath}/{bea.FileName}")) { Directory.CreateDirectory(Path.GetDirectoryName($"{folderPath}/{asset.FileName}")); } } } File.WriteAllBytes($"{folderPath}/{asset.FileName}", GetASSTData(asset)); } catch { } } } bea.Unload(); GC.Collect(); } } } }
public FileEntry(BEA bea) { ArchiveFile = bea; }