[GUI] Replace "Show all error msgs" option with "Show debug msgs"

This commit is contained in:
VaDiM 2024-02-08 22:42:54 +03:00
parent 6fe12d274f
commit d4162161be
5 changed files with 15 additions and 20 deletions

View File

@ -20,7 +20,7 @@ namespace AssetStudio
var readed = reader.Position - reader.byteStart; var readed = reader.Position - reader.byteStart;
if (readed != reader.byteSize) if (readed != reader.byteSize)
{ {
Logger.Info($"Error while read type, read {readed} bytes but expected {reader.byteSize} bytes"); Logger.Info($"Failed to read type, read {readed} bytes but expected {reader.byteSize} bytes");
} }
return sb.ToString(); return sb.ToString();
} }
@ -177,7 +177,7 @@ namespace AssetStudio
var readed = reader.Position - reader.byteStart; var readed = reader.Position - reader.byteStart;
if (readed != reader.byteSize) if (readed != reader.byteSize)
{ {
Logger.Info($"Error while read type, read {readed} bytes but expected {reader.byteSize} bytes"); Logger.Info($"Failed to read type, read {readed} bytes but expected {reader.byteSize} bytes");
} }
return obj; return obj;
} }

View File

@ -599,8 +599,8 @@
// debugMenuItem // debugMenuItem
// //
this.debugMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] { this.debugMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.toolStripMenuItem15,
this.showConsoleToolStripMenuItem, this.showConsoleToolStripMenuItem,
this.toolStripMenuItem15,
this.writeLogToFileToolStripMenuItem, this.writeLogToFileToolStripMenuItem,
this.exportClassStructuresMenuItem}); this.exportClassStructuresMenuItem});
this.debugMenuItem.Name = "debugMenuItem"; this.debugMenuItem.Name = "debugMenuItem";
@ -611,8 +611,8 @@
// //
this.toolStripMenuItem15.CheckOnClick = true; this.toolStripMenuItem15.CheckOnClick = true;
this.toolStripMenuItem15.Name = "toolStripMenuItem15"; this.toolStripMenuItem15.Name = "toolStripMenuItem15";
this.toolStripMenuItem15.Size = new System.Drawing.Size(200, 22); this.toolStripMenuItem15.Size = new System.Drawing.Size(288, 22);
this.toolStripMenuItem15.Text = "Show all error messages"; this.toolStripMenuItem15.Text = "Show debug messages in console logger";
this.toolStripMenuItem15.Click += new System.EventHandler(this.toolStripMenuItem15_Click); this.toolStripMenuItem15.Click += new System.EventHandler(this.toolStripMenuItem15_Click);
// //
// showConsoleToolStripMenuItem // showConsoleToolStripMenuItem
@ -621,7 +621,7 @@
this.showConsoleToolStripMenuItem.CheckOnClick = true; this.showConsoleToolStripMenuItem.CheckOnClick = true;
this.showConsoleToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked; this.showConsoleToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showConsoleToolStripMenuItem.Name = "showConsoleToolStripMenuItem"; this.showConsoleToolStripMenuItem.Name = "showConsoleToolStripMenuItem";
this.showConsoleToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.showConsoleToolStripMenuItem.Size = new System.Drawing.Size(288, 22);
this.showConsoleToolStripMenuItem.Text = "Show console logger"; this.showConsoleToolStripMenuItem.Text = "Show console logger";
this.showConsoleToolStripMenuItem.Click += new System.EventHandler(this.showConsoleToolStripMenuItem_Click); this.showConsoleToolStripMenuItem.Click += new System.EventHandler(this.showConsoleToolStripMenuItem_Click);
// //
@ -629,14 +629,14 @@
// //
this.writeLogToFileToolStripMenuItem.CheckOnClick = true; this.writeLogToFileToolStripMenuItem.CheckOnClick = true;
this.writeLogToFileToolStripMenuItem.Name = "writeLogToFileToolStripMenuItem"; this.writeLogToFileToolStripMenuItem.Name = "writeLogToFileToolStripMenuItem";
this.writeLogToFileToolStripMenuItem.Size = new System.Drawing.Size(200, 22); this.writeLogToFileToolStripMenuItem.Size = new System.Drawing.Size(288, 22);
this.writeLogToFileToolStripMenuItem.Text = "Write log to file"; this.writeLogToFileToolStripMenuItem.Text = "Write log to file";
this.writeLogToFileToolStripMenuItem.CheckedChanged += new System.EventHandler(this.writeLogToFileToolStripMenuItem_CheckedChanged); this.writeLogToFileToolStripMenuItem.CheckedChanged += new System.EventHandler(this.writeLogToFileToolStripMenuItem_CheckedChanged);
// //
// exportClassStructuresMenuItem // exportClassStructuresMenuItem
// //
this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem"; this.exportClassStructuresMenuItem.Name = "exportClassStructuresMenuItem";
this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(200, 22); this.exportClassStructuresMenuItem.Size = new System.Drawing.Size(288, 22);
this.exportClassStructuresMenuItem.Text = "Export class structures"; this.exportClassStructuresMenuItem.Text = "Export class structures";
this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click); this.exportClassStructuresMenuItem.Click += new System.EventHandler(this.exportClassStructuresMenuItem_Click);
// //
@ -1284,7 +1284,7 @@
this.goToSceneHierarchyToolStripMenuItem, this.goToSceneHierarchyToolStripMenuItem,
this.showOriginalFileToolStripMenuItem}); this.showOriginalFileToolStripMenuItem});
this.contextMenuStrip1.Name = "contextMenuStrip1"; this.contextMenuStrip1.Name = "contextMenuStrip1";
this.contextMenuStrip1.Size = new System.Drawing.Size(332, 246); this.contextMenuStrip1.Size = new System.Drawing.Size(332, 224);
// //
// copyToolStripMenuItem // copyToolStripMenuItem
// //

View File

@ -1925,7 +1925,7 @@ namespace AssetStudioGUI
private void toolStripMenuItem15_Click(object sender, EventArgs e) private void toolStripMenuItem15_Click(object sender, EventArgs e)
{ {
logger.ShowErrorMessage = toolStripMenuItem15.Checked; logger.ShowDebugMessage = toolStripMenuItem15.Checked;
} }
private void sceneTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e) private void sceneTreeView_NodeMouseClick(object sender, TreeNodeMouseClickEventArgs e)

View File

@ -9,7 +9,7 @@ namespace AssetStudioGUI
{ {
class GUILogger : ILogger class GUILogger : ILogger
{ {
public bool ShowErrorMessage = false; public bool ShowDebugMessage = false;
private bool IsFileLoggerRunning = false; private bool IsFileLoggerRunning = false;
private string LoggerInitString; private string LoggerInitString;
private string FileLogName; private string FileLogName;
@ -123,6 +123,8 @@ namespace AssetStudioGUI
} }
//Console logger //Console logger
if (!ShowDebugMessage && loggerEvent == LoggerEvent.Debug)
return;
Console.WriteLine(FormatMessage(loggerEvent, message, toConsole: true)); Console.WriteLine(FormatMessage(loggerEvent, message, toConsole: true));
//GUI logger //GUI logger
@ -132,14 +134,7 @@ namespace AssetStudioGUI
MessageBox.Show(message, "Error"); MessageBox.Show(message, "Error");
break; break;
case LoggerEvent.Warning: case LoggerEvent.Warning:
if (ShowErrorMessage) action("Some warnings occurred. See Console Logger for details.");
{
MessageBox.Show(message, "Warning");
}
else
{
action("An error has occurred. Turn on \"Show all error messages\" to see details next time.");
}
break; break;
case LoggerEvent.Debug: case LoggerEvent.Debug:
break; break;

View File

@ -258,7 +258,7 @@ namespace CubismLive2DExtractor
} }
else else
{ {
Logger.Debug($"Exported {motions.Count} motion(s)"); Logger.Info($"Exported {motions.Count} motion(s)");
} }
#endregion #endregion