2024-03-02 07:24:09 -08:00
|
|
|
# This is meant to be used with build.ps1, and is not a standalone script.
|
|
|
|
|
|
|
|
function Get-IniContent { param([ string]$filePath )
|
2024-06-28 00:27:25 -07:00
|
|
|
$ini = @{}
|
|
|
|
$currentSection = $null
|
|
|
|
switch -regex -file $filePath
|
2024-03-02 07:24:09 -08:00
|
|
|
{
|
2024-06-28 00:27:25 -07:00
|
|
|
"^\[(.+)\]$" {
|
|
|
|
$currentSection = $matches[1].Trim()
|
|
|
|
$ini[$currentSection] = @{}
|
|
|
|
}
|
|
|
|
"^(.+?)\s*=\s*(.*)" {
|
|
|
|
$key, $value = $matches[1].Trim(), $matches[2].Trim()
|
|
|
|
if ($null -ne $currentSection) {
|
|
|
|
$ini[$currentSection][$key] = $value
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return $ini
|
2024-03-02 07:24:09 -08:00
|
|
|
}
|