3
3
Import-Module powershell- yaml - Force - ErrorAction Stop
4
4
5
5
[Flags ()]
6
- enum UnitySetupComponentType
6
+ enum UnitySetupComponent
7
7
{
8
8
Setup = (1 -shl 0 )
9
9
Documentation = (1 -shl 1 )
@@ -24,7 +24,7 @@ enum UnitySetupComponentType
24
24
25
25
class UnitySetupInstaller
26
26
{
27
- [UnitySetupComponentType ] $ComponentType
27
+ [UnitySetupComponent ] $ComponentType
28
28
[UnityVersion ] $Version
29
29
[int64 ]$Length
30
30
[DateTime ]$LastModified
@@ -34,7 +34,7 @@ class UnitySetupInstaller
34
34
class UnitySetupInstance
35
35
{
36
36
[UnityVersion ]$Version
37
- [UnitySetupComponentType ]$Components
37
+ [UnitySetupComponent ]$Components
38
38
[string ]$Path
39
39
40
40
UnitySetupInstance([string ]$path ) {
@@ -49,23 +49,23 @@ class UnitySetupInstance
49
49
50
50
$this.Path = $path
51
51
$this.Version = $xmlDoc .' ivy-module' .info.unityVersion
52
- $this.Components = [UnitySetupComponentType ]::Setup
52
+ $this.Components = [UnitySetupComponent ]::Setup
53
53
54
54
$componentTests = @ {
55
- [UnitySetupComponentType ]::Documentation = , " $Path \Editor\Data\Documentation" ;
56
- [UnitySetupComponentType ]::StandardAssets = , " $Path \Editor\Standard Assets" ;
57
- [UnitySetupComponentType ]::Windows_IL2CPP = , " $Path \Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\win32_development_il2cpp" ;
58
- [UnitySetupComponentType ]::Metro = " $Path \Editor\Data\PlaybackEngines\MetroSupport\Templates\UWP_.NET_D3D" ,
55
+ [UnitySetupComponent ]::Documentation = , " $Path \Editor\Data\Documentation" ;
56
+ [UnitySetupComponent ]::StandardAssets = , " $Path \Editor\Standard Assets" ;
57
+ [UnitySetupComponent ]::Windows_IL2CPP = , " $Path \Editor\Data\PlaybackEngines\windowsstandalonesupport\Variations\win32_development_il2cpp" ;
58
+ [UnitySetupComponent ]::Metro = " $Path \Editor\Data\PlaybackEngines\MetroSupport\Templates\UWP_.NET_D3D" ,
59
59
" $Path \Editor\Data\PlaybackEngines\MetroSupport\Templates\UWP_D3D" ;
60
- [UnitySetupComponentType ]::UWP_IL2CPP = , " $Path \Editor\Data\PlaybackEngines\MetroSupport\Templates\UWP_IL2CPP_D3D" ;
61
- [UnitySetupComponentType ]::Android = , " $Path \Editor\Data\PlaybackEngines\AndroidPlayer" ;
62
- [UnitySetupComponentType ]::iOS = , " $Path \Editor\Data\PlaybackEngines\iOSSupport" ;
63
- [UnitySetupComponentType ]::AppleTV = , " $Path \Editor\Data\PlaybackEngines\AppleTVSupport" ;
64
- [UnitySetupComponentType ]::Facebook = , " $Path \Editor\Data\PlaybackEngines\Facebook" ;
65
- [UnitySetupComponentType ]::Linux = , " $Path \Editor\Data\PlaybackEngines\LinuxStandaloneSupport" ;
66
- [UnitySetupComponentType ]::Mac = , " $Path \Editor\Data\PlaybackEngines\MacStandaloneSupport" ;
67
- [UnitySetupComponentType ]::Vuforia = , " $Path \Editor\Data\PlaybackEngines\VuforiaSupport" ;
68
- [UnitySetupComponentType ]::WebGL = , " $Path \Editor\Data\PlaybackEngines\WebGLSupport" ;
60
+ [UnitySetupComponent ]::UWP_IL2CPP = , " $Path \Editor\Data\PlaybackEngines\MetroSupport\Templates\UWP_IL2CPP_D3D" ;
61
+ [UnitySetupComponent ]::Android = , " $Path \Editor\Data\PlaybackEngines\AndroidPlayer" ;
62
+ [UnitySetupComponent ]::iOS = , " $Path \Editor\Data\PlaybackEngines\iOSSupport" ;
63
+ [UnitySetupComponent ]::AppleTV = , " $Path \Editor\Data\PlaybackEngines\AppleTVSupport" ;
64
+ [UnitySetupComponent ]::Facebook = , " $Path \Editor\Data\PlaybackEngines\Facebook" ;
65
+ [UnitySetupComponent ]::Linux = , " $Path \Editor\Data\PlaybackEngines\LinuxStandaloneSupport" ;
66
+ [UnitySetupComponent ]::Mac = , " $Path \Editor\Data\PlaybackEngines\MacStandaloneSupport" ;
67
+ [UnitySetupComponent ]::Vuforia = , " $Path \Editor\Data\PlaybackEngines\VuforiaSupport" ;
68
+ [UnitySetupComponent ]::WebGL = , " $Path \Editor\Data\PlaybackEngines\WebGLSupport" ;
69
69
}
70
70
71
71
$componentTests.Keys | ForEach-Object {
@@ -159,6 +159,25 @@ class UnityVersion : System.IComparable
159
159
}
160
160
}
161
161
162
+ <#
163
+ . Synopsis
164
+ Help to create UnitySetupComponent
165
+ . PARAMETER Components
166
+ What components would you like included?
167
+ . EXAMPLE
168
+ New-UnitySetupComponent -Components Setup,Metro
169
+ #>
170
+ function New-UnitySetupComponent
171
+ {
172
+ [CmdletBinding ()]
173
+ param (
174
+ [parameter (Mandatory = $true )]
175
+ [UnitySetupComponent ] $Components
176
+ )
177
+
178
+ $Components
179
+ }
180
+
162
181
<#
163
182
. Synopsis
164
183
Finds UnitySetup installers for a specified version.
@@ -181,7 +200,7 @@ function Find-UnitySetupInstaller
181
200
[UnityVersion ] $Version ,
182
201
183
202
[parameter (Mandatory = $false )]
184
- [UnitySetupComponentType ] $Components = [UnitySetupComponentType ]::All
203
+ [UnitySetupComponent ] $Components = [UnitySetupComponent ]::All
185
204
)
186
205
187
206
$unitySetupRegEx = " ^(.+)\/([a-z0-9]+)\/Windows64EditorInstaller\/UnitySetup64-(\d+)\.(\d+)\.(\d+)([fpb])(\d+).exe$"
@@ -192,21 +211,21 @@ function Find-UnitySetupInstaller
192
211
)
193
212
194
213
$installerTemplates = @ {
195
- [UnitySetupComponentType ]::Setup = , " Windows64EditorInstaller/UnitySetup64-$Version .exe" ;
196
- [UnitySetupComponentType ]::Documentation = , " WindowsDocumentationInstaller/UnityDocumentationSetup-$Version .exe" ;
197
- [UnitySetupComponentType ]::StandardAssets = , " WindowsStandardAssetsInstaller/UnityStandardAssetsSetup-$Version .exe" ;
198
- [UnitySetupComponentType ]::Metro = , " TargetSupportInstaller/UnitySetup-Metro-Support-for-Editor-$Version .exe" ;
199
- [UnitySetupComponentType ]::UWP_IL2CPP = , " TargetSupportInstaller/UnitySetup-UWP-IL2CPP-Support-for-Editor-$Version .exe" ;
200
- [UnitySetupComponentType ]::Android = , " TargetSupportInstaller/UnitySetup-Android-Support-for-Editor-$Version .exe" ;
201
- [UnitySetupComponentType ]::iOS = , " TargetSupportInstaller/UnitySetup-iOS-Support-for-Editor-$Version .exe" ;
202
- [UnitySetupComponentType ]::AppleTV = , " TargetSupportInstaller/UnitySetup-AppleTV-Support-for-Editor-$Version .exe" ;
203
- [UnitySetupComponentType ]::Facebook = , " TargetSupportInstaller/UnitySetup-Facebook-Games-Support-for-Editor-$Version .exe" ;
204
- [UnitySetupComponentType ]::Linux = , " TargetSupportInstaller/UnitySetup-Linux-Support-for-Editor-$Version .exe" ;
205
- [UnitySetupComponentType ]::Mac = " TargetSupportInstaller/UnitySetup-Mac-Support-for-Editor-$Version .exe" ,
214
+ [UnitySetupComponent ]::Setup = , " Windows64EditorInstaller/UnitySetup64-$Version .exe" ;
215
+ [UnitySetupComponent ]::Documentation = , " WindowsDocumentationInstaller/UnityDocumentationSetup-$Version .exe" ;
216
+ [UnitySetupComponent ]::StandardAssets = , " WindowsStandardAssetsInstaller/UnityStandardAssetsSetup-$Version .exe" ;
217
+ [UnitySetupComponent ]::Metro = , " TargetSupportInstaller/UnitySetup-Metro-Support-for-Editor-$Version .exe" ;
218
+ [UnitySetupComponent ]::UWP_IL2CPP = , " TargetSupportInstaller/UnitySetup-UWP-IL2CPP-Support-for-Editor-$Version .exe" ;
219
+ [UnitySetupComponent ]::Android = , " TargetSupportInstaller/UnitySetup-Android-Support-for-Editor-$Version .exe" ;
220
+ [UnitySetupComponent ]::iOS = , " TargetSupportInstaller/UnitySetup-iOS-Support-for-Editor-$Version .exe" ;
221
+ [UnitySetupComponent ]::AppleTV = , " TargetSupportInstaller/UnitySetup-AppleTV-Support-for-Editor-$Version .exe" ;
222
+ [UnitySetupComponent ]::Facebook = , " TargetSupportInstaller/UnitySetup-Facebook-Games-Support-for-Editor-$Version .exe" ;
223
+ [UnitySetupComponent ]::Linux = , " TargetSupportInstaller/UnitySetup-Linux-Support-for-Editor-$Version .exe" ;
224
+ [UnitySetupComponent ]::Mac = " TargetSupportInstaller/UnitySetup-Mac-Support-for-Editor-$Version .exe" ,
206
225
" TargetSupportInstaller/UnitySetup-Mac-Mono-Support-for-Editor-$Version .exe" ;
207
- [UnitySetupComponentType ]::Vuforia = , " TargetSupportInstaller/UnitySetup-Vuforia-AR-Support-for-Editor-$Version .exe" ;
208
- [UnitySetupComponentType ]::WebGL = , " TargetSupportInstaller/UnitySetup-WebGL-Support-for-Editor-$Version .exe" ;
209
- [UnitySetupComponentType ]::Windows_IL2CPP = , " TargetSupportInstaller/UnitySetup-Windows-IL2CPP-Support-for-Editor-$Version .exe" ;
226
+ [UnitySetupComponent ]::Vuforia = , " TargetSupportInstaller/UnitySetup-Vuforia-AR-Support-for-Editor-$Version .exe" ;
227
+ [UnitySetupComponent ]::WebGL = , " TargetSupportInstaller/UnitySetup-WebGL-Support-for-Editor-$Version .exe" ;
228
+ [UnitySetupComponent ]::Windows_IL2CPP = , " TargetSupportInstaller/UnitySetup-Windows-IL2CPP-Support-for-Editor-$Version .exe" ;
210
229
}
211
230
212
231
# By default Tls12 protocol is not enabled, but is what backs Unity's website, so enable it
@@ -240,7 +259,7 @@ function Find-UnitySetupInstaller
240
259
{
241
260
$webResult = Invoke-WebRequest $page - UseBasicParsing
242
261
$prototypeLink = $webResult.Links | Select-Object - ExpandProperty href - ErrorAction SilentlyContinue | Where-Object {
243
- $_ -match " $ ( $installerTemplates [[UnitySetupComponentType ]::Setup ]) $"
262
+ $_ -match " $ ( $installerTemplates [[UnitySetupComponent ]::Setup ]) $"
244
263
}
245
264
246
265
if ($null -ne $prototypeLink ) { break }
0 commit comments