Deletes an entry from the configuration system. The name of the config directory. The name of the config entry.
(string directoryName, string entryName)
| 186 | /// <param name="directoryName">The name of the config directory.</param> |
| 187 | /// <param name="entryName">The name of the config entry.</param> |
| 188 | public static void DeleteEntry(string directoryName, string entryName) |
| 189 | { |
| 190 | using RegistryKey? configKey = GetConfigSystemKey(); |
| 191 | using RegistryKey? key = configKey?.OpenSubKey(directoryName, true); |
| 192 | |
| 193 | if (key != null && key.GetValueNames().Contains(entryName)) |
| 194 | { |
| 195 | key.DeleteValue(entryName); |
| 196 | |
| 197 | Log.Information( |
| 198 | new LogTextItem("Deleted config system entry"), |
| 199 | new LogFileItem($"{directoryName}/{entryName}") |
| 200 | ); |
| 201 | } |
| 202 | else |
| 203 | { |
| 204 | Log.Error( |
| 205 | new LogTextItem("Failed to delete config system entry"), |
| 206 | new LogFileItem($"{directoryName}/{entryName}") |
| 207 | ); |
| 208 | } |
| 209 | } |
| 210 | } |
no test coverage detected