コード例 #1
0
        public FinishPage()
        {
            InitializeComponent();

            Loaded += (_, __) =>
            {
                TextArea.Text += HACGUIKeyset.PrintCommonKeys(HACGUIKeyset.Keyset, true);
                TextArea.Text += "--------------------------------------------------------------\n";
                TextArea.Text += HACGUIKeyset.PrintCommonWithoutFriendlyKeys(HACGUIKeyset.Keyset);
                TextArea.Text += "--------------------------------------------------------------\n";
                TextArea.Text += ExternalKeyReader.PrintUniqueKeys(HACGUIKeyset.Keyset);
                TextArea.Text += "--------------------------------------------------------------\n";
                TextArea.Text += ExternalKeyReader.PrintTitleKeys(HACGUIKeyset.Keyset);
            };
            HACGUIKeyset.SetConsoleDirectoryAsIncomplete(PickConsolePage.ConsoleName, false);
        }
コード例 #2
0
        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));
            }
        }
コード例 #3
0
        public ExceptionWindow(Exception e)
        {
            InitializeComponent();
            if (RootWindow.Current != null) // cleanup
            {
                RootWindow.Current.Close();
            }

            TextBox.Text = e.ToString();

            Task.Factory.StartNew(() => {
                try
                {
                    using (FileStream zipOut = HACGUIKeyset.GetCrashZip().Create())
                    {
                        using (ZipArchive archive = new ZipArchive(zipOut, ZipArchiveMode.Update))
                        {
                            ZipArchiveEntry prodEntry = archive.CreateEntry("prod.keys");
                            using (StreamWriter writer = new StreamWriter(prodEntry.Open()))
                                writer.Write(HACGUIKeyset.PrintCommonKeys(HACGUIKeyset.Keyset, true));
                            ZipArchiveEntry extraEntry = archive.CreateEntry("extra.keys");
                            using (StreamWriter writer = new StreamWriter(extraEntry.Open()))
                                writer.Write(HACGUIKeyset.PrintCommonWithoutFriendlyKeys(HACGUIKeyset.Keyset));
                            ZipArchiveEntry consoleEntry = archive.CreateEntry("console.keys");
                            using (StreamWriter writer = new StreamWriter(consoleEntry.Open()))
                                writer.Write(ExternalKeyReader.PrintUniqueKeys(HACGUIKeyset.Keyset));
                            ZipArchiveEntry titleEntry = archive.CreateEntry("title.keys");
                            using (StreamWriter writer = new StreamWriter(titleEntry.Open()))
                                writer.Write(ExternalKeyReader.PrintTitleKeys(HACGUIKeyset.Keyset));
                            ZipArchiveEntry exceptionEntry = archive.CreateEntry("exception.txt");
                            using (StreamWriter writer = new StreamWriter(exceptionEntry.Open()))
                                writer.Write(e.ToString());
                        }
                    }
                }
                catch (Exception e2)
                {
                    TextBox.Dispatcher.Invoke(() =>
                    {
                        TextBox.Text += "Crash packer has also encountered an error...\n";
                        TextBox.Text += e2.ToString();
                    });
                }
            });
        }
コード例 #4
0
 public override Task CreateTask()
 {
     return(new Task(() =>
     {
         Stream prodKeys = HACGUIKeyset.ProductionKeysFileInfo.Create();
         prodKeys.WriteString(HACGUIKeyset.PrintCommonKeys(HACGUIKeyset.Keyset, true));
         Stream extraKeys = HACGUIKeyset.ExtraKeysFileInfo.Create();
         extraKeys.WriteString(HACGUIKeyset.PrintCommonWithoutFriendlyKeys(HACGUIKeyset.Keyset));
         Stream consoleKeys = HACGUIKeyset.ConsoleKeysFileInfo.Create();
         consoleKeys.WriteString(ExternalKeyReader.PrintUniqueKeys(HACGUIKeyset.Keyset));
         if (ConsoleName != null)
         {
             Stream specificConsoleKeys = HACGUIKeyset.GetConsoleKeysFileInfoByName(ConsoleName).Create();
             specificConsoleKeys.WriteString(ExternalKeyReader.PrintUniqueKeys(HACGUIKeyset.Keyset));
             specificConsoleKeys.Close();
         }
         Stream titleKeys = HACGUIKeyset.TitleKeysFileInfo.Create();
         titleKeys.WriteString(ExternalKeyReader.PrintTitleKeys(HACGUIKeyset.Keyset));
         prodKeys.Close();
         extraKeys.Close();
         consoleKeys.Close();
         titleKeys.Close();
     }));
 }