コード例 #1
0
ファイル: OldGameImporter.cs プロジェクト: Aquilon96/ags
        public Game ImportGameFromAGS272(string gameToLoad, bool useWizard)
        {
            string backupLocation = ConstructBackupDirectoryName(gameToLoad);
            Game game = null;
            bool continueWithImport = true;
            bool performBackup = false;

            if (useWizard)
            {
                ImportGameWizardPage importPage = new ImportGameWizardPage(backupLocation);
                List<WizardPage> pages = new List<WizardPage>();
                pages.Add(importPage);
                WizardDialog dialog = new WizardDialog("Import Old Game", "This wizard will guide you through importing a game from a previous version of AGS.", pages);
                DialogResult result = dialog.ShowDialog();
                continueWithImport = (result == DialogResult.OK);
                performBackup = importPage.BackupEnabled;
                dialog.Dispose();
            }

            if (continueWithImport)
            {
                if (performBackup)
                {
                    try
                    {
                        BusyDialog.Show("Please wait while your game files are backed up...", new BusyDialog.ProcessingHandler(MakeBackupCopyOfGameFolderThread), backupLocation);
                    }
                    catch (Exception ex)
                    {
                        if (Factory.GUIController.ShowQuestion("An error occured whilst backing up your game files.\n\nError: " + ex.Message + "\n\nDo you want to proceed and upgrade the game anyway?", MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return null;
                        }
                    }
                }
                ImportGameResult importResult = (ImportGameResult)BusyDialog.Show("Please wait while your game is imported...", new BusyDialog.ProcessingHandler(ImportOldGameThread), gameToLoad);
                game = importResult.LoadedGame;
                Factory.Events.OnImportedOldGame();

                Factory.GUIController.ShowOutputPanel(importResult.Errors);
                if (importResult.Errors.Count > 0)
                {
                    Factory.GUIController.ShowMessage("Some errors were encountered whilst importing the game. Check the output window for details.", MessageBoxIcon.Warning);
                }

            }
            return game;
        }
コード例 #2
0
ファイル: OldGameImporter.cs プロジェクト: writeescape/ags
        public Game ImportGameFromAGS272(string gameToLoad, bool useWizard)
        {
            string backupLocation     = ConstructBackupDirectoryName(gameToLoad);
            Game   game               = null;
            bool   continueWithImport = true;
            bool   performBackup      = false;

            if (useWizard)
            {
                ImportGameWizardPage importPage = new ImportGameWizardPage(backupLocation);
                List <WizardPage>    pages      = new List <WizardPage>();
                pages.Add(importPage);
                WizardDialog dialog = new WizardDialog("Import Old Game", "This wizard will guide you through importing a game from a previous version of AGS.", pages);
                DialogResult result = dialog.ShowDialog();
                continueWithImport = (result == DialogResult.OK);
                performBackup      = importPage.BackupEnabled;
                dialog.Dispose();
            }

            if (continueWithImport)
            {
                if (performBackup)
                {
                    try
                    {
                        BusyDialog.Show("Please wait while your game files are backed up...", new BusyDialog.ProcessingHandler(MakeBackupCopyOfGameFolderThread), backupLocation);
                    }
                    catch (Exception ex)
                    {
                        if (Factory.GUIController.ShowQuestion("An error occured whilst backing up your game files.\n\nError: " + ex.Message + "\n\nDo you want to proceed and upgrade the game anyway?", MessageBoxIcon.Warning) == DialogResult.No)
                        {
                            return(null);
                        }
                    }
                }
                ImportGameResult importResult = (ImportGameResult)BusyDialog.Show("Please wait while your game is imported...", new BusyDialog.ProcessingHandler(ImportOldGameThread), gameToLoad);
                game = importResult.LoadedGame;
                Factory.Events.OnImportedOldGame();

                Factory.GUIController.ShowOutputPanel(importResult.Errors);
                if (importResult.Errors.Count > 0)
                {
                    Factory.GUIController.ShowMessage("Some errors were encountered whilst importing the game. Check the output window for details.", MessageBoxIcon.Warning);
                }
            }
            return(game);
        }