-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
154 additions
and
184 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -397,3 +397,7 @@ FodyWeavers.xsd | |
|
||
# JetBrains Rider | ||
*.sln.iml | ||
|
||
*.sln | ||
|
||
testResults.xml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,8 @@ | ||
# Import-ConfigData | ||
|
||
|
||
Load configuration data from multiple file types. | ||
## Cmdlets | ||
|
||
## Commands | ||
|
||
- [Import-ConfigData](Import-ConfigData.md) _Load configuration data from multiple file types._ | ||
|
||
- [Import-ConfigData](Import-ConfigData.md) Load configuration data from multiple file types. |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
function ConvertFrom-PSCustomObject ($Object) { | ||
|
||
foreach ($item in $Object) { | ||
|
||
$itemType = $item.GetType() | ||
|
||
if ($itemType.Name -eq 'PSCustomObject') { | ||
$keys = $item | Get-Member -MemberType NoteProperty | ||
|
||
$hash = @{} | ||
foreach ($key in $keys) { | ||
$name = $key.Name | ||
$value = @(ConvertFrom-PSCustomObject $item.$name) | ||
$hash.Add($name, $value) | ||
} | ||
$hash | Write-Output | ||
} | ||
|
||
if ($itemType.IsValueType -or $itemType.Name -eq 'String') { | ||
$item | Write-Output | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
function Import-JsonConfigData { | ||
[CmdletBinding()] | ||
param ( | ||
[Parameter(Mandatory, | ||
Position = 0, | ||
ValueFromPipeline, | ||
ValueFromPipelineByPropertyName)] | ||
[Alias("PSPath")] | ||
[ValidateNotNullOrEmpty()] | ||
[string] | ||
$Path | ||
) | ||
|
||
$content = Get-Content -Path $Path -Raw | ||
|
||
switch ($PSVersionTable.PSVersion.Major) { | ||
5 { | ||
$psObject = $content | ConvertFrom-Json | ||
ConvertFrom-PSCustomObject $psObject | ||
break | ||
} | ||
Default { | ||
$content | ConvertFrom-Json -AsHashtable | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.