瀏覽代碼

Write default values to config on get

Bepis 7 年之前
父節點
當前提交
79e1446bd6
共有 1 個文件被更改,包括 6 次插入0 次删除
  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>