public static void UnpackCPK(string directory) { if (!Directory.Exists(directory)) { Console.WriteLine($"[ERROR] Couldn't find {directory}. Please correct the file path in config."); return; } Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = Cursors.Wait; }); if (FileIOWrapper.Exists($@"{directory}\ps3.cpk.66600") && FileIOWrapper.Exists($@"{directory}\ps3.cpk.66601") && FileIOWrapper.Exists($@"{directory}\ps3.cpk.66602") && !FileIOWrapper.Exists($@"{directory}\ps3.cpk")) { Console.Write("[INFO] Combining ps3.cpk parts"); ProcessStartInfo cmdInfo = new ProcessStartInfo(); cmdInfo.CreateNoWindow = true; cmdInfo.FileName = @"CMD.exe"; cmdInfo.WindowStyle = ProcessWindowStyle.Hidden; cmdInfo.Arguments = $@"/C copy /b ""{directory}\ps3.cpk.66600"" + ""{directory}\ps3.cpk.66601"" + ""{directory}\ps3.cpk.66602"" ""{directory}\ps3.cpk"""; using (Process process = new Process()) { process.StartInfo = cmdInfo; process.Start(); process.WaitForExit(); } } Directory.CreateDirectory($@"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Original\Persona 5"); if (!FileIOWrapper.Exists($@"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Dependencies\MakeCpk\filtered_data.csv") || !FileIOWrapper.Exists($@"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Dependencies\MakeCpk\filtered_ps3.csv")) { Console.WriteLine($@"[ERROR] Couldn't find CSV files used for unpacking in Dependencies\MakeCpk"); Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; }); return; } string[] dataFiles = FileIOWrapper.ReadAllLines($@"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Dependencies\MakeCpk\filtered_data.csv"); string[] ps3Files = FileIOWrapper.ReadAllLines($@"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Dependencies\MakeCpk\filtered_ps3.csv"); ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.CreateNoWindow = true; startInfo.FileName = $@"{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Dependencies\MakeCpk\YACpkTool.exe"; if (!FileIOWrapper.Exists(startInfo.FileName)) { Console.WriteLine($"[ERROR] Couldn't find {startInfo.FileName}. Please check if it was blocked by your anti-virus."); Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; }); return; } startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.RedirectStandardOutput = true; startInfo.UseShellExecute = false; if (FileIOWrapper.Exists($@"{directory}\data.cpk")) { Console.WriteLine($"[INFO] Extracting data.cpk"); foreach (var file in dataFiles) { startInfo.Arguments = $@"-X {file} -i ""{directory}\data.cpk"" -o ""{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Original\Persona 5"""; using (Process process = new Process()) { process.StartInfo = startInfo; process.Start(); while (!process.HasExited) { string text = process.StandardOutput.ReadLine(); if (text != "" && text != null) { Console.WriteLine($"[INFO] {text}"); } } } } } else { Console.WriteLine($"[ERROR] Couldn't find data.cpk in {directory}."); } if (FileIOWrapper.Exists($@"{directory}\data.cpk")) { Console.WriteLine($"[INFO] Extracting ps3.cpk"); foreach (var file in ps3Files) { startInfo.Arguments = $@"-X {file} -i ""{directory}\ps3.cpk"" -o ""{Path.GetDirectoryName(Assembly.GetEntryAssembly().Location)}\Original\Persona 5"""; using (Process process = new Process()) { process.StartInfo = startInfo; process.Start(); while (!process.HasExited) { string text = process.StandardOutput.ReadLine(); if (text != "" && text != null) { Console.WriteLine($"[INFO] {text}"); } } } } } else { Console.WriteLine($"[ERROR] Couldn't find ps3.cpk in {directory}."); } Console.WriteLine($"[INFO] Finished unpacking base files!"); Application.Current.Dispatcher.Invoke(() => { Mouse.OverrideCursor = null; }); }