@@ -73,14 +73,14 @@ class UnitySetupInstance {
73
73
$this.Components = [UnitySetupComponent ]::Windows
74
74
$playbackEnginePath = [io.path ]::Combine(" $Path " , " Editor\Data\PlaybackEngines" );
75
75
@ {
76
- [UnitySetupComponent ]::Documentation = , [io.path ]::Combine(" $Path " , " Editor\Data\Documentation" );
76
+ [UnitySetupComponent ]::Documentation = , [io.path ]::Combine(" $Path " , " Editor\Data\Documentation" );
77
77
[UnitySetupComponent ]::StandardAssets = , [io.path ]::Combine(" $Path " , " Editor\Standard Assets" );
78
78
[UnitySetupComponent ]::Windows_IL2CPP = , [io.path ]::Combine(" $playbackEnginePath " , " windowsstandalonesupport\Variations\win32_development_il2cpp" );
79
- [UnitySetupComponent ]::UWP = [io.path ]::Combine(" $playbackEnginePath " , " MetroSupport\Templates\UWP_.NET_D3D" ),
79
+ [UnitySetupComponent ]::UWP = [io.path ]::Combine(" $playbackEnginePath " , " MetroSupport\Templates\UWP_.NET_D3D" ),
80
80
[io.path ]::Combine(" $playbackEnginePath " , " MetroSupport\Templates\UWP_D3D" );
81
- [UnitySetupComponent ]::UWP_IL2CPP = , [io.path ]::Combine(" $playbackEnginePath " , " MetroSupport\Templates\UWP_IL2CPP_D3D" );
82
- [UnitySetupComponent ]::Linux = , [io.path ]::Combine(" $playbackEnginePath " , " LinuxStandaloneSupport" );
83
- [UnitySetupComponent ]::Mac = , [io.path ]::Combine(" $playbackEnginePath " , " MacStandaloneSupport" );
81
+ [UnitySetupComponent ]::UWP_IL2CPP = , [io.path ]::Combine(" $playbackEnginePath " , " MetroSupport\Templates\UWP_IL2CPP_D3D" );
82
+ [UnitySetupComponent ]::Linux = , [io.path ]::Combine(" $playbackEnginePath " , " LinuxStandaloneSupport" );
83
+ [UnitySetupComponent ]::Mac = , [io.path ]::Combine(" $playbackEnginePath " , " MacStandaloneSupport" );
84
84
}
85
85
}
86
86
([OperatingSystem ]::Linux) {
@@ -92,10 +92,10 @@ class UnitySetupInstance {
92
92
$this.Components = [UnitySetupComponent ]::Mac
93
93
$playbackEnginePath = [io.path ]::Combine(" $Path " , " PlaybackEngines" );
94
94
@ {
95
- [UnitySetupComponent ]::Documentation = , [io.path ]::Combine(" $Path " , " Documentation" );
95
+ [UnitySetupComponent ]::Documentation = , [io.path ]::Combine(" $Path " , " Documentation" );
96
96
[UnitySetupComponent ]::StandardAssets = , [io.path ]::Combine(" $Path " , " Standard Assets" );
97
- [UnitySetupComponent ]::Windows = , [io.path ]::Combine(" $playbackEnginePath " , " WindowsStandaloneSupport" );
98
- [UnitySetupComponent ]::Linux = , [io.path ]::Combine(" $playbackEnginePath " , " LinuxStandaloneSupport" );
97
+ [UnitySetupComponent ]::Windows = , [io.path ]::Combine(" $playbackEnginePath " , " WindowsStandaloneSupport" );
98
+ [UnitySetupComponent ]::Linux = , [io.path ]::Combine(" $playbackEnginePath " , " LinuxStandaloneSupport" );
99
99
}
100
100
}
101
101
}
@@ -301,18 +301,18 @@ function Find-UnitySetupInstaller {
301
301
)
302
302
303
303
$installerTemplates = @ {
304
- [UnitySetupComponent ]::UWP = " $targetSupport /UnitySetup-UWP-.NET-Support-for-Editor-$Version .$installerExtension " ,
305
- " $targetSupport /UnitySetup-Metro-Support-for-Editor-$Version .$installerExtension " ;
306
- [UnitySetupComponent ]::UWP_IL2CPP = , " $targetSupport /UnitySetup-UWP-IL2CPP-Support-for-Editor-$Version .$installerExtension " ;
307
- [UnitySetupComponent ]::Android = , " $targetSupport /UnitySetup-Android-Support-for-Editor-$Version .$installerExtension " ;
308
- [UnitySetupComponent ]::iOS = , " $targetSupport /UnitySetup-iOS-Support-for-Editor-$Version .$installerExtension " ;
309
- [UnitySetupComponent ]::AppleTV = , " $targetSupport /UnitySetup-AppleTV-Support-for-Editor-$Version .$installerExtension " ;
310
- [UnitySetupComponent ]::Facebook = , " $targetSupport /UnitySetup-Facebook-Games-Support-for-Editor-$Version .$installerExtension " ;
311
- [UnitySetupComponent ]::Linux = , " $targetSupport /UnitySetup-Linux-Support-for-Editor-$Version .$installerExtension " ;
312
- [UnitySetupComponent ]::Mac = " $targetSupport /UnitySetup-Mac-Support-for-Editor-$Version .$installerExtension " ,
304
+ [UnitySetupComponent ]::UWP = " $targetSupport /UnitySetup-UWP-.NET-Support-for-Editor-$Version .$installerExtension " ,
305
+ " $targetSupport /UnitySetup-Metro-Support-for-Editor-$Version .$installerExtension " ;
306
+ [UnitySetupComponent ]::UWP_IL2CPP = , " $targetSupport /UnitySetup-UWP-IL2CPP-Support-for-Editor-$Version .$installerExtension " ;
307
+ [UnitySetupComponent ]::Android = , " $targetSupport /UnitySetup-Android-Support-for-Editor-$Version .$installerExtension " ;
308
+ [UnitySetupComponent ]::iOS = , " $targetSupport /UnitySetup-iOS-Support-for-Editor-$Version .$installerExtension " ;
309
+ [UnitySetupComponent ]::AppleTV = , " $targetSupport /UnitySetup-AppleTV-Support-for-Editor-$Version .$installerExtension " ;
310
+ [UnitySetupComponent ]::Facebook = , " $targetSupport /UnitySetup-Facebook-Games-Support-for-Editor-$Version .$installerExtension " ;
311
+ [UnitySetupComponent ]::Linux = , " $targetSupport /UnitySetup-Linux-Support-for-Editor-$Version .$installerExtension " ;
312
+ [UnitySetupComponent ]::Mac = " $targetSupport /UnitySetup-Mac-Support-for-Editor-$Version .$installerExtension " ,
313
313
" $targetSupport /UnitySetup-Mac-Mono-Support-for-Editor-$Version .$installerExtension " ;
314
- [UnitySetupComponent ]::Vuforia = , " $targetSupport /UnitySetup-Vuforia-AR-Support-for-Editor-$Version .$installerExtension " ;
315
- [UnitySetupComponent ]::WebGL = , " $targetSupport /UnitySetup-WebGL-Support-for-Editor-$Version .$installerExtension " ;
314
+ [UnitySetupComponent ]::Vuforia = , " $targetSupport /UnitySetup-Vuforia-AR-Support-for-Editor-$Version .$installerExtension " ;
315
+ [UnitySetupComponent ]::WebGL = , " $targetSupport /UnitySetup-WebGL-Support-for-Editor-$Version .$installerExtension " ;
316
316
[UnitySetupComponent ]::Windows_IL2CPP = , " $targetSupport /UnitySetup-Windows-IL2CPP-Support-for-Editor-$Version .$installerExtension " ;
317
317
}
318
318
@@ -426,10 +426,10 @@ function Find-UnitySetupInstaller {
426
426
}
427
427
$result = New-Object UnitySetupInstaller - Property @ {
428
428
' ComponentType' = $_ ;
429
- ' Version' = $Version ;
430
- ' DownloadUrl' = $endpoint ;
431
- ' Length' = $installerLength ;
432
- ' LastModified' = $lastModified ;
429
+ ' Version' = $Version ;
430
+ ' DownloadUrl' = $endpoint ;
431
+ ' Length' = $installerLength ;
432
+ ' LastModified' = $lastModified ;
433
433
}
434
434
435
435
break
@@ -532,13 +532,13 @@ function Select-UnitySetupInstaller {
532
532
}
533
533
534
534
filter Format-Bytes {
535
- return " {0:N2} {1}" -f $ (
536
- if ($_ -lt 1 kb ) { $_ , ' Bytes' }
537
- elseif ($_ -lt 1 mb ) { ($_ / 1 kb ), ' KB' }
538
- elseif ($_ -lt 1 gb ) { ($_ / 1 mb ), ' MB' }
539
- elseif ($_ -lt 1 tb ) { ($_ / 1 gb ), ' GB' }
540
- elseif ($_ -lt 1 pb ) { ($_ / 1 tb ), ' TB' }
541
- else { ($_ / 1 pb ), ' PB' }
535
+ return " {0:N2} {1}" -f $ (
536
+ if ($_ -lt 1 kb ) { $_ , ' Bytes' }
537
+ elseif ($_ -lt 1 mb ) { ($_ / 1 kb ), ' KB' }
538
+ elseif ($_ -lt 1 gb ) { ($_ / 1 mb ), ' MB' }
539
+ elseif ($_ -lt 1 tb ) { ($_ / 1 gb ), ' GB' }
540
+ elseif ($_ -lt 1 pb ) { ($_ / 1 tb ), ' TB' }
541
+ else { ($_ / 1 pb ), ' PB' }
542
542
)
543
543
}
544
544
@@ -556,13 +556,13 @@ function Format-BitsPerSecond {
556
556
}
557
557
# Convert from bytes to bits
558
558
$Bits = ($Bytes * 8 ) / $Seconds
559
- return " {0:N2} {1}" -f $ (
560
- if ($Bits -lt 1 kb ) { $Bits , ' Bps' }
561
- elseif ($Bits -lt 1 mb ) { ($Bits / 1 kb ), ' Kbps' }
562
- elseif ($Bits -lt 1 gb ) { ($Bits / 1 mb ), ' Mbps' }
563
- elseif ($Bits -lt 1 tb ) { ($Bits / 1 gb ), ' Gbps' }
564
- elseif ($Bits -lt 1 pb ) { ($Bits / 1 tb ), ' Tbps' }
565
- else { ($Bits / 1 pb ), ' Pbps' }
559
+ return " {0:N2} {1}" -f $ (
560
+ if ($Bits -lt 1 kb ) { $Bits , ' Bps' }
561
+ elseif ($Bits -lt 1 mb ) { ($Bits / 1 kb ), ' Kbps' }
562
+ elseif ($Bits -lt 1 gb ) { ($Bits / 1 mb ), ' Mbps' }
563
+ elseif ($Bits -lt 1 tb ) { ($Bits / 1 gb ), ' Gbps' }
564
+ elseif ($Bits -lt 1 pb ) { ($Bits / 1 tb ), ' Tbps' }
565
+ else { ($Bits / 1 pb ), ' Pbps' }
566
566
)
567
567
}
568
568
@@ -630,7 +630,7 @@ function Request-UnitySetupInstaller {
630
630
631
631
$resource = New-Object UnitySetupResource - Property @ {
632
632
' ComponentType' = $_.ComponentType
633
- ' Path' = $destination
633
+ ' Path' = $destination
634
634
}
635
635
$downloads += , $resource
636
636
return
@@ -647,15 +647,15 @@ function Request-UnitySetupInstaller {
647
647
++ $downloadIndex
648
648
$global :downloadData [$installerFileName ] = New-Object PSObject - Property @ {
649
649
installerFileName = $installerFileName
650
- startTime = Get-Date
651
- totalBytes = $_.Length
652
- receivedBytes = 0
653
- isDownloaded = $false
654
- destination = $destination
655
- lastModified = $_.LastModified
656
- componentType = $_.ComponentType
657
- webClient = $webClient
658
- downloadIndex = $downloadIndex
650
+ startTime = Get-Date
651
+ totalBytes = $_.Length
652
+ receivedBytes = 0
653
+ isDownloaded = $false
654
+ destination = $destination
655
+ lastModified = $_.LastModified
656
+ componentType = $_.ComponentType
657
+ webClient = $webClient
658
+ downloadIndex = $downloadIndex
659
659
}
660
660
661
661
# Register to events for showing progress of file download.
@@ -666,8 +666,7 @@ function Request-UnitySetupInstaller {
666
666
$global :downloadData [$event.MessageData ].isDownloaded = $true
667
667
} | Out-Null
668
668
669
- try
670
- {
669
+ try {
671
670
Write-Verbose " Downloading $ ( $_.DownloadUrl ) to $destination "
672
671
$webClient.DownloadFileAsync ($_.DownloadUrl , $destination )
673
672
}
@@ -712,7 +711,7 @@ function Request-UnitySetupInstaller {
712
711
713
712
$resource = New-Object UnitySetupResource - Property @ {
714
713
' ComponentType' = $data.componentType
715
- ' Path' = $data.destination
714
+ ' Path' = $data.destination
716
715
}
717
716
$downloads += , $resource
718
717
return
@@ -781,10 +780,10 @@ function Install-UnitySetupPackage {
781
780
switch ($currentOS ) {
782
781
([OperatingSystem ]::Windows) {
783
782
$startProcessArgs = @ {
784
- ' FilePath' = $Package.Path ;
783
+ ' FilePath' = $Package.Path ;
785
784
' ArgumentList' = @ (" /S" , " /D=$Destination " );
786
- ' PassThru' = $true ;
787
- ' Wait' = $true ;
785
+ ' PassThru' = $true ;
786
+ ' Wait' = $true ;
788
787
}
789
788
}
790
789
([OperatingSystem ]::Linux) {
@@ -794,10 +793,10 @@ function Install-UnitySetupPackage {
794
793
# Note that $Destination has to be a disk path.
795
794
# sudo installer -package $Package.Path -target /
796
795
$startProcessArgs = @ {
797
- ' FilePath' = ' sudo' ;
796
+ ' FilePath' = ' sudo' ;
798
797
' ArgumentList' = @ (" installer" , " -package" , $Package.Path , " -target" , $Destination );
799
- ' PassThru' = $true ;
800
- ' Wait' = $true ;
798
+ ' PassThru' = $true ;
799
+ ' Wait' = $true ;
801
800
}
802
801
}
803
802
}
@@ -977,8 +976,7 @@ function Install-UnitySetupInstance {
977
976
# Move the install from the sparse bundle disk to the install directory.
978
977
if ($currentOS -eq [OperatingSystem ]::Mac) {
979
978
# rsync does not recursively create the directory path.
980
- if (-not (Test-Path $installPath - PathType Container))
981
- {
979
+ if (-not (Test-Path $installPath - PathType Container)) {
982
980
Write-Verbose " Creating directory $installPath ."
983
981
New-Item $installPath - ItemType Directory - ErrorAction Stop | Out-Null
984
982
}
@@ -1031,10 +1029,10 @@ function Uninstall-UnitySetupInstance {
1031
1029
}
1032
1030
1033
1031
$startProcessArgs = @ {
1034
- ' FilePath' = $uninstaller ;
1035
- ' PassThru' = $true ;
1036
- ' Wait' = $true ;
1037
- ' ErrorAction' = ' Stop' ;
1032
+ ' FilePath' = $uninstaller ;
1033
+ ' PassThru' = $true ;
1034
+ ' Wait' = $true ;
1035
+ ' ErrorAction' = ' Stop' ;
1038
1036
' ArgumentList' = @ (" /S" );
1039
1037
}
1040
1038
@@ -1178,10 +1176,10 @@ function Get-UnityProjectInstance {
1178
1176
)
1179
1177
1180
1178
$args = @ {
1181
- ' Path' = $BasePath ;
1182
- ' Filter' = ' ProjectSettings' ;
1179
+ ' Path' = $BasePath ;
1180
+ ' Filter' = ' ProjectSettings' ;
1183
1181
' ErrorAction' = ' Ignore' ;
1184
- ' Directory' = $true ;
1182
+ ' Directory' = $true ;
1185
1183
}
1186
1184
1187
1185
if ( $Recurse ) {
@@ -1582,7 +1580,7 @@ function Get-IsUnityError {
1582
1580
function ConvertTo-DateTime {
1583
1581
param ([string ] $Text )
1584
1582
1585
- if ( -not $text -or $text.Length -eq 0 ) { [DateTime ]::MaxValue }
1583
+ if ( -not $text -or $text.Length -eq 0 ) { [DateTime ]::MaxValue }
1586
1584
else { [DateTime ]$Text }
1587
1585
}
1588
1586
@@ -1594,10 +1592,9 @@ function ConvertTo-DateTime {
1594
1592
. EXAMPLE
1595
1593
Get-UnityLicense
1596
1594
#>
1597
- function Get-UnityLicense
1598
- {
1595
+ function Get-UnityLicense {
1599
1596
[CmdletBinding ()]
1600
- [Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSAvoidUsingConvertToSecureStringWithPlainText" , " " , Justification= " Used to convert discovered plaintext serials into secure strings." )]
1597
+ [Diagnostics.CodeAnalysis.SuppressMessageAttribute (" PSAvoidUsingConvertToSecureStringWithPlainText" , " " , Justification = " Used to convert discovered plaintext serials into secure strings." )]
1601
1598
param ([SecureString ]$Serial )
1602
1599
1603
1600
$licenseFiles = Get-ChildItem " C:\ProgramData\Unity\Unity_*.ulf" - ErrorAction ' SilentlyContinue'
@@ -1608,18 +1605,18 @@ function Get-UnityLicense
1608
1605
1609
1606
# The first four bytes look like a count so skip that to pull out the serial string
1610
1607
$licenseSerial = [String ]::new($devBytes [4 .. ($devBytes.Length - 1 )])
1611
- if ( $Serial -and [System.Net.NetworkCredential ]::new($null , $Serial ).Password -ne $licenseSerial ) { continue ; }
1608
+ if ( $Serial -and [System.Net.NetworkCredential ]::new($null , $Serial ).Password -ne $licenseSerial ) { continue ; }
1612
1609
1613
1610
$license = $doc.root.License
1614
1611
[PSCustomObject ]@ {
1615
1612
' LicenseVersion' = $license.LicenseVersion.Value
1616
- ' Serial' = ConvertTo-SecureString $licenseSerial - AsPlainText - Force
1617
- ' UnityVersion' = [UnityVersion ]$license.ClientProvidedVersion.Value
1618
- ' DisplaySerial' = $license.SerialMasked.Value
1613
+ ' Serial' = ConvertTo-SecureString $licenseSerial - AsPlainText - Force
1614
+ ' UnityVersion' = [UnityVersion ]$license.ClientProvidedVersion.Value
1615
+ ' DisplaySerial' = $license.SerialMasked.Value
1619
1616
' ActivationDate' = ConvertTo-DateTime $license.InitialActivationDate.Value
1620
- ' StartDate' = ConvertTo-DateTime $license.StartDate.Value
1621
- ' StopDate' = ConvertTo-DateTime $license.StopDate.Value
1622
- ' UpdateDate' = ConvertTo-DateTime $license.UpdateDate.Value
1617
+ ' StartDate' = ConvertTo-DateTime $license.StartDate.Value
1618
+ ' StopDate' = ConvertTo-DateTime $license.StopDate.Value
1619
+ ' UpdateDate' = ConvertTo-DateTime $license.UpdateDate.Value
1623
1620
}
1624
1621
}
1625
1622
}
0 commit comments