Skip to content

Just some whitespace changes #169

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Apr 19, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
64 changes: 32 additions & 32 deletions UnitySetup/UnitySetup.psm1
Original file line number Diff line number Diff line change
Expand Up @@ -77,8 +77,8 @@ class UnitySetupInstance {
[UnitySetupComponent]::Documentation = , [io.path]::Combine("$Path", "Editor\Data\Documentation");
[UnitySetupComponent]::StandardAssets = , [io.path]::Combine("$Path", "Editor\Standard Assets");
[UnitySetupComponent]::Windows_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "windowsstandalonesupport\Variations\win32_development_il2cpp");
[UnitySetupComponent]::UWP = [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_.NET_D3D"),
[io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_D3D");
[UnitySetupComponent]::UWP = [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_.NET_D3D"),
[io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_D3D");
[UnitySetupComponent]::UWP_IL2CPP = , [io.path]::Combine("$playbackEnginePath", "MetroSupport\Templates\UWP_IL2CPP_D3D");
[UnitySetupComponent]::Linux = , [io.path]::Combine("$playbackEnginePath", "LinuxStandaloneSupport");
[UnitySetupComponent]::Mac = , [io.path]::Combine("$playbackEnginePath", "MacStandaloneSupport");
Expand All @@ -103,12 +103,12 @@ class UnitySetupInstance {
}

# Common playback engines:
$componentTests[[UnitySetupComponent]::Android] = , [io.path]::Combine("$playbackEnginePath", "AndroidPlayer");
$componentTests[[UnitySetupComponent]::iOS] = , [io.path]::Combine("$playbackEnginePath", "iOSSupport");
$componentTests[[UnitySetupComponent]::AppleTV] = , [io.path]::Combine("$playbackEnginePath", "AppleTVSupport");
$componentTests[[UnitySetupComponent]::Android] = , [io.path]::Combine("$playbackEnginePath", "AndroidPlayer");
$componentTests[[UnitySetupComponent]::iOS] = , [io.path]::Combine("$playbackEnginePath", "iOSSupport");
$componentTests[[UnitySetupComponent]::AppleTV] = , [io.path]::Combine("$playbackEnginePath", "AppleTVSupport");
$componentTests[[UnitySetupComponent]::Facebook] = , [io.path]::Combine("$playbackEnginePath", "Facebook");
$componentTests[[UnitySetupComponent]::Vuforia] = , [io.path]::Combine("$playbackEnginePath", "VuforiaSupport");
$componentTests[[UnitySetupComponent]::WebGL] = , [io.path]::Combine("$playbackEnginePath", "WebGLSupport");
$componentTests[[UnitySetupComponent]::Vuforia] = , [io.path]::Combine("$playbackEnginePath", "VuforiaSupport");
$componentTests[[UnitySetupComponent]::WebGL] = , [io.path]::Combine("$playbackEnginePath", "WebGLSupport");

$componentTests.Keys | ForEach-Object {
foreach ( $test in $componentTests[$_] ) {
Expand Down Expand Up @@ -311,16 +311,16 @@ function Find-UnitySetupInstaller {
)

$installerTemplates = @{
[UnitySetupComponent]::UWP = "$targetSupport/UnitySetup-UWP-.NET-Support-for-Editor-$Version.$installerExtension",
"$targetSupport/UnitySetup-Metro-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::UWP = "$targetSupport/UnitySetup-UWP-.NET-Support-for-Editor-$Version.$installerExtension",
"$targetSupport/UnitySetup-Metro-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::UWP_IL2CPP = , "$targetSupport/UnitySetup-UWP-IL2CPP-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Android = , "$targetSupport/UnitySetup-Android-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::iOS = , "$targetSupport/UnitySetup-iOS-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::AppleTV = , "$targetSupport/UnitySetup-AppleTV-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Facebook = , "$targetSupport/UnitySetup-Facebook-Games-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Linux = , "$targetSupport/UnitySetup-Linux-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Mac = "$targetSupport/UnitySetup-Mac-Support-for-Editor-$Version.$installerExtension",
"$targetSupport/UnitySetup-Mac-Mono-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Mac = "$targetSupport/UnitySetup-Mac-Support-for-Editor-$Version.$installerExtension",
"$targetSupport/UnitySetup-Mac-Mono-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Mac_IL2CPP = , "$targetSupport/UnitySetup-Mac-IL2CPP-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::Vuforia = , "$targetSupport/UnitySetup-Vuforia-AR-Support-for-Editor-$Version.$installerExtension";
[UnitySetupComponent]::WebGL = , "$targetSupport/UnitySetup-WebGL-Support-for-Editor-$Version.$installerExtension";
Expand Down Expand Up @@ -368,8 +368,8 @@ function Find-UnitySetupInstaller {
$patchPage = "https://unity3d.com/unity/qa/patch-releases?version=$($Version.Major).$($Version.Minor)"
$searchPages += $patchPage

$webResult = Invoke-WebRequest $patchPage -UseBasicParsing
$searchPages += $webResult.Links | Where-Object {
$webResult = Invoke-WebRequest $patchPage -UseBasicParsing
$searchPages += $webResult.Links | Where-Object {
$_.href -match "\/unity\/qa\/patch-releases\?version=$($Version.Major)\.$($Version.Minor)&page=(\d+)" -and $Matches[1] -gt 1
} | ForEach-Object { "https://unity3d.com$($_.href)" }
}
Expand Down Expand Up @@ -712,14 +712,14 @@ function Request-UnitySetupInstaller {

Unregister-Event -SourceIdentifier "$installerFileName-Completed" -Force
Unregister-Event -SourceIdentifier "$installerFileName-Changed" -Force

$data.webClient.Dispose()
$data.webClient = $null

# Re-writes the last modified time for ensuring downloads are cached properly.
$downloadedFile = Get-Item $data.destination
$downloadedFile.LastWriteTime = $data.lastModified

$resource = New-Object UnitySetupResource -Property @{
'ComponentType' = $data.componentType
'Path' = $data.destination
Expand All @@ -731,16 +731,16 @@ function Request-UnitySetupInstaller {
$elapsedTime = (Get-Date) - $data.startTime

$progress = [int](($data.receivedBytes / [double]$data.totalBytes) * 100)

$averageSpeed = $data.receivedBytes / $elapsedTime.TotalSeconds
$secondsRemaining = ($data.totalBytes - $data.receivedBytes) / $averageSpeed

if ([double]::IsInfinity($secondsRemaining)) {
$averageSpeed = 0
# -1 for Write-Progress prevents seconds remaining from showing.
$secondsRemaining = -1
}

$downloadSpeed = Format-BitsPerSecond -Bytes $data.receivedBytes -Seconds $elapsedTime.TotalSeconds

Write-Progress -Activity "Downloading $installerFileName | $downloadSpeed" `
Expand Down Expand Up @@ -811,14 +811,14 @@ function Install-UnitySetupPackage {
}
}
}

Write-Verbose "$(Get-Date): Installing $($Package.ComponentType) to $Destination."
$process = Start-Process @startProcessArgs
if ( $process ) {
if ( $process.ExitCode -ne 0) {
Write-Error "$(Get-Date): Failed with exit code: $($process.ExitCode)"
}
else {
else {
Write-Verbose "$(Get-Date): Succeeded."
}
}
Expand Down Expand Up @@ -922,7 +922,7 @@ function Install-UnitySetupInstance {
$installPath += [io.path]::DirectorySeparatorChar
}

# Creating sparse bundle to host installing Unity in other locations
# Creating sparse bundle to host installing Unity in other locations
$unitySetupBundlePath = [io.path]::Combine($Cache, "UnitySetup.sparsebundle")
if (-not (Test-Path $unitySetupBundlePath)) {
Write-Verbose "Creating new sparse bundle disk image for installation."
Expand Down Expand Up @@ -1415,7 +1415,7 @@ function Start-UnityEditor {
if ( -not $PSBoundParameters.ContainsKey('BatchMode') ) { $BatchMode = $true }
if ( -not $PSBoundParameters.ContainsKey('Quit') ) { $Quit = $true }
}
if ( $AcceptAPIUpdate ) {
if ( $AcceptAPIUpdate ) {
$sharedArgs += '-accept-apiupdate'
if ( -not $PSBoundParameters.ContainsKey('BatchMode')) { $BatchMode = $true }
}
Expand Down Expand Up @@ -1478,7 +1478,7 @@ function Start-UnityEditor {
([OperatingSystem]::Windows) {
$editor = Get-ChildItem "$($setupInstance.Path)" -Filter 'Unity.exe' -Recurse |
Select-Object -First 1 -ExpandProperty FullName

if ([string]::IsNullOrEmpty($editor)) {
Write-Error "Could not find Unity.exe under setup instance path: $($setupInstance.Path)"
continue
Expand All @@ -1489,7 +1489,7 @@ function Start-UnityEditor {
}
([OperatingSystem]::Mac) {
$editor = [io.path]::Combine("$($setupInstance.Path)", "Unity.app/Contents/MacOS/Unity")

if ([string]::IsNullOrEmpty($editor)) {
Write-Error "Could not find Unity app under setup instance path: $($setupInstance.Path)"
continue
Expand All @@ -1513,7 +1513,7 @@ function Start-UnityEditor {
if ( $Credential ) { $unityArgs += '-password', $Credential.GetNetworkCredential().Password }
if ( $Serial ) { $unityArgs += '-serial', [System.Net.NetworkCredential]::new($null, $Serial).Password }

# We've experienced issues with Start-Process -Wait and redirecting
# We've experienced issues with Start-Process -Wait and redirecting
# output so we're using the Process class directly now.
$process = New-Object System.Diagnostics.Process
$process.StartInfo.Filename = $editor
Expand All @@ -1523,17 +1523,17 @@ function Start-UnityEditor {
$process.StartInfo.UseShellExecute = $false
$process.StartInfo.CreateNoWindow = $true
$process.StartInfo.WorkingDirectory = $PWD
$process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
$process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
$process.Start() | Out-Null

if ( $Wait ) {
$process.WaitForExit()

if ( $LogFile -and (Test-Path $LogFile -Type Leaf) ) {
# Note that Unity sometimes returns a success ExitCode despite the presence of errors, but we want
# to make sure that we flag such errors.
Write-UnityErrors $LogFile

Write-Verbose "Writing $LogFile to Information stream Tagged as 'Logs'"
Get-Content $LogFile | ForEach-Object { Write-Information -MessageData $_ -Tags 'Logs' }
}
Expand Down Expand Up @@ -1617,7 +1617,7 @@ function Get-UnityLicense {
# The first four bytes look like a count so skip that to pull out the serial string
$licenseSerial = [String]::new($devBytes[4..($devBytes.Length - 1)])
if ( $Serial -and [System.Net.NetworkCredential]::new($null, $Serial).Password -ne $licenseSerial ) { continue; }

$license = $doc.root.License
[PSCustomObject]@{
'LicenseVersion' = $license.LicenseVersion.Value
Expand All @@ -1641,11 +1641,11 @@ function Get-UnityLicense {

$alias = Get-Alias -Name $_.Name -ErrorAction 'SilentlyContinue'
if ( -not $alias ) {
Write-Verbose "Creating new alias $($_.Name) for $($_.Value)"
New-Alias @_
Write-Verbose "Creating new alias $($_.Name) for $($_.Value)"
New-Alias @_
}
elseif ( $alias.ModuleName -eq 'UnitySetup' ) {
Write-Verbose "Setting alias $($_.Name) to $($_.Value)"
Write-Verbose "Setting alias $($_.Name) to $($_.Value)"
Set-Alias @_
}
else {
Expand Down