private void textBoxCommonKey_TextChanged(object sender, EventArgs e) { if (NUSContent.LoadKey(textBoxCommonKey.Text)) { textBoxCommonKey.Text = ""; textBoxCommonKey.Enabled = false; panelCommonKey.BackgroundImage = Properties.Resources.checkmark_16; Log.WriteLine("Valid Wii U Common Key."); Log.WriteLine("The key was successfully loaded!"); } else { textBoxCommonKey.Enabled = true; panelCommonKey.BackgroundImage = Properties.Resources.x_mark_16; Log.WriteLine("Invalid Wii U Common Key: " + textBoxCommonKey.Text); } }
public void Run(string[] args) { if (args.Length == 1) { Log.WriteLine("Path: \"" + args[0] + "\""); if (NUSContent.CheckCommonKeyFiles()) { try { NUSContent.Format format = NUSContent.GetFormat(args[0]); string output = args[0]; if (format == NUSContent.Format.Encrypted) { Log.WriteLine("Ecrypted format detected."); output += " (Decrypted)"; Log.WriteLine("Input: \"" + args[0] + "\""); Log.WriteLine("Output: \"" + output + "\""); Log.WriteLine("Decrypting..."); Directory.CreateDirectory(output); NUSContent.Decrypt(args[0], output); Log.WriteLine("Decrypted!"); MessageBox.Show("Output: \"" + output + "\"", "Decrypted!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else if (format == NUSContent.Format.Decrypted) { Log.WriteLine("Decrypted format detected."); output += " (Encrypted)"; Log.WriteLine("Input: \"" + args[0] + "\""); Log.WriteLine("Output: \"" + output + "\""); Log.WriteLine("Encrypting..."); NUSContent.Encrypt(args[0], output); Log.WriteLine("Encrypted!"); MessageBox.Show("Output: \"" + output + "\"", "Encrypted!", MessageBoxButtons.OK, MessageBoxIcon.Information); } else Log.WriteLine("NUS Content format was not detected."); } catch (Exception e) { Log.WriteLine(e.ToString()); } } else { Log.WriteLine("First load the Wii U Common Key!"); Log.WriteLine("Use: key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); } } else if (args.Length == 2 && args[0] == "key") { if (NUSContent.LoadKey(args[1])) { Log.WriteLine("Valid Wii U Common Key."); Log.WriteLine("The key was successfully loaded!"); } else Log.WriteLine("Invalid Wii U Common Key!"); } else { if (!NUSContent.CheckCommonKeyFiles()) Log.WriteLine("To load the Wii U Common Key use: key XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"); Log.WriteLine(""); Log.WriteLine("Usage: <input path>"); } }