Refactor processing of partition modifications

This commit is contained in:
Manuel Thalmann 2023-07-09 00:00:00 +02:00
parent abcaf0ef99
commit 150892e21b

View file

@ -51,13 +51,13 @@ $Global:SetupConfigPostprocessor = {
$newPartition.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
$null = $partitionCreationContainer.AppendChild($newPartition);
$partitionModifications = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);
$newModification = $partitionModifications.SelectNodes("./ua:ModifyPartition", $namespace)[2].CloneNode($true);
$partitionModificationContainer = $diskConfig.SelectSingleNode("./ua:ModifyPartitions", $namespace);
$partitionModifications = $partitionModificationContainer.SelectNodes("./ModifyPartition", $namespace);
$newModification = $partitionModifications[1].CloneNode($true);
$newModification.SelectSingleNode("./ua:Order", $namespace).InnerText = "$newIndex";
$newModification.SelectSingleNode("./ua:PartitionID", $namespace).InnerText = "$newIndex";
for ($i = 0; $i -lt $partitionModifications.ChildNodes.Count; $i++) {
$partition = $partitionModifications.ChildNodes[$i];
foreach ($partition in $partitionModifications) {
$partitionID = [int]$partition.SelectSingleNode("./ua:PartitionID", $namespace).InnerText;
$newID = $partitionID;
@ -79,7 +79,7 @@ $Global:SetupConfigPostprocessor = {
}
}
$null = $partitionModifications.AppendChild($newModification);
$null = $partitionModificationContainer.AppendChild($newModification);
}
. "$PSScriptRoot/../../../scripts/Windows/OS/Setup.ps1";