Prechádzať zdrojové kódy

Write default values to config on get

Bepis 7 rokov pred
rodič
commit
79e1446bd6
1 zmenil súbory, kde vykonal 6 pridanie a 0 odobranie
  1. 6 0
      BepInEx/Config.cs

+ 6 - 0
BepInEx/Config.cs

@@ -60,12 +60,18 @@ namespace BepInEx
             Dictionary<string, string> subdict;
 
             if (!cache.TryGetValue(section, out subdict))
+            {
+                SetEntry(key, defaultValue, section);
                 return defaultValue;
+            }
 
             if (subdict.TryGetValue(key, out string value))
                 return value;
             else
+            {
+                SetEntry(key, defaultValue, section);
                 return defaultValue;
+            }
         }
 
         /// <summary>