private void btnListFilesIPSW_Click(object sender, EventArgs e) { string[] AllFilesIPSW = PackageIPSW.getAllFilesIPSW(); for (int i = 0; i < AllFilesIPSW.Length; i++) { lbFilesIPSW.Items.Add(AllFilesIPSW[i]); } }
private List <string> addSecondaryOperatingSystemImagesToFlash(IPSWlib.Editor SecondaryOperatingSystemIPSW, List <string> ImagesToFlash) { string[] SecondaryOperatingSystemFiles; string WorkingDirectorySecondaryOS = WorkingDirectory + SecondaryOperatingSystemIPSW.getBuildNumber() + "_Secondary"; if (Directory.Exists(WorkingDirectorySecondaryOS) == false) { Directory.CreateDirectory(WorkingDirectorySecondaryOS); } SecondaryOperatingSystemFiles = SecondaryOperatingSystemIPSW.getAllFilesIPSW(); for (int i = 0; i < SecondaryOperatingSystemFiles.Length; i++) { if (SecondaryOperatingSystemFiles[i].Contains("iBoot.") == true) { if (OperatingSystemsArray[1].iBoot == null) { OperatingSystemsArray[1].iBoot = SecondaryOperatingSystemFiles[i]; } ImagesToFlash.Add(OperatingSystemsArray[1].iBoot); } else if (SecondaryOperatingSystemFiles[i].Contains("LLB") == true) { if (OperatingSystemsArray[1].LowLevelBootloader == null) { OperatingSystemsArray[1].LowLevelBootloader = SecondaryOperatingSystemFiles[i]; } ImagesToFlash.Add(OperatingSystemsArray[1].LowLevelBootloader); } else if (SecondaryOperatingSystemFiles[i].Contains("DeviceTree") == true) { if (OperatingSystemsArray[1].DeviceTree == null) { OperatingSystemsArray[1].DeviceTree = SecondaryOperatingSystemFiles[i]; } ImagesToFlash.Add(OperatingSystemsArray[1].DeviceTree); } else if (SecondaryOperatingSystemFiles[i].Contains("applelogo") == true) { if (OperatingSystemsArray[1].BootLogo == null) { OperatingSystemsArray[1].BootLogo = SecondaryOperatingSystemFiles[i]; } ImagesToFlash.Add(OperatingSystemsArray[1].BootLogo); } else if (SecondaryOperatingSystemFiles[i].Contains("recoverymode") == true) { if (OperatingSystemsArray[1].RecoveryLogo == null) { OperatingSystemsArray[1].RecoveryLogo = SecondaryOperatingSystemFiles[i]; } ImagesToFlash.Add(OperatingSystemsArray[1].RecoveryLogo); } } return(ImagesToFlash); }
public void PrepareMainOperatingSystemIPSW() { IPSWlib.Editor MainOperatingSystemIPSW; List <string> ImagesToFlashSecondaryOS = new List <string>(); if (MainOperatingSystemSelected == true) { MainOperatingSystemIPSW = new IPSWlib.Editor(MainOperatingSystemPathIPSW, WorkingDirectory); } else { MainOperatingSystemIPSW = null; } if (SecondaryOperatingSystemSelected == true) { IPSWlib.Editor SecondaryOperatingSystemIPSW = new IPSWlib.Editor(SecondaryOperatingSystemPathIPSW, WorkingDirectory); OperatingSystemsArray[1].FileNameIPSW = SecondaryOperatingSystemIPSW.getFileNameIPSW(); OperatingSystemsArray[1].SystemID = 'B'; ImagesToFlashSecondaryOS = addSecondaryOperatingSystemImagesToFlash(SecondaryOperatingSystemIPSW, ImagesToFlashSecondaryOS); DecryptFirmwareImages(SecondaryOperatingSystemIPSW.getFileNameIPSW(), ImagesToFlashSecondaryOS); PatchFirmwareImages(SecondaryOperatingSystemIPSW.getFileNameIPSW(), ImagesToFlashSecondaryOS); OperatingSystemsArray[1].LocalWorkingDirectory = WorkingDirectory + SecondaryOperatingSystemIPSW.getBuildNumber() + "_Secondary"; string ImageFileName = Path.GetFileName(OperatingSystemsArray[1].LowLevelBootloader); string[] SplittedImageFileName = ImageFileName.Split('.'); string UpdatedImageFileName = ""; SplittedImageFileName[0] = SplittedImageFileName[0] + "B"; UpdatedImageFileName = SplittedImageFileName[0] + "." + SplittedImageFileName[1] + "." + SplittedImageFileName[2] + "." + SplittedImageFileName[3]; File.Copy(OperatingSystemsArray[1].LowLevelBootloader, OperatingSystemsArray[1].LocalWorkingDirectory + "\\" + UpdatedImageFileName); OperatingSystemsArray[1].LowLevelBootloader = OperatingSystemsArray[1].LocalWorkingDirectory + "\\" + UpdatedImageFileName; string DecryptedRootFileSystemImagePath = DecryptRootFileSystemImage(SecondaryOperatingSystemIPSW.getFileNameIPSW(), SecondaryOperatingSystemIPSW.getRootFileSystemImagePath()); File.Move(DecryptedRootFileSystemImagePath, OperatingSystemsArray[1].LocalWorkingDirectory + "\\" + "RootFileSystem.dmg"); OperatingSystemsArray[1].RootFileSystem = OperatingSystemsArray[1].LocalWorkingDirectory + "\\" + "RootFileSystem.dmg"; for (int i = 0; i < SecondaryOperatingSystemIPSW.getAllFilesIPSW().Length; i++) { if (SecondaryOperatingSystemIPSW.getAllFilesIPSW()[i].Contains("kernel")) { File.Copy(SecondaryOperatingSystemIPSW.getAllFilesIPSW()[i], OperatingSystemsArray[1].LocalWorkingDirectory + "\\" + Path.GetFileName(SecondaryOperatingSystemIPSW.getAllFilesIPSW()[i])); OperatingSystemsArray[1].KernelCache = OperatingSystemsArray[1].LocalWorkingDirectory + "\\" + Path.GetFileName(SecondaryOperatingSystemIPSW.getAllFilesIPSW()[i]); } } for (int i = 0; i < ImagesToFlashSecondaryOS.Count; i++) { ImagesToFlashSecondaryOS[i] = MainOperatingSystemIPSW.AddToAllFlashFolder(ImagesToFlashSecondaryOS[i], "Secondary"); } for (int i = 0; i < ImagesToFlashSecondaryOS.Count; i++) { MainOperatingSystemIPSW.AddToFlashManifest(ImagesToFlashSecondaryOS[i]); } } MainOperatingSystemIPSW.RebuildIPSW(WorkingDirectory + MainOperatingSystemIPSW.getFileNameIPSW(), WorkingDirectory + MainOperatingSystemIPSW.getFileNameIPSW() + ".ipsw"); ToolsManagerLib.iDeviceRestore iDeviceRestore = new ToolsManagerLib.iDeviceRestore(); iDeviceRestore.EraseRestore(WorkingDirectory + MainOperatingSystemIPSW.getFileNameIPSW() + ".ipsw"); }