示例#1
0
 /// <summary>
 /// Will attempt to show the installer log folder to the user. On any failure
 /// will show a message box indicating that the log folder couldn't be shown.
 /// </summary>
 public static void TryShowLogFolder()
 {
     try
     {
         StandaloneUtils.OpenFolderInExplorer(Path.GetDirectoryName(GetFullLogFilePath()));
     }
     catch (Exception e)
     {
         MessageBox.Show($"Couldn't open log folder at [{GetFullLogFilePath()}]:\n\n{e.ToString()}");
     }
 }
        //Open the folder containing the game log file in Explorer
        private void Button_ShowGameLog(object sender, RoutedEventArgs e)
        {
            try
            {
                //scan inside the game folder for folder which end with '_Data'
                if (!BtnInstall.IsEnabled)
                {
                    MessageBox.Show("Please select the game folder first!");
                    return;
                }

                string[] subfoldersInGameFolder = Directory.GetDirectories(PathText.Text);

                string gameLogFolderPath = null;
                foreach (string subfolder in subfoldersInGameFolder)
                {
                    if (subfolder.ToLower().Contains("_data"))
                    {
                        gameLogFolderPath = subfolder;
                        break;
                    }
                }

                //open the folder
                if (gameLogFolderPath != null)
                {
                    bool gameLogFileFound = StandaloneUtils.SelectFileInExplorer(Path.Combine(gameLogFolderPath, "output_log.txt"));
                    if (!gameLogFileFound)
                    {
                        MessageBox.Show("Can't find log file. Maybe you haven't run the game yet?\n" +
                                        "Opening log file folder anyway.");
                        StandaloneUtils.OpenFolderInExplorer(gameLogFolderPath);
                    }
                }
                else
                {
                    MessageBox.Show("Couldn't find the game log folder!");
                }
            }
            catch
            {
                MessageBox.Show("Unexpected error while showing the game log.");
            }
        }
        private void Button_ClearInstallerTempFiles(object sender, RoutedEventArgs e)
        {
            try
            {
                if (!BtnInstall.IsEnabled)
                {
                    MessageBox.Show("Please select the game folder first!");
                    return;
                }

                MessageBox.Show("When you press 'OK', the installer temp folder will be opened in explorer. Please manually delete the files in this folder." +
                                "\n\nIf you are attemping to overwrite an existing install, it may be better 'start from scrach' by reinstalling the base game" +
                                "\n\nShould you still encounter issues, contact us on our discord.");

                StandaloneUtils.OpenFolderInExplorer(Path.Combine(PathText.Text, "temp"));
            }
            catch
            {
                MessageBox.Show("Unexpected error while showing the game log.");
            }
        }