Correction README.md

Ajout modification du fichier Project.gfx
This commit is contained in:
2026-03-05 10:36:52 +01:00
parent 83df3cc4ef
commit bd4fde8190
5 changed files with 204 additions and 19 deletions

View File

@@ -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