Add a method for removing config values

This commit is contained in:
Manuel Thalmann 2023-06-29 19:11:16 +02:00
parent bf6700ae2f
commit 33d7d4834c

View file

@ -31,11 +31,6 @@ class Context {
return Get-Item $this.ConfigRoot; return Get-Item $this.ConfigRoot;
} }
[void] Set([string] $key, $value, [Microsoft.Win32.RegistryValueKind] $type) {
$configKey = $this.EnsureConfigKey();
$configKey.SetValue($key, $value, $type);
}
[object] Get([string] $key) { [object] Get([string] $key) {
$configKey = $this.EnsureConfigKey(); $configKey = $this.EnsureConfigKey();
if ($configKey.GetValueNames().Contains($key)) { if ($configKey.GetValueNames().Contains($key)) {
@ -45,6 +40,16 @@ class Context {
} }
} }
[void] Set([string] $key, $value, [Microsoft.Win32.RegistryValueKind] $type) {
$configKey = $this.EnsureConfigKey();
$configKey.SetValue($key, $value, $type);
}
[void] Remove([string] $key) {
$configKey = $this.EnsureConfigKey();
$configKey.DeleteValue($key);
}
[void] SetStage([string] $name) { [void] SetStage([string] $name) {
$this.Set($this.StagePropertyName, $name, "ExpandString"); $this.Set($this.StagePropertyName, $name, "ExpandString");
} }