mirror of
https://github.com/aelurum/AssetStudio.git
synced 2025-05-25 05:40:21 -04:00
43 lines
1.1 KiB
C#
43 lines
1.1 KiB
C#
using AssetStudio;
|
|
using System;
|
|
using System.Windows.Forms;
|
|
|
|
namespace AssetStudioGUI
|
|
{
|
|
class GUILogger : ILogger
|
|
{
|
|
public bool ShowErrorMessage = false;
|
|
private Action<string> action;
|
|
|
|
public GUILogger(Action<string> action)
|
|
{
|
|
this.action = action;
|
|
}
|
|
|
|
public void Log(LoggerEvent loggerEvent, string message, bool ignoreLevel)
|
|
{
|
|
switch (loggerEvent)
|
|
{
|
|
case LoggerEvent.Error:
|
|
MessageBox.Show(message, "Error");
|
|
break;
|
|
case LoggerEvent.Warning:
|
|
if (ShowErrorMessage)
|
|
{
|
|
MessageBox.Show(message, "Warning");
|
|
}
|
|
else
|
|
{
|
|
action("An error has occurred. Turn on \"Show all error messages\" to see details next time.");
|
|
}
|
|
break;
|
|
case LoggerEvent.Debug:
|
|
break;
|
|
default:
|
|
action(message);
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|