Beispiel #1
0
            public static void ExtractAllFiles(bool ignoreComplete = false)
            {
                string path = Program.ProjectPath;

                string where = Functions.FileDialog._SaveDialog.DirectoryPath.ToString();

                //WaitDialog.Width = 15;
                //WaitDialog.Height = 3;

                RPGMakerVersion _version = RGSSAD.GetVersion(path);

                switch (_version)
                {
                case RPGMakerVersion.Xp:
                case RPGMakerVersion.Vx:
                {
                    RGSSADv1 encrypted = new RGSSADv1(path);
                    try
                    {
                        Misc.UpdateStatus("Extracting all files for a XP/VX archive...");
                        encrypted.ExtractAllFiles(where, StaticWindows.Settings.OverwriteFiles);
                    }
                    catch (IOException file)
                    {
                        Operation.ShowError(file.Message);
                    }
                    encrypted.Dispose();
                    break;
                }

                case RPGMakerVersion.VxAce:
                {
                    RGSSADv3 encrypted = new RGSSADv3(path);
                    try
                    {
                        Misc.UpdateStatus("Extracting all files for a VX Ace archive...");
                        encrypted.ExtractAllFiles(where, StaticWindows.Settings.OverwriteFiles);
                    }
                    catch (IOException file)
                    {
                        Operation.ShowError(file.Message);
                    }
                    encrypted.Dispose();
                    break;
                }

                default: break;
                }

                if (!ignoreComplete)
                {
                    Application.Run(Operation.Complete);
                }
            }
Beispiel #2
0
        static void Main(string[] args)
        {
            _commandLineOptions = new CommandLineOptions();

            if (Parser.Default.ParseArguments(args, _commandLineOptions) == false)
            {
                Environment.Exit(1);
            }

            if (_commandLineOptions.InputPaths.Count == 0)
            {
                Console.WriteLine(_commandLineOptions.GetUsage());
                Environment.Exit(1);
            }

            RPGMakerVersion version = RGSSAD.GetVersion(_commandLineOptions.InputPaths.First());

            if (version == RPGMakerVersion.Invalid)
            {
                Console.WriteLine("Invalid input file.");
                Environment.Exit(1);
            }

            string outputDirectoryPath;

            if (_commandLineOptions.OutputDirectoryPath != null)
            {
                outputDirectoryPath = _commandLineOptions.OutputDirectoryPath;
            }
            else
            {
                FileInfo fi = new FileInfo(_commandLineOptions.InputPaths.First());
                outputDirectoryPath = fi.DirectoryName;
            }

            try
            {
                switch (version)
                {
                case RPGMakerVersion.Xp:
                case RPGMakerVersion.Vx:
                    RGSSADv1 rgssadv1 = new RGSSADv1(_commandLineOptions.InputPaths.First());
                    rgssadv1.ExtractAllFiles(outputDirectoryPath);
                    break;

                case RPGMakerVersion.VxAce:
                    RGSSADv3 rgssadv2 = new RGSSADv3(_commandLineOptions.InputPaths.First());
                    rgssadv2.ExtractAllFiles(outputDirectoryPath);
                    break;
                }
            }
            catch (InvalidArchiveException)
            {
                Console.WriteLine("Archive is invalid or corrupted. Reading failed.");
                Environment.Exit(1);
            }
            catch (UnsupportedArchiveException)
            {
                Console.WriteLine("Archive is not supported or it is corrupted.");
                Environment.Exit(1);
            }
            catch (Exception)
            {
                Console.WriteLine("Something went wrong with reading or extraction. Archive is likely invalid or corrupted.");
                Environment.Exit(1);
            }


            if (_commandLineOptions.GenerateProjectFile)
            {
                ProjectGenerator.GenerateProject(version, outputDirectoryPath);
            }
        }