Skip to content
This repository was archived by the owner on Feb 28, 2024. It is now read-only.

Commit 4f70956

Browse files
committed
Merge remote-tracking branch 'upstream/master' into logging-fixes
# Conflicts: # NeosModLoader/Util.cs
2 parents e3fdb43 + 458ba47 commit 4f70956

File tree

2 files changed

+9
-17
lines changed

2 files changed

+9
-17
lines changed

NeosModLoader/ModConfiguration.cs

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -519,7 +519,7 @@ private bool AnyValuesSet()
519519

520520

521521
/// <summary>
522-
/// Persist this configuration to disk. This method is not called automatically.
522+
/// Asynchronously persist this configuration to disk.
523523
/// </summary>
524524
/// <param name="saveDefaultValues">If true, default values will also be persisted</param>
525525
/// <param name="immediate">Skip the debouncing and save immediately</param>
@@ -583,8 +583,11 @@ internal void Save(bool saveDefaultValues = false, bool immediate = false)
583583
}
584584
}
585585

586-
// performs the actual, synchronous save
587-
private void SaveInternal(bool saveDefaultValues)
586+
/// <summary>
587+
/// performs the actual, synchronous save
588+
/// </summary>
589+
/// <param name="saveDefaultValues">If true, default values will also be persisted</param>
590+
private void SaveInternal(bool saveDefaultValues = false)
588591
{
589592
Stopwatch stopwatch = Stopwatch.StartNew();
590593
JObject json = new()
@@ -680,7 +683,8 @@ private static void ShutdownHook()
680683
{
681684
try
682685
{
683-
config!.Save();
686+
// synchronously save the config
687+
config!.SaveInternal();
684688
}
685689
catch (Exception e)
686690
{

NeosModLoader/Util.cs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -118,6 +118,7 @@ private static bool CheckType(Type type, Predicate<Type> predicate)
118118
{
119119
return false;
120120
}
121+
121122
try
122123
{
123124
string _name = type.Name;
@@ -127,19 +128,6 @@ private static bool CheckType(Type type, Predicate<Type> predicate)
127128
Logger.DebugFuncInternal(() => $"Could not read the name for a type: {e}");
128129
return false;
129130
}
130-
try
131-
{
132-
if (type.TypeInitializer == null)
133-
{
134-
Logger.DebugFuncInternal(() => $"No TypeInitializer for type \"{type}\"");
135-
return false;
136-
}
137-
}
138-
catch (Exception e)
139-
{
140-
Logger.DebugFuncInternal(() => $"Could not read TypeInitializer for type \"{type}\": {e}");
141-
return false;
142-
}
143131

144132
try
145133
{

0 commit comments

Comments
 (0)