- [Core] Added export option to include materials with models in /Materials.

- [GUI] fix issue with `Reset` button causing unintended behaviour.
- [Core] fix bug where `Logger` causes performance issues.
This commit is contained in:
Razmoth
2024-01-30 19:57:10 +04:00
parent f2d65e458c
commit 92d7470082
14 changed files with 144 additions and 152 deletions

View File

@@ -13,11 +13,8 @@ namespace AssetStudio
public static ILogger Default = new DummyLogger();
public static ILogger File;
public static bool Silent
{
get => Default.Silent;
set => Default.Silent = value;
}
public static bool Silent { get; set; }
public static LoggerEvent Flags { get; set; }
public static bool FileLogging
{
@@ -48,6 +45,9 @@ namespace AssetStudio
public static void Verbose(string message)
{
if (!Flags.HasFlag(LoggerEvent.Verbose) || Silent)
return;
try
{
var callerMethod = new StackTrace().GetFrame(1).GetMethod();
@@ -63,27 +63,42 @@ namespace AssetStudio
}
public static void Debug(string message)
{
if (!Flags.HasFlag(LoggerEvent.Debug) || Silent)
return;
if (FileLogging) File.Log(LoggerEvent.Debug, message);
Default.Log(LoggerEvent.Debug, message);
}
public static void Info(string message)
{
if (!Flags.HasFlag(LoggerEvent.Info) || Silent)
return;
if (FileLogging) File.Log(LoggerEvent.Info, message);
Default.Log(LoggerEvent.Info, message);
}
public static void Warning(string message)
{
if (!Flags.HasFlag(LoggerEvent.Warning) || Silent)
return;
if (FileLogging) File.Log(LoggerEvent.Warning, message);
Default.Log(LoggerEvent.Warning, message);
}
public static void Error(string message)
{
if (!Flags.HasFlag(LoggerEvent.Error) || Silent)
return;
if (FileLogging) File.Log(LoggerEvent.Error, message);
Default.Log(LoggerEvent.Error, message);
}
public static void Error(string message, Exception e)
{
if (!Flags.HasFlag(LoggerEvent.Error) || Silent)
return;
var sb = new StringBuilder();
sb.AppendLine(message);
sb.AppendLine(e.ToString());