|
2 | 2 | # Licensed under the MIT License. |
3 | 3 | Import-Module powershell-yaml -Force -ErrorAction Stop |
4 | 4 |
|
| 5 | +[Flags()] |
| 6 | +enum UnitySetupComponentType |
| 7 | +{ |
| 8 | + Setup = (1 -shl 0) |
| 9 | + Documentation = (1 -shl 1) |
| 10 | + StandardAssets = (1 -shl 2) |
| 11 | + ExampleProject = (1 -shl 3) |
| 12 | + Metro = (1 -shl 4) |
| 13 | + UWP_IL2CPP = (1 -shl 5) |
| 14 | + Android = (1 -shl 6) |
| 15 | + iOS = (1 -shl 7) |
| 16 | + AppleTV = (1 -shl 8) |
| 17 | + Facebook = (1 -shl 9) |
| 18 | + Linux = (1 -shl 10) |
| 19 | + Mac = (1 -shl 11) |
| 20 | + Vuforia = (1 -shl 12) |
| 21 | + WebGL = (1 -shl 13) |
| 22 | + Windows_IL2CPP = (1 -shl 14) |
| 23 | + All = (-1) |
| 24 | +} |
| 25 | + |
5 | 26 | class UnitySetupInstaller |
6 | 27 | { |
7 | 28 | [UnitySetupComponentType] $ComponentType |
@@ -228,6 +249,7 @@ function Find-UnitySetupInstaller |
228 | 249 | function Install-UnitySetupInstance |
229 | 250 | { |
230 | 251 | [CmdletBinding()] |
| 252 | + [System.Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingWriteHost', '', Scope='Function')] |
231 | 253 | param( |
232 | 254 | [parameter(ValueFromPipeline=$true)] |
233 | 255 | [UnitySetupInstaller[]] $Installers, |
@@ -496,7 +518,7 @@ function Get-UnityProjectInstance |
496 | 518 | #> |
497 | 519 | function Start-UnityEditor |
498 | 520 | { |
499 | | - [CmdletBinding(DefaultParameterSetName="Context")] |
| 521 | + [CmdletBinding(SupportsShouldProcess, DefaultParameterSetName="Context")] |
500 | 522 | param( |
501 | 523 | [parameter(Mandatory=$false, ValueFromPipeline = $true, ParameterSetName='Projects')] |
502 | 524 | [parameter(Mandatory=$true, ValueFromPipeline = $true, ParameterSetName='ProjectsLatest')] |
@@ -665,7 +687,11 @@ function Start-UnityEditor |
665 | 687 | $setProcessArgs['ArgumentList'] = $unityArgs |
666 | 688 | } |
667 | 689 |
|
668 | | - Write-Verbose "Starting $editor $unityArgs" |
| 690 | + if(-not $PSCmdlet.ShouldProcess("$editor $unityArgs", "Start-Process")) |
| 691 | + { |
| 692 | + continue |
| 693 | + } |
| 694 | + |
669 | 695 | $process = Start-Process @setProcessArgs |
670 | 696 | if( $Wait ) |
671 | 697 | { |
|
0 commit comments