Exemplo n.º 1
0
        //loadPreset loads -- -_-
        public void loadPreset()
        {
            currentDirectory = "";
            presetName       = "";

            FolderBrowser2 directoryFolderBrowser = new FolderBrowser2();

            directoryFolderBrowser.ShowDialog(null);

            if (directoryFolderBrowser.DirectoryPath != null)
            {
                currentDirectory = directoryFolderBrowser.DirectoryPath;

                //If we've gone in 1 folder too deep past preset.xml (so either the Named or Original folder)
                if (System.IO.Path.GetFileName(currentDirectory) == "Named" || System.IO.Path.GetFileName(currentDirectory) == "Original")
                {
                    currentDirectory = System.IO.Path.GetFullPath(System.IO.Path.Combine(currentDirectory, @"..\"));    //Take Named/Original off currentDirectory
                }

                if (!File.Exists(currentDirectory + "\\preset.xml"))
                {
                    MessageBox.Show("Invalid folder - preset.xml not found! Please ensure your selected folder contains a valid preset!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
                }

                else
                {
                    enableUI();

                    string presetName = getCustomFilesForPreset();
                    presetBox.Text = presetName;
                    tagForThisPreset(presetName);
                }

                currentDirectory += "//Original//";
            }

            else
            {
                MessageBox.Show("Please ensure you select a folder!", "Error!", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
Exemplo n.º 2
0
        //browseButton_Click event allows the user to browse for an designate a new Undertale install directory
        private async void browseButton_Click(object sender, RoutedEventArgs e)
        {
            FolderBrowser2 directoryFolderBrowser = new FolderBrowser2();

            directoryFolderBrowser.ShowDialog((System.Windows.Forms.IWin32Window) this.Owner);

            if (File.Exists(directoryFolderBrowser.DirectoryPath + "//UNDERTALE.exe"))
            {
                WaitingWindow waitWindow = new WaitingWindow("Backing Up", "Backing up game files, please wait. This may take some time.");
                waitWindow.Owner = this;
                Hide();
                waitWindow.Show();
                await Task.Run(() => FileOperations.backupFilesFromGameDirectory(directoryFolderBrowser.DirectoryPath));

                waitWindow.Close();
                Show();

                browseButton.IsEnabled      = false;
                saveEditorButton.IsEnabled  = true;
                musicEditorButton.IsEnabled = true;
                optionsButton.IsEnabled     = true;
                savesCombo.IsEnabled        = true;
                presetsCombo.IsEnabled      = true;
                debugCheck.IsEnabled        = true;
                launchButton.IsEnabled      = true;

                populateSavesCombo();
                populatePresetsCombo();

                try
                {
                    string gameVersion = FileVersionInfo.GetVersionInfo(directoryFolderBrowser.DirectoryPath + "//UNDERTALE.exe").ProductVersion;
                    gameVersion = gameVersion.Replace(" ", String.Empty);   //Remove any spaces at the end of the version

                    XML.WriteGamePath(directoryFolderBrowser.DirectoryPath);

                    directoryBlock.Text    = "Path: " + XML.GetGamePath();
                    directoryBlock.ToolTip = XML.GetGamePath();

                    if (FileOperations.disableDogcheck(gameVersion, directoryFolderBrowser.DirectoryPath + "//data.win"))   //We disable dogcheck at the game directory
                    {
                        versionBlock.Text = "Game Version: " + gameVersion + ", Dog Check DISABLED.";
                    }

                    else
                    {
                        this.Close();
                    }
                }

                catch (Exception ex)
                {
                    MessageBox.Show("Unable to verify game version. This could indicate the Undertale.exe file is invalid or corrupt. Please try again and ensure the selected directory is correct. If the issue persists, please redownload the game. The exception is: " + ex, "Invalid Game Version!", MessageBoxButton.OK, MessageBoxImage.Error);
                }
            }

            else if (directoryFolderBrowser.DirectoryPath != null)
            {
                Dictionary <Characters, string> messageDict = new Dictionary <Characters, string>()
                {
                    { Characters.Alphys, "I'm real s-s-sorry, but I c-c-couldn't find the Undertale.exe in that folder." },
                    { Characters.Asgore, "I'm greatly sorry human, but I was unable to find the Undertale.exe in that folder." },
                    { Characters.Asriel, "I'm so sorry, but I can't find the Undertale.exe in that folder." },
                    { Characters.Flowey, "YOU. IDIOT. I can't find the Undertale.exe in that folder!" },
                    { Characters.Papyrus, "NYOO HOO HOO. I AM SORRY, BUT I'VE FAILED TO FIND THE UNDERTALE.EXE IN THAT FOLDER." },
                    { Characters.Sans, "c'mon pal, help me out here. i can't find the undertale.exe in that folder." },
                    { Characters.Toriel, "I'm afraid that I was unable to locate the Undertale.exe in that folder, my child." },
                    { Characters.Undyne, "HEY, COME ON PUNK! I can't find the Undertale.exe in that folder." },
                    { Characters.None, "Cannot locate Undertale.exe in the folder specified. Please navigate to a valid Undertale installation folder." }
                };

                UTMessageBox.Show(messageDict, Constants.CharacterReactions.Negative, MessageBoxButton.OK);
            }
        }