private static void ExtractAndAdd(BackgroundWorker worker, string name, string extension, string ftffile, string AsFilename = "") { if (Zipping.ExistsInZip(ftffile, name + ".sin") == false) { OnError(name, AsFilename); return; } Zipping.UnzipFile(worker, ftffile, name + ".sin", string.Empty, Utility.GetTempPath(), false); if (File.Exists(Path.Combine(Utility.GetTempPath(), name + ".sin"))) { Logger.WriteLog(" " + name); SinExtract.ExtractSin(worker, Path.Combine(Utility.GetTempPath(), name + ".sin"), Path.Combine(Utility.GetTempPath(), name + extension), false); if (PartitionInfo.ScriptMode == PartitionInfo.Mode.LegacyUUID) { byte[] UUID = PartitionInfo.ReadSinUUID(Path.Combine(Utility.GetTempPath(), name + ".sin")); Utility.ScriptSetUUID(worker, (AsFilename == "" ? name : AsFilename), UUID); } File.Delete(Path.Combine(Utility.GetTempPath(), name + ".sin")); Zipping.AddToZip(worker, Settings.destinationFile, Path.Combine(Utility.GetTempPath(), name + extension), (AsFilename == "" ? name : AsFilename) + extension, false); File.Delete(Path.Combine(Utility.GetTempPath(), name + extension)); } }
private static void UnpackSystem(BackgroundWorker worker) { SetJobNum(++JobNum); Logger.WriteLog("Extracting system.sin from " + System.IO.Path.GetFileName(Form1.form.ftf_textbox.Text)); if (!Zipping.UnzipFile(worker, Form1.form.ftf_textbox.Text, "system.sin", string.Empty, Utility.GetTempPath())) { worker.CancelAsync(); return; } byte[] UUID = PartitionInfo.ReadSinUUID(Path.Combine(Utility.GetTempPath(), "system.sin")); //PartitionInfo.ScriptMode = (UUID != null) ? PartitionInfo.Mode.LegacyUUID : PartitionInfo.Mode.Legacy; if (!Form1.form.options_checklist.CheckedItems.Contains("Legacy mode")) { PartitionInfo.ScriptMode = PartitionInfo.Mode.Sinflash; } else { PartitionInfo.ScriptMode = (UUID != null) ? PartitionInfo.Mode.LegacyUUID : PartitionInfo.Mode.Legacy; } Utility.ScriptSetUUID(worker, "system", UUID); }