CAT.psm1

# The package is published for win-x64, so the Microsoft.Data.SqlClient beside CAT.dll is the
# Windows build of the driver (native SNI, a registry lookup on connect). Off Windows, load the
# Unix build before anything binds to the name: the default load context keeps one assembly per
# name, so CAT.dll and the other drivers bind to this one. Its dependencies live in unix/ too,
# because .NET probes only the requesting assembly's folder.
if (-not $IsWindows) {
    Add-Type -Path (Join-Path $PSScriptRoot 'unix' 'Microsoft.Data.SqlClient.dll')
}

$ascii = Get-Content "$PSScriptRoot/cat-ascii.txt" -Raw
Write-Host $ascii -ForegroundColor Magenta
Write-Host "CAT documentation: https://docs.justcat.it"
Write-Host "Give us feedback: https://portal.justcat.it/#/feedback"

$manifest = Import-PowerShellDataFile (Join-Path $PSScriptRoot 'CAT.psd1')
$displayVersion = $manifest.ModuleVersion
$prerelease = $manifest.PrivateData.PSData.Prerelease
if (-not [string]::IsNullOrWhiteSpace($prerelease)) {
    $displayVersion = "$displayVersion-$prerelease"
}
Write-Host "Version: $displayVersion"
Write-Host "" # empty line