private static void OpenKeyset(Context ctx) { string keyFileName = ctx.Options.UseDevKeys ? "dev.keys" : "prod.keys"; #if CORERT_NO_REFLECTION string home = HomeFolder.GetFolderPath(Environment.SpecialFolder.UserProfile); #else string home = Environment.GetFolderPath(Environment.SpecialFolder.UserProfile); #endif string homeKeyFile = Path.Combine(home, ".switch", keyFileName); string homeTitleKeyFile = Path.Combine(home, ".switch", "title.keys"); string homeConsoleKeyFile = Path.Combine(home, ".switch", "console.keys"); string keyFile = ctx.Options.Keyfile; string titleKeyFile = ctx.Options.TitleKeyFile; string consoleKeyFile = ctx.Options.ConsoleKeyFile; if (keyFile == null && File.Exists(homeKeyFile)) { keyFile = homeKeyFile; } if (titleKeyFile == null && File.Exists(homeTitleKeyFile)) { titleKeyFile = homeTitleKeyFile; } if (consoleKeyFile == null && File.Exists(homeConsoleKeyFile)) { consoleKeyFile = homeConsoleKeyFile; } ctx.Keyset = ExternalKeyReader.ReadKeyFile(keyFile, titleKeyFile, consoleKeyFile, ctx.Logger, ctx.Options.UseDevKeys); if (ctx.Options.SdSeed != null) { ctx.Keyset.SetSdSeed(ctx.Options.SdSeed.ToBytes()); } if (ctx.Options.InFileType == FileType.Keygen && ctx.Options.OutDir != null) { string dir = ctx.Options.OutDir; Directory.CreateDirectory(dir); File.WriteAllText(Path.Combine(dir, keyFileName), ExternalKeyReader.PrintCommonKeys(ctx.Keyset)); File.WriteAllText(Path.Combine(dir, "console.keys"), ExternalKeyReader.PrintUniqueKeys(ctx.Keyset)); File.WriteAllText(Path.Combine(dir, "title.keys"), ExternalKeyReader.PrintTitleKeys(ctx.Keyset)); } }
private static void ProcessKeygen(Context ctx) { Console.WriteLine(ExternalKeyReader.PrintCommonKeys(ctx.Keyset)); }