Пример #1
0
        public static FormExceptionDialog OpenDialog(Exception ex)
        {
            FormExceptionDialog form = new FormExceptionDialog();

            try
            {
                form.textBoxDebugText.Text = $"Operating system:  {Utils.GetOSName()} {Utils.GetOSArchitecture()}\r\n" +
                                             $"Program version:   {Shared.VERSION}\r\n" +
                                             $"Program locale:    {Localization.Locale}\r\n" +
                                             "\r\n" +
                                             $"************** Exception Text **************\r\n{ex.GetType()}: {ex.Message}\r\n{ex.StackTrace}\r\n";
            }
            catch
            {
                form.textBoxDebugText.Text = $"************** Exception Text **************\r\n{ex.GetType()}: {ex.Message}\r\n{ex.StackTrace}\r\n";
            }

            form.ShowDialog();

            return(form);
        }
        public static FormExceptionDialog OpenDialog(Exception ex)
        {
            FormExceptionDialog form = new FormExceptionDialog();

            try
            {
                string      currentIniPrefix   = "Fallout76";
                string      currentGamePath    = null;
                GameEdition currentGameEdition = GameEdition.Unknown;

                if (ProfileManager.SelectedGame != null)
                {
                    currentIniPrefix = ProfileManager.SelectedGame.IniPrefix;
                    if (ProfileManager.SelectedGame.ValidateGamePath())
                    {
                        currentGamePath = ProfileManager.SelectedGame.GamePath;
                    }
                    currentGameEdition = ProfileManager.SelectedGame.Edition;
                }

                form.textBoxDebugText.Text = $"Operating system:  {Utils.GetOSName()} {Utils.GetOSArchitecture()}\r\n" +
                                             $"Program version:   {Shared.VERSION}\r\n" +
                                             $"User agent:        {Shared.AppUserAgent}\r\n" +
                                             $"Running as admin:  " + (Utils.HasAdminRights() ? "Yes" : "No") + "\r\n" +
                                             $"Game edition:      {currentGameEdition}" +
                                             $"System locale:     {System.Globalization.CultureInfo.CurrentUICulture.Name}\r\n" +
                                             $"App locale:        {Localization.Locale}" +
                                             "\r\n";
            }
            catch { }

            form.textBoxDebugText.Text += $"************** Stack trace **************\r\n" +
                                          $"If any files are listed (like \"D:\\Workspace\\...\\*.cs:line 123\"):\r\nThose are files on *my* computer, so don't worry if you can't find them.\r\n\r\n" +
                                          $"{ex.GetType()}: {ex.Message}\r\n{ex.StackTrace}\r\n";

            form.ShowDialog();

            return(form);
        }