Beispiel #1
0
 private void SetNUSContent(string path)
 {
     NUSContentPath         = path;
     textBoxFolderName.Text = Path.GetFileName(NUSContentPath);
     Log.WriteLine("Path: \"" + NUSContentPath + "\"");
     NUSContentFormat = NUSContent.GetFormat(NUSContentPath);
     if (NUSContentFormat == NUSContent.Format.Encrypted)
     {
         Log.WriteLine("Ecrypted format detected.");
         labelFormat.Text      = "NUS Content format: Ecrypted (WUP Installer).";
         buttonConvert.Text    = "Convert to decrypted format (for Loadiine)";
         buttonConvert.Enabled = true;
     }
     else if (NUSContentFormat == NUSContent.Format.Decrypted)
     {
         Log.WriteLine("Decrypted format detected.");
         labelFormat.Text      = "NUS Content format: Decrypted (Loadiine).";
         buttonConvert.Text    = "Convert to ecrypted format (for WUP Installer)";
         buttonConvert.Enabled = true;
     }
     else
     {
         Log.WriteLine("NUS Content format was not detected.");
         labelFormat.Text      = "NUS Content format: Indeterminate.";
         buttonConvert.Text    = "Convert";
         buttonConvert.Enabled = false;
     }
 }
Beispiel #2
0
        public void LoadBase(string path)
        {
            NUSContent.Format format = NUSContent.GetFormat(path);

            if (format == NUSContent.Format.Decrypted)
            {
                ValidateBase(path);

                if (Directory.Exists(BasePath))
                {
                    Directory.Delete(BasePath, true);
                    Base = null;
                }

                if (Useful.DirectoryCopy(path, BasePath, true))
                {
                    Base = GetLoadedBase();
                }
                else
                {
                    throw new Exception("Could not load base \"" + path + "\".");
                }
            }
            else if (format == NUSContent.Format.Encrypted)
            {
                ValidateEncryptedBase(path);

                if (Directory.Exists(BasePath))
                {
                    Directory.Delete(BasePath, true);
                    Base = null;
                }

                Directory.CreateDirectory(BasePath);
                NUSContent.Decrypt(path, BasePath);
                Base = GetLoadedBase();
            }
            else
            {
                StringBuilder strBuilder = new StringBuilder();
                strBuilder.AppendLine("The folder not contains a valid NUS content.");
                strBuilder.AppendLine("If it is an unpackaged (decrypted) NUS content, then:");
                strBuilder.AppendLine("The \"" + path + "\\code\" folder not exist.");
                strBuilder.AppendLine("Or \"" + path + "\\content\" folder not exist.");
                strBuilder.AppendLine("Or \"" + path + "\\meta\" folder not exist.");
                strBuilder.AppendLine("If it is an packaged (encrypted) NUS content, then:");
                strBuilder.AppendLine("The \"" + path + "\\title.tmd\" file not exist.");
                strBuilder.AppendLine("Or \"" + path + "\\title.tik\" file not exist.");
                strBuilder.AppendLine("Or \"" + path + "\\title.cert\" file not exist.");
                throw new Exception(strBuilder.ToString());
            }
        }
 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>");
     }
 }