public override bool Execute(List <string> args) { if (args.Count != 1 && args.Count != 2) { return(false); } var virtualPath = args[0]; var outputPath = (args.Count == 2) ? args[1] : virtualPath; var file = _list.Find(virtualPath); if (file == null) { Console.Error.WriteLine("Unable to find file {0}.", virtualPath); return(true); } var outDir = Path.GetDirectoryName(outputPath); if (!string.IsNullOrEmpty(outDir)) { Directory.CreateDirectory(outDir); } var data = _list.Extract(file); File.WriteAllBytes(outputPath, data); Console.WriteLine("Wrote 0x{0:X} bytes to {1}.", data.Length, outputPath); return(true); }
public override bool Execute(List <string> args) { if (args.Count > 1) { return(false); } var baseDir = (args.Count == 1) ? args[0] : Directory.GetCurrentDirectory(); foreach (var file in _list.Files) { var outDir = Path.Combine(baseDir, file.Folder); Directory.CreateDirectory(outDir); var outPath = Path.Combine(outDir, file.Name); var data = _list.Extract(file); File.WriteAllBytes(outPath, data); } Console.WriteLine("Extracted {0} files.", _list.Files.Count); return(true); }