Exemple #1
0
        public bool LoadBase(string path)
        {
            if (Directory.Exists("base"))
            {
                Directory.Delete("base", true);
                Cll.Log.WriteLine("Previous base deleted.");
            }

            if (IsValidBase(path))
            {
                Cll.Log.WriteLine("The \"" + path + "\" folder contains a valid base.");
                Useful.DirectoryCopy(path, "base", true);
            }
            else if (IsValidEncryptedBase(path))
            {
                Cll.Log.WriteLine("The \"" + path + "\" folder contains a valid encrypted base.");
                NusContent.Decrypt(path, "base");
            }
            else
            {
                Cll.Log.WriteLine("The \"" + path + "\" folder not contains a valid base.");
            }

            _base = GetLoadedBase();

            return(BaseIsLoaded);
        }
Exemple #2
0
        public bool Inject()
        {
            _base = GetLoadedBase();
            bool _continue = BaseIsLoaded;

            if (_continue)
            {
                Cll.Log.WriteLine("Base info:");
                Cll.Log.WriteLine(_base.ToString());
            }
            else
            {
                Cll.Log.WriteLine("The base is not loaded.");
            }

            if (_continue)
            {
                _continue = InjectImages();
            }

            if (_continue)
            {
                _continue = InjectMeta();
            }

            if (_continue)
            {
                _continue = InjectRom();
            }

            if (_continue)
            {
                if (Encrypt)
                {
                    Cll.Log.WriteLine("Creating encrypted output.");
                    string inPath = Environment.CurrentDirectory + "\\base";
                    _continue = NusContent.Encrypt(inPath, OutPath);
                }
                else
                {
                    Cll.Log.WriteLine("Creating unencrypted output.");
                    _continue = Useful.DirectoryCopy("base", OutPath, true);
                }
            }

            if (_continue)
            {
                Cll.Log.WriteLine("Injection completed successfully!");
            }
            else
            {
                Cll.Log.WriteLine("The injection failed.\nCheck the log file \"" + Cll.Log.Filename + "\".");
            }

            return(_continue);
        }
Exemple #3
0
        public static bool Decrypt(string inputPath, string outputPath)
        {
            string titleId = CheckEncrypted(inputPath);

            if (titleId != null &&
                CheckCommonKeyFiles() &&
                GetJavaVersion() != null &&
                File.Exists("resources\\jnustool\\JNUSTool.jar"))
            {
                string name = JNUSToolWrapper(inputPath, 0, Int32.MaxValue, titleId, ".*");
                if (name != null)
                {
                    Useful.DirectoryCopy(name, outputPath, true);
                    Directory.Delete(name, true);
                    return(true);
                }
            }
            return(false);
        }