Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTranslitModule.psm1
More file actions
Latest commit
62 lines (45 loc) · 1.8 KB
/
Copy pathTranslitModule.psm1
File metadata and controls
62 lines (45 loc) · 1.8 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
49
50
51
52
53
54
55
56
57
58
59
60
61
#
# Script module for module 'PSScriptAnalyzer'
#
Set-StrictMode-Version Latest
$VerbosePreference="continue"
# Set up some helper variables to make it easier to work with the module
$PSModule=$ExecutionContext.SessionState.Module
$PSModuleRoot=$PSModule.ModuleBase
# Import the appropriate nested binary module based on the current PowerShell version
$binaryModuleRoot=Join-Path$PSModuleRoot'bin'
if (($PSVersionTable.Keys-contains"PSEdition") -and ($PSVersionTable.PSEdition-ne'Desktop')) {
$binaryModuleRoot=Join-Path-Path $binaryModuleRoot-ChildPath 'coreclr'
}
else
{
if ($PSVersionTable.PSVersion-lt [Version]'5.0')
{
$binaryModuleRoot=Join-Path-Path $binaryModuleRoot-ChildPath 'v3'
}
else{
$binaryModuleRoot=Join-Path-Path $binaryModuleRoot-ChildPath 'dotnet'
}
}
Write-Verbose"Binary module Dir: $binaryModuleRoot"
$binaryModulePath=Join-Path-Path $binaryModuleRoot-ChildPath 'TranslitModule.dll'
$dependencies=Get-ChildItem-Path $binaryModuleRoot-Exclude $binaryModulePath
$loadedAssemblies=@()
Foreach ($dllin$dependencies)
{
$loadedAssemblies+=Import-Module-Name $dll-PassThru
}
$loadedAssemblies+=Import-Module-Name $binaryModulePath-PassThru
Write-Verbose"Loaded Assemblies: $loadedAssemblies"
# When the module is unloaded, remove the nested binary module that was loaded with it
$PSModule.OnRemove= {
[array]::Reverse($loadedAssemblies)
Foreach ($dllin$loadedAssemblies)
{
Write-Verbose"Removing Assembly: $dll"
Remove-Module-ModuleInfo $dll
}
}
Set-Alias untranslit ConvertFrom-LatinTransliteration
Set-Alias translit ConvertTo-LatinTransliteration
Export-ModuleMember-Cmdlet ConvertFrom-LatinTransliteration,ConvertTo-LatinTransliteration-Alias untranslit, translit