Correction README.md
Ajout modification du fichier Project.gfx
This commit is contained in:
@@ -97,4 +97,34 @@ function Update-EnoceanDeviceId {
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Get-DeviceListFromJson, Parse-EnoceanDeviceXml, New-EnoceanDeviceXml, Update-EnoceanDeviceId
|
||||
function Update-GfxDeviceIds {
|
||||
[CmdletBinding()]
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
[string]$MainXmlContent,
|
||||
|
||||
[Parameter(Mandatory)]
|
||||
[hashtable]$DeviceIdMap # @{ "ancien_id" = "nouveau_id" }
|
||||
)
|
||||
|
||||
$modifiedXml = $MainXmlContent
|
||||
$replaceCount = 0
|
||||
|
||||
foreach ($oldId in $DeviceIdMap.Keys) {
|
||||
$newId = $DeviceIdMap[$oldId]
|
||||
$pattern = "<DeviceId>$oldId</DeviceId>"
|
||||
$replacement = "<DeviceId>$newId</DeviceId>"
|
||||
|
||||
if ($modifiedXml -match [regex]::Escape($pattern)) {
|
||||
$modifiedXml = $modifiedXml -replace [regex]::Escape($pattern), $replacement
|
||||
$replaceCount++
|
||||
}
|
||||
}
|
||||
|
||||
return @{
|
||||
ModifiedXml = $modifiedXml
|
||||
ReplaceCount = $replaceCount
|
||||
}
|
||||
}
|
||||
|
||||
Export-ModuleMember -Function Get-DeviceListFromJson, Parse-EnoceanDeviceXml, New-EnoceanDeviceXml, Update-EnoceanDeviceId, Update-GfxDeviceIds
|
||||
|
||||
Reference in New Issue
Block a user