Exemplo n.º 1
0
        public void Patch(string output, string input, string decryptedEboot)
        {
            string translationDir = Path.Join(".", "translation", this.Name);

            string dataDir;

            switch (this.Target)
            {
            case TargetType.ISO:
                Console.WriteLine("Extracting game data...");

                dataDir = Containers.ExtractIso(input);
                if (decryptedEboot != null)
                {
                    File.Copy(decryptedEboot, Path.Join(dataDir, "PSP_GAME", "SYSDIR", "EBOOT.BIN"), true);
                }

                break;

            case TargetType.DIRECTORY:
                // Do nothing, pass it on to components.
                // TODO: Copy to preserve original?
                dataDir = input;
                break;

            default:
                throw new Exception("Unsupported target type \"" + this.Target + "\".");
            }

            for (int i = 0; i < this.Components.Length; i++)
            {
                this.Components[i].Patch(translationDir, dataDir);
            }

            switch (this.Target)
            {
            case TargetType.ISO:
                Console.Write("Packing game data...");
                Containers.PackIso(output, dataDir);
                break;

            case TargetType.DIRECTORY:
                // Do nothing.
                // TODO: Copy to output?
                break;

            default:
                throw new Exception("Unsupported target type \"" + this.Target + "\".");
            }
        }