mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-12 22:37:10 +00:00
commit
d6f044a84e
1 changed files with 22 additions and 37 deletions
|
@ -2379,44 +2379,29 @@ namespace UWUVCI_AIO_WPF
|
|||
{
|
||||
|
||||
string RomName = string.Empty;
|
||||
using (Process getRomName = new Process())
|
||||
{
|
||||
mvvm.msg = "Getting BaseRom Name...";
|
||||
getRomName.StartInfo.UseShellExecute = false;
|
||||
getRomName.StartInfo.CreateNoWindow = false;
|
||||
getRomName.StartInfo.RedirectStandardOutput = true;
|
||||
getRomName.StartInfo.FileName = "cmd.exe";
|
||||
Console.WriteLine(Directory.GetCurrentDirectory());
|
||||
//getRomName.StartInfo.Arguments = $"/c \"Tools\\7za.exe\" l \"temp\\baserom\\content\\0010\\rom.zip\" | findstr \"WUP\"";
|
||||
getRomName.StartInfo.Arguments = "/c bin\\Tools\\7za.exe l bin\\temp\\baserom\\content\\0010\\rom.zip | findstr WUP";
|
||||
getRomName.Start();
|
||||
getRomName.WaitForExit();
|
||||
var s = getRomName.StandardOutput.ReadToEnd();
|
||||
var split = s.Split(' ');
|
||||
RomName = split[split.Length - 1].Replace("\r\n", "");
|
||||
mvvm.Progress = 15;
|
||||
}
|
||||
using (Process RomEdit = new Process())
|
||||
{
|
||||
mvvm.msg = "Removing BaseRom...";
|
||||
RomEdit.StartInfo.UseShellExecute = false;
|
||||
RomEdit.StartInfo.CreateNoWindow = true;
|
||||
RomEdit.StartInfo.RedirectStandardOutput = true;
|
||||
RomEdit.StartInfo.FileName = Path.Combine(toolsPath, "7za.exe");
|
||||
//d Path.Combine(baseRomPath, "content", "0010", "rom.zip")
|
||||
RomEdit.StartInfo.Arguments = $"d bin\\temp\\baserom\\content\\0010\\rom.zip";
|
||||
RomEdit.Start();
|
||||
RomEdit.WaitForExit();
|
||||
mvvm.Progress = 40;
|
||||
mvvm.msg = "Injecting ROM...";
|
||||
File.Copy(injectRomPath, $"{RomName}");
|
||||
RomEdit.StartInfo.Arguments = $"u bin\\temp\\baserom\\content\\0010\\rom.zip {RomName}";
|
||||
RomEdit.Start();
|
||||
RomEdit.WaitForExit();
|
||||
mvvm.Progress = 80;
|
||||
}
|
||||
File.Delete(RomName);
|
||||
mvvm.msg = "Getting BaseRom Name...";
|
||||
var zipLocation = Path.Combine(baseRomPath, "content", "0010", "rom.zip");
|
||||
using (var zip = ZipFile.Open(zipLocation, ZipArchiveMode.Read))
|
||||
foreach (var file in zip.Entries)
|
||||
if (file.Name.Contains("WUP"))
|
||||
{
|
||||
RomName = file.Name;
|
||||
break;
|
||||
}
|
||||
mvvm.Progress = 15;
|
||||
var romPath = Directory.GetCurrentDirectory() + "\\" + RomName;
|
||||
|
||||
mvvm.msg = "Removing BaseRom...";
|
||||
File.Delete(romPath);
|
||||
File.Delete(zipLocation);
|
||||
File.Copy(injectRomPath, romPath);
|
||||
|
||||
using (var stream = new FileStream(zipLocation, FileMode.Create))
|
||||
using (var archive = new ZipArchive(stream, ZipArchiveMode.Create))
|
||||
archive.CreateEntryFromFile(romPath, Path.GetFileNameWithoutExtension(romPath));
|
||||
|
||||
mvvm.Progress = 80;
|
||||
File.Delete(RomName);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in a new issue