@@ -24,7 +24,7 @@ Function Main {
24
24
25
25
Function Format-Output {
26
26
Write-OutputFile " [//]: <> (AUTO GENERATED FILE; DO NOT EDIT)"
27
- foreach ($style in $discoverdStyles | Sort-Object - Property Control , @ {Expression = {$_.IsDefault }; Ascending = $false }) {
27
+ foreach ($style in $discoverdStyles | Sort-Object - Property File , @ {Expression = {$_.IsDefault }; Ascending = $false }) {
28
28
if ($previousFile -ne $style.File ) {
29
29
Write-OutputFile " `n $headerMarkdown $ ( $style.File ) "
30
30
}
@@ -46,18 +46,17 @@ Function Write-OutputFile{
46
46
}
47
47
48
48
Function Set-Defaults {
49
- $remainingDefaults = New-Object System.Collections.ArrayList
50
49
ForEach ($default in $defaults ) {
51
- $style = $discoverdStyles.Where ({$_.style -match $default.style })
50
+ $style = $discoverdStyles.Where ({$_.style -match $default.style -and $_ .Control -match $default .Type })
52
51
if ($null -ne $style [0 ]) {
53
52
$style [0 ].IsDefault = $true
54
53
}
55
- else {
56
- $remainingDefaults.Add ($default )
54
+ else {
55
+ $temp = Get-Style - targetType $default.Type - styleName $default.Style - fileName $default.Type
56
+ $discoverdStyles.Add ($temp ) | Out-Null
57
57
}
58
58
}
59
59
$discoverdStyles | Format-Table # debug
60
- $remainingDefaults | Format-Table # debug
61
60
}
62
61
63
62
Function Select-ControlNameFromFile {
@@ -68,8 +67,9 @@ Function Select-ControlNameFromFile {
68
67
Function Read-XamlStyles {
69
68
Param ($xamlString , $file )
70
69
[xml ]$xaml = $xamlString
71
- $xaml.selectNodes ( " //* " ) | Where-Object { $_ .LocalName -eq " Style" } |
70
+ $xaml.ResourceDictionary. Style |
72
71
Foreach-Object {
72
+ Write-Output $_
73
73
if ($file -eq " Defaults" ) {
74
74
# Special handeling of Defaults
75
75
New-Default - style $_ - file $file
@@ -121,13 +121,19 @@ Function New-Style {
121
121
}
122
122
123
123
Function Add-Style {
124
+ Param ($targetType , $styleName , $fileName )
125
+ $temp = Get-Style - targetType $targetType - styleName $styleName - fileName $file
126
+ $discoverdStyles.Add ($temp ) | Out-Null
127
+ }
128
+
129
+ Function Get-Style {
124
130
Param ($targetType , $styleName , $fileName )
125
131
$temp = " " | Select-Object " Control" , " Style" , " IsDefault" , " File"
126
132
$temp.Control = $targetType
127
133
$temp.Style = $styleName
128
134
$temp.IsDefault = ! $styleName
129
135
$temp.File = $fileName
130
- $discoverdStyles .Add ( $ temp) | Out-Null
136
+ return $ temp
131
137
}
132
138
133
139
Function Add-DefaultStyle {
0 commit comments