Skip to content

Commit

Permalink
Merge pull request #165 from murrahjm/patch-1
Browse files Browse the repository at this point in the history
two minor bugfixes
adamdriscoll authored Nov 28, 2017
2 parents 4887c37 + 626149e commit 7c2ec01
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions utilities/ConvertTo-PoshTools.ps1
Original file line number Diff line number Diff line change
@@ -97,7 +97,13 @@ function Out-ObjectProperty {
$value = "New-Object -TypeName '$($PropertyType.FullName)' -ArgumentList @('$($parts[0])', $($parts[1].Trim('pt')))"
}
elseif ($propertyType.FullName -eq "System.Drawing.Color") {
$value = "[System.Drawing.Color]::FromArgb($($property.InnerText))"
If ([System.Drawing.SystemColors]::$($Property.InnerText)){
$value = "[System.Drawing.SystemColors]::$($property.InnerText)"
} elseif ([System.Drawing.Color]::$($Property.InnerText)){
$value = "[System.Drawing.Color]::$($property.InnerText)"
} else {
$value = "[System.Drawing.Color]::FromArgb($($Property.InnerText))"
}
}
elseif ($propertyType.IsEnum) {
$value = ($property.innerText -split ',' | ForEach-Object { "[$($propertyType.FullName)]::$($_.Trim())" }) -join ' -bor '
@@ -207,11 +213,11 @@ $Script | Out-File -FilePath (Join-Path $OutputPath ($fi.Name + ".ps1" ))

Write-Host "Conversion complete: `r`n You need to update your PSSProj by adding the following to the contents via a text editor:"
Write-Host "<ItemGroup>
<Compile Include=`"$($fi.Name).designer.ps1')`">
<Compile Include=`"$($fi.Name).designer.ps1`">
<SubType>Code</SubType>
<DependentUpon>$($fi.Name + ".ps1")</DependentUpon>
</Compile>
<Compile Include=`"$($fi.Name + ".ps1")`">
<SubType>Form</SubType>
</Compile>
</ItemGroup>"
</ItemGroup>"

0 comments on commit 7c2ec01

Please sign in to comment.