public static void ProcessPk21(Context ctx) { using (var file = new FileStream(ctx.Options.InFile, FileMode.Open, FileAccess.Read)) { var package2 = new Package2(ctx.Keyset, file); ctx.Logger.LogMessage(package2.Print()); string outDir = ctx.Options.OutDir; if (outDir != null) { Directory.CreateDirectory(outDir); package2.OpenKernel().WriteAllBytes(Path.Combine(outDir, "Kernel.bin"), ctx.Logger); package2.OpenIni1().WriteAllBytes(Path.Combine(outDir, "INI1.bin"), ctx.Logger); using (var decFile = new FileStream(Path.Combine(outDir, "Decrypted.bin"), FileMode.Create)) { package2.OpenHeaderPart1().CopyTo(decFile); package2.OpenHeaderPart2().CopyTo(decFile); package2.OpenKernel().CopyTo(decFile); package2.OpenIni1().CopyTo(decFile); } } } }
public static void ProcessPk21(Context ctx) { using (var file = new CachedStorage(new LocalStorage(ctx.Options.InFile, FileAccess.Read), 0x4000, 4, false)) { var package2 = new Package2(ctx.Keyset, file); ctx.Logger.LogMessage(package2.Print()); string outDir = ctx.Options.OutDir; if (outDir != null) { Directory.CreateDirectory(outDir); package2.OpenKernel().WriteAllBytes(Path.Combine(outDir, "Kernel.bin"), ctx.Logger); package2.OpenIni1().WriteAllBytes(Path.Combine(outDir, "INI1.bin"), ctx.Logger); package2.OpenDecryptedPackage().WriteAllBytes(Path.Combine(outDir, "Decrypted.bin"), ctx.Logger); } } }