forked from ChrisTitusTech/winutil
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
197 additions
and
222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,31 @@ | ||
function Get-WPFObjectName { | ||
<# | ||
.SYNOPSIS | ||
This is a helper function that generates an objectname with the prefix WPF that can be used as a Powershell Variable after compilation. | ||
To achieve this, all characters that are not a-z, A-Z or 0-9 are simply removed from the name. | ||
.PARAMETER type | ||
The type of object for which the name should be generated. (e.g. Label, Button, CheckBox...) | ||
.PARAMETER name | ||
The name or description to be used for the object. (invalid characters are removed) | ||
.OUTPUTS | ||
A string that can be used as a object/variable name in powershell. | ||
For example: WPFLabelMicrosoftTools | ||
<# | ||
.SYNOPSIS | ||
This is a helper function that generates an objectname with the prefix WPF that can be used as a Powershell Variable after compilation. | ||
To achieve this, all characters that are not a-z, A-Z or 0-9 are simply removed from the name. | ||
.EXAMPLE | ||
Get-WPFObjectName -type Label -name "Microsoft Tools" | ||
#> | ||
.PARAMETER type | ||
The type of object for which the name should be generated. (e.g. Label, Button, CheckBox...) | ||
.PARAMETER name | ||
The name or description to be used for the object. (invalid characters are removed) | ||
param( [Parameter(Mandatory=$true)] | ||
$type, | ||
$name | ||
) | ||
.OUTPUTS | ||
A string that can be used as a object/variable name in powershell. | ||
For example: WPFLabelMicrosoftTools | ||
.EXAMPLE | ||
Get-WPFObjectName -type Label -name "Microsoft Tools" | ||
#> | ||
|
||
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', '' | ||
param( | ||
[Parameter(Mandatory, position=0)] | ||
[string]$type, | ||
|
||
return $Output | ||
[Parameter(position=1)] | ||
[string]$name | ||
) | ||
|
||
} | ||
$Output = $("WPF"+$type+$name) -replace '[^a-zA-Z0-9]', '' | ||
return $Output | ||
} |
Oops, something went wrong.