1
0
forked from liza/Questionable

Adjust log levels for quests loaded in dev

This commit is contained in:
Liza 2024-07-28 21:49:31 +02:00
parent fd62d925e4
commit 25f985c132
Signed by: liza
GPG Key ID: 7199F8D727D55F67

View File

@ -99,17 +99,23 @@ internal sealed class QuestRegistry
try try
{ {
LoadFromDirectory( LoadFromDirectory(
new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "2.x - A Realm Reborn"))); new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "2.x - A Realm Reborn")),
LogLevel.Trace);
LoadFromDirectory( LoadFromDirectory(
new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "3.x - Heavensward"))); new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "3.x - Heavensward")),
LogLevel.Trace);
LoadFromDirectory( LoadFromDirectory(
new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "4.x - Stormblood"))); new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "4.x - Stormblood")),
LogLevel.Trace);
LoadFromDirectory( LoadFromDirectory(
new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "5.x - Shadowbringers"))); new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "5.x - Shadowbringers")),
LogLevel.Trace);
LoadFromDirectory( LoadFromDirectory(
new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "6.x - Endwalker"))); new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "6.x - Endwalker")),
LogLevel.Trace);
LoadFromDirectory( LoadFromDirectory(
new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "7.x - Dawntrail"))); new DirectoryInfo(Path.Combine(pathProjectDirectory.FullName, "7.x - Dawntrail")),
LogLevel.Trace);
} }
catch (Exception e) catch (Exception e)
{ {
@ -145,7 +151,7 @@ internal sealed class QuestRegistry
_quests[questId.Value] = quest; _quests[questId.Value] = quest;
} }
private void LoadFromDirectory(DirectoryInfo directory) private void LoadFromDirectory(DirectoryInfo directory, LogLevel logLevel = LogLevel.Information)
{ {
if (!directory.Exists) if (!directory.Exists)
{ {
@ -153,7 +159,7 @@ internal sealed class QuestRegistry
return; return;
} }
_logger.LogInformation("Loading quests from {DirectoryName}", directory); _logger.Log(logLevel, "Loading quests from {DirectoryName}", directory);
foreach (FileInfo fileInfo in directory.GetFiles("*.json")) foreach (FileInfo fileInfo in directory.GetFiles("*.json"))
{ {
try try
@ -168,7 +174,7 @@ internal sealed class QuestRegistry
} }
foreach (DirectoryInfo childDirectory in directory.GetDirectories()) foreach (DirectoryInfo childDirectory in directory.GetDirectories())
LoadFromDirectory(childDirectory); LoadFromDirectory(childDirectory, logLevel);
} }
private static ushort? ExtractQuestIdFromName(string resourceName) private static ushort? ExtractQuestIdFromName(string resourceName)