Add Delete operation to IConfigurationProvider

This commit is contained in:
ghorsington committed 2021-07-04 13:02:55 +03:00
1 parent 256ed1e562
commit 441f302bf9
2 files changed
+10

No files matched your search

@@ -12,6 +12,8 @@ namespace BepInEx.Configuration
ConfigurationNode Get(string[] path);
void Set(string[] path, ConfigurationNode node);
ConfigurationNode Delete(string[] path);
IEnumerable<string[]> EntryPaths { get; }
}
@@ -79,6 +79,14 @@ namespace BepInEx.Configuration
public void Set(string[] path, ConfigurationNode node) => items[path] = node.Value;
public ConfigurationNode Delete(string[] path)
{
var val = Get(path);
if (val == null) return null;
items.Remove(path);
return val;
}
public IEnumerable<string[]> EntryPaths => items.Keys.ToList();
}
}