-
Notifications
You must be signed in to change notification settings - Fork 0
/
Convert-Layouts.ps1
39 lines (31 loc) · 1.15 KB
/
Convert-Layouts.ps1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Write-Host 'Converting layouts with regions to without'
# Style Cop Layout
$regionFile = 'csharp-layout-stylecop+regions.xml'
$plainFile = 'csharp-layout-stylecop.xml'
$regionPath = Join-Path $PSScriptRoot $regionFile;
$layoutXml = [xml](Get-Content -Path $regionPath);
foreach ($typePattern in $layoutXml.Patterns.TypePattern) {
foreach ($region in $typePattern.Region) {
foreach ($entry in $region.Entry) {
$typePattern.AppendChild($entry);
}
$typePattern.RemoveChild($region);
}
}
$plainPath = Join-Path $PSScriptRoot $plainFile;
$layoutXml.Save($plainPath);
# Documentation Layout
$regionFile = 'csharp-layout-documentation+regions.xml'
$plainFile = 'csharp-layout-documentation.xml'
$regionPath = Join-Path $PSScriptRoot $regionFile;
$layoutXml = [xml](Get-Content -Path $regionPath);
foreach ($typePattern in $layoutXml.Patterns.TypePattern) {
foreach ($region in $typePattern.Region) {
foreach ($entry in $region.Entry) {
$typePattern.AppendChild($entry);
}
$typePattern.RemoveChild($region);
}
}
$plainPath = Join-Path $PSScriptRoot $plainFile;
$layoutXml.Save($plainPath);