Ejemplo n.º 1
0
        private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
        {
            using (SonicRetro.SAModel.SAEditorCommon.UI.ProgressDialog progress = new SonicRetro.SAModel.SAEditorCommon.UI.ProgressDialog("Building Project"))
            {
                Action showProgress = () =>
                {
                    Invoke((Action)progress.Show);
                };

                Action <int> setSteps = (int count) =>
                {
                    progress.SetMaxSteps(count);
                };

                Action <string> stepProgress = (string update) =>
                {
                    progress.StepProgress();
                    progress.SetStep(update);
                };

                AutoBuild(showProgress, setSteps, stepProgress);
            }
        }
Ejemplo n.º 2
0
        void splitGame(string game, SonicRetro.SAModel.SAEditorCommon.UI.ProgressDialog progress)
        {
            string appPath = Path.GetDirectoryName(Application.ExecutablePath);
            string iniFolder;

            progress.SetMaxSteps(setProgressMaxStep());

            if (Directory.Exists(Path.Combine(appPath, dataFolder)))
            {
                iniFolder = Path.Combine(appPath, dataFolder);
            }
            else
            {
                iniFolder = Path.Combine(appPath, "..\\..\\Configuration", dataFolder);
            }

            progress.SetTask("Splitting Game Content");
            foreach (Templates.SplitEntry splitEntry in splitEntries)
            {
                splitFiles(splitEntry, progress, gamePath, iniFolder, projFolder);
            }

            switch (game)
            {
            case "SADXPC":
                progress.SetTask("Finalizing Moddable Project Setup");
                makeProjectFolders(projFolder, progress, gameName);
                progress.StepProgress();
                progress.SetStep("Copying Object Definitions");
                string objdefsPath       = GetObjDefsDirectory();
                string outputObjdefsPath = Path.Combine(projFolder, "objdefs");
                if (Directory.Exists(objdefsPath))
                {
                    CopyFolder(objdefsPath, outputObjdefsPath);
                    File.Copy(Path.Combine(iniFolder, "sadxlvl.ini"), Path.Combine(projFolder, "sadxlvl.ini"));
                    File.Copy(Path.Combine(iniFolder, "objdefs.ini"), Path.Combine(projFolder, "objdefs.ini"));
                }
                else
                {
                    MessageBox.Show(("Path to objdefs is missing\n\nPress OK to abort."), "Split Failed", MessageBoxButtons.OK, MessageBoxIcon.Warning);

                    throw new Exception(SplitERRORVALUE.UnhandledException.ToString());
                }
                break;

            case "SA2PC":
                if (splitMdlEntries.Count > 0)
                {
                    progress.SetTask("Splitting Character Models");
                    foreach (Templates.SplitEntryMDL splitMDL in splitMdlEntries)
                    {
                        splitMdlFiles(splitMDL, progress, gamePath, projFolder);
                    }
                }

                break;
            }
            if (game == "SADXPC" || game == "SA2PC")
            {
                progress.SetTask("Finalizing Project Setup");
                makeProjectFolders(projFolder, progress, game);
                GenerateModFile(game, progress, projFolder, Path.GetFileNameWithoutExtension(projName));
            }
        }