From b146d251a7c32a415c5f8a4a79f69a068d9ec23d Mon Sep 17 00:00:00 2001 From: Perfare Date: Tue, 6 Jul 2021 15:57:59 +0800 Subject: [PATCH] add option to not show error message --- AssetStudioGUI/AssetStudioGUIForm.Designer.cs | 13 +++++++++++++ AssetStudioGUI/AssetStudioGUIForm.cs | 10 +++++++++- AssetStudioGUI/GUILogger.cs | 6 +++++- 3 files changed, 27 insertions(+), 2 deletions(-) diff --git a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs index 42123a8..494880d 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.Designer.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.Designer.cs @@ -74,6 +74,7 @@ this.filterTypeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.allToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.debugMenuItem = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripMenuItem15 = new System.Windows.Forms.ToolStripMenuItem(); this.exportClassStructuresMenuItem = new System.Windows.Forms.ToolStripMenuItem(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.tabControl1 = new System.Windows.Forms.TabControl(); @@ -500,11 +501,22 @@ // debugMenuItem // this.debugMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { + this.toolStripMenuItem15, this.exportClassStructuresMenuItem}); this.debugMenuItem.Name = "debugMenuItem"; this.debugMenuItem.Size = new System.Drawing.Size(59, 21); this.debugMenuItem.Text = "Debug"; // + // toolStripMenuItem15 + // + this.toolStripMenuItem15.Checked = true; + this.toolStripMenuItem15.CheckOnClick = true; + this.toolStripMenuItem15.CheckState = System.Windows.Forms.CheckState.Checked; + this.toolStripMenuItem15.Name = "toolStripMenuItem15"; + this.toolStripMenuItem15.Size = new System.Drawing.Size(207, 22); + this.toolStripMenuItem15.Text = "Show error message"; + this.toolStripMenuItem15.Click += new System.EventHandler(this.toolStripMenuItem15_Click); + // // exportClassStructuresMenuItem // this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem"; @@ -1197,6 +1209,7 @@ private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem13; private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem14; private System.Windows.Forms.ToolStripTextBox specifyUnityVersion; + private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem15; } } diff --git a/AssetStudioGUI/AssetStudioGUIForm.cs b/AssetStudioGUI/AssetStudioGUIForm.cs index dd02d76..b033826 100644 --- a/AssetStudioGUI/AssetStudioGUIForm.cs +++ b/AssetStudioGUI/AssetStudioGUIForm.cs @@ -85,6 +85,8 @@ namespace AssetStudioGUI private string openDirectoryBackup = string.Empty; private string saveDirectoryBackup = string.Empty; + private GUILogger logger; + [DllImport("gdi32.dll")] private static extern IntPtr AddFontMemResourceEx(IntPtr pbFont, uint cbFont, IntPtr pdv, [In] ref uint pcFonts); @@ -100,7 +102,8 @@ namespace AssetStudioGUI enablePreview.Checked = Properties.Settings.Default.enablePreview; FMODinit(); - Logger.Default = new GUILogger(StatusStripUpdate); + logger = new GUILogger(StatusStripUpdate); + Logger.Default = logger; Progress.Default = new GUIProgress(SetProgressBarValue); Studio.StatusStripUpdate = StatusStripUpdate; } @@ -2036,6 +2039,11 @@ namespace AssetStudioGUI } } + private void toolStripMenuItem15_Click(object sender, EventArgs e) + { + logger.ShowErrorMessage = toolStripMenuItem15.Checked; + } + private void glControl1_MouseWheel(object sender, MouseEventArgs e) { if (glControl1.Visible) diff --git a/AssetStudioGUI/GUILogger.cs b/AssetStudioGUI/GUILogger.cs index b697ad4..a2348d3 100644 --- a/AssetStudioGUI/GUILogger.cs +++ b/AssetStudioGUI/GUILogger.cs @@ -6,6 +6,7 @@ namespace AssetStudioGUI { class GUILogger : ILogger { + public bool ShowErrorMessage = true; private Action action; public GUILogger(Action action) @@ -18,7 +19,10 @@ namespace AssetStudioGUI switch (loggerEvent) { case LoggerEvent.Error: - MessageBox.Show(message); + if (ShowErrorMessage) + { + MessageBox.Show(message); + } break; default: action(message);