-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathPrelude.psm1
More file actions
48 lines (48 loc) · 2.2 KB
/
Copy pathPrelude.psm1
File metadata and controls
48 lines (48 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<#
██████╗░██████╗░███████╗██╗░░░░░██╗░░░██╗██████╗░███████╗
██╔══██╗██╔══██╗██╔════╝██║░░░░░██║░░░██║██╔══██╗██╔════╝
██████╔╝██████╔╝█████╗░░██║░░░░░██║░░░██║██║░░██║█████╗░░
██╔═══╝░██╔══██╗██╔══╝░░██║░░░░░██║░░░██║██║░░██║██╔══╝░░
██║░░░░░██║░░██║███████╗███████╗╚██████╔╝██████╔╝███████╗
╚═╝░░░░░╚═╝░░╚═╝╚══════╝╚══════╝░╚═════╝░╚═════╝░╚══════╝
#>
function Add-TypeData {
Param(
[Parameter(Mandatory = $True, Position = 0)]
[String] $Name
)
$Path = Join-Path $PSScriptRoot "bin/${Name}.dll"
if (Test-Path $Path) {
Add-Type -Path $Path
} else {
"==> [ERROR] Failed to load ${Name} type accelerators" | Write-Warning
}
}
<#
Import link libraries and create type accelarators
#>
$Accelerators = [PowerShell].Assembly.GetType('System.Management.Automation.TypeAccelerators')
if (-not ('Complex' -as [Type])) {
$Accelerators::Add('Complex', 'System.Numerics.Complex')
}
'CommandLineInterface', 'Matrix', 'Node', 'Edge', 'DirectedEdge', 'Graph' | ForEach-Object {
if (-not ("Prelude.${_}" -as [Type])) {
Add-TypeData $_
$Accelerators::Add($_, "Prelude.${_}")
}
}
'Datum', 'Coordinate' | ForEach-Object {
if (-not ("Prelude.Geodetic.${_}" -as [Type])) {
Add-TypeData $_
$Accelerators::Add($_, "Prelude.Geodetic.${_}")
}
}
<#
Import source files
#>
'src', 'Plus' | ForEach-Object {
$SourceFiles = Join-Path $PSScriptRoot $_
Get-ChildItem -Path $SourceFiles -Recurse -Include *.ps1 |
Sort-Object |
ForEach-Object { . $_.FullName }
}