-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleMode.ps1
More file actions
53 lines (44 loc) · 1.47 KB
/
Copy pathConsoleMode.ps1
File metadata and controls
53 lines (44 loc) · 1.47 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
#Requires -Version 5.1
# Console Mode - Ponto de entrada
Add-Type -AssemblyName System.Windows.Forms
Add-Type -AssemblyName System.Drawing
function Resolve-ConsoleEntryRoot {
$candidates = [System.Collections.ArrayList]@()
$baseDir = [AppDomain]::CurrentDomain.BaseDirectory
if ($baseDir) {
[void]$candidates.Add($baseDir.TrimEnd('\', '/'))
}
if ($ScriptRoot) {
[void]$candidates.Add($ScriptRoot.ToString().TrimEnd('\', '/'))
}
if ($PSScriptRoot) {
[void]$candidates.Add($PSScriptRoot.TrimEnd('\', '/'))
}
if ($MyInvocation.MyCommand.Path) {
[void]$candidates.Add((Split-Path -Parent $MyInvocation.MyCommand.Path).TrimEnd('\', '/'))
}
$seen = @{}
foreach ($dir in $candidates) {
if ([string]::IsNullOrWhiteSpace($dir)) { continue }
if ($seen.ContainsKey($dir)) { continue }
$seen[$dir] = $true
$pathsFile = Join-Path $dir "lib\Paths.ps1"
if (Test-Path -LiteralPath $pathsFile) {
return $dir
}
}
if ($baseDir) {
return $baseDir.TrimEnd('\', '/')
}
return (Get-Location).Path
}
$ScriptRoot = Resolve-ConsoleEntryRoot
$Script:EntryRoot = $ScriptRoot
. (Join-Path $ScriptRoot "lib\Encoding.ps1")
Initialize-ConsoleEncoding
. (Join-Path $ScriptRoot "lib\Paths.ps1")
. (Join-Path $ScriptRoot "lib\Rtss.ps1")
. (Join-Path $ScriptRoot "lib\Engine.ps1")
Initialize-ConsoleAppLayout
. (Join-Path $ScriptRoot "lib\Gui.ps1")
Show-ConsoleModeGui