8
0
Skriptentwickung/test/Konfig_auslesen.ps1
2024-01-24 16:42:38 +01:00

28 lines
583 B
PowerShell
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

LoadConfig Konfig_auslesen.xml
param($path = $(throw "You must specify a config file"))
$global:appSettings = @{}
$config = [xml](get-content $path)
foreach ($addNode in $config.configuration.appsettings.add) {
if ($addNode.Value.Contains(,)) {
# Array case
$value = $addNode.Value.Split(,)
for ($i = 0; $i -lt $value.length; $i++) {
$value[$i] = $value[$i].Trim()
}
}
else {
# Scalar case
$value = $addNode.Value
}
$global:appSettings[$addNode.Key] = $value
}
$appSettings["MaxScanDetailRows"]
$appSettings["datatypes"]
$appSettings["datatypes"][0]