45 lines
1.2 KiB
PowerShell
45 lines
1.2 KiB
PowerShell
function Resolve-ConfigurationDataValue {
|
|
[CmdletBinding()]
|
|
Param(
|
|
[AllowNull()]
|
|
$Value,
|
|
|
|
[Parameter(Mandatory=$true)]
|
|
$Context
|
|
)
|
|
|
|
if($null -eq $Value){
|
|
return $null
|
|
}
|
|
|
|
if($Value -is [System.Collections.Specialized.OrderedDictionary]){
|
|
$Resolved = [ordered]@{}
|
|
foreach($Entry in $Value.GetEnumerator()){
|
|
$Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context
|
|
}
|
|
return $Resolved
|
|
}
|
|
|
|
if($Value -is [System.Collections.Hashtable]){
|
|
$Resolved = @{}
|
|
foreach($Entry in $Value.GetEnumerator()){
|
|
$Resolved[$Entry.Name] = Resolve-ConfigurationDataValue -Value $Entry.Value -Context $Context
|
|
}
|
|
return $Resolved
|
|
}
|
|
|
|
if($Value -is [System.Array] -and $Value -isnot [string]){
|
|
$Resolved = @()
|
|
foreach($Item in $Value){
|
|
$Resolved += ,(Resolve-ConfigurationDataValue -Value $Item -Context $Context)
|
|
}
|
|
return ,$Resolved
|
|
}
|
|
|
|
if($Value -is [string] -and (Test-ConfigurationDataExpression -Value $Value)){
|
|
return Resolve-ConfigurationDataExpression -Expression $Value -Context $Context
|
|
}
|
|
|
|
return $Value
|
|
}
|