using namespace Microsoft.Win32;

. "$PSScriptRoot/../../lib/SoftwareManagement.ps1";
. "$PSScriptRoot/../../../lib/Software.ps1";
. "$PSScriptRoot/../../../lib/System.ps1";

Start-SoftwareInstaller @args `
    -Installer {
        Install-ChocoPackage "vcredist2013";
    } `
    -UserConfigurator {
        $file = "setup.exe";
        $dir = New-TemporaryDirectory;

        Push-Location $dir;
        Invoke-WebRequest "https://files.update.oem.tobii.com/GameHub/TobiiGameHub.3.0.1-Setup.exe" -OutFile $file;
        Write-Host "Running Tobii Game Hub installer";
        Start-Process -Wait -FilePath "$PSScriptRoot/GameHub.ahk";
        Pop-Location;

        Remove-Item -Recurse $dir;
    };