{
    "version": "5.4.920.0",
    "description": "A dynamic mathematics software for education that brings together geometry, algebra, spreadsheets, graphing, statistics and calculus.",
    "homepage": "https://www.geogebra.org",
    "license": {
        "identifier": "Freeware",
        "url": "https://www.geogebra.org/license"
    },
    "notes": [
        "To register file associations, please execute the following command:",
        "reg import \"$dir\\install-associations.reg\""
    ],
    "url": "https://download.geogebra.org/installers/5.4/GeoGebra-Windows-Portable-5-4-920-0.zip",
    "hash": "d95d8a3229747d4adc45055c6d02755e5007a0935a7933910142f198b3834ce4",
    "extract_dir": "GeoGebra 5.4.920.0",
    "post_install": [
        "$geogebra_path = $dir -replace '\\\\', '\\\\'",
        "Get-ChildItem -Path \"$bucketsdir\\$bucket\\scripts\\$app\" -Filter '*.reg' -File | ForEach-Object {",
        "    $content = Get-Content -Path $_.FullName -Encoding ascii",
        "    if ($global) { $content = $content -replace 'HKEY_CURRENT_USER', 'HKEY_LOCAL_MACHINE' }",
        "    $content -replace '{{geogebra_dir}}', $geogebra_path | Set-Content -Path \"$dir\\$($_.Name)\" -Encoding unicode",
        "}"
    ],
    "bin": [
        [
            "GeoGebra.exe",
            "geogebra5"
        ]
    ],
    "shortcuts": [
        [
            "GeoGebra.exe",
            "GeoGebra 5"
        ]
    ],
    "uninstaller": {
        "script": "if ($cmd -eq 'uninstall') { reg import \"$dir\\uninstall-associations.reg\" *> $null }"
    },
    "checkver": {
        "script": [
            "$url = 'https://download.geogebra.org/package/win-port'",
            "$request = [System.Net.HttpWebRequest]::Create($url)",
            "$response = $request.GetResponse()",
            "$response.ResponseUri.AbsoluteUri -match 'Portable-(?<dashVersion>[\\d-]+)\\.zip'",
            "Write-Output ($Matches['dashVersion'] -replace '-', '.')"
        ],
        "regex": "(5\\.[\\d.]+)"
    },
    "autoupdate": {
        "url": "https://download.geogebra.org/installers/$majorVersion.$minorVersion/GeoGebra-Windows-Portable-$dashVersion.zip",
        "extract_dir": "GeoGebra $version"
    }
}
