-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
7456980
commit 2a99bac
Showing
38 changed files
with
577 additions
and
482 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[.ShellClassInfo] | ||
IconResource=..\img\git.ico,0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
[.ShellClassInfo] | ||
IconResource=C:\WINDOWS\System32\SHELL32.dll,267 | ||
IconResource=.\img\esh.ico,0 |
Binary file not shown.
Binary file not shown.
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/esh.exe |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[CmdletBinding()]param ($OutputFile = "$PSScriptRoot/esh.exe") | ||
|
||
if (-not (Get-Module -ListAvailable ps2exe)) { | ||
Install-Module ps2exe | ||
} | ||
Invoke-ps2exe $PSScriptRoot/main.ps1 $OutputFile -NoConsole -iconFile $PSScriptRoot/../img/esh.ico -title 'E-Shell' -description 'E-Shell' -version '1960.7.17.13' -company 'E-tek' -product 'E-Sh' -copyright '(c) E-tek Corporation. All rights reserved.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
[.ShellClassInfo] | ||
IconResource=C:\WINDOWS\System32\SHELL32.dll,214 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
param( | ||
[switch]$RunInstall=$false, | ||
[Parameter(ValueFromRemainingArguments = $true)] | ||
$RemainingArguments | ||
) | ||
if((Get-ExecutionPolicy) -eq 'Restricted'){ Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force } | ||
$env:Path.Split(";") | ForEach-Object { | ||
if ($_ -and (-not (Test-Path $_ -PathType Container))) { | ||
Write-Warning "检测到无效的环境变量于$_,请考虑删除" | ||
} | ||
elseif ($_ -like "*[\\/]esh[\\/]path*") { | ||
$eshDir = $_ -replace "[\\/]path[\\/]*$", '' | ||
$eshDirFromEnv = $true | ||
} | ||
} | ||
if (-not $eshDir) { | ||
$eshDir = if (Test-Path $env:LOCALAPPDATA/esh) { "$env:LOCALAPPDATA/esh" } | ||
} | ||
|
||
if (-not $eshDir) { | ||
Remove-Item $env:LOCALAPPDATA/esh -Confirm -ErrorAction Ignore -Recurse | ||
Remove-Item $env:TEMP/esh-master -Force -ErrorAction Ignore -Confirm:$false -Recurse | ||
try { Invoke-WebRequest https://bit.ly/Esh-zip -OutFile $env:TEMP/Eshell.zip } | ||
catch { | ||
$Host.UI.WriteErrorLine("下载错误 终止程序") | ||
exit 1 | ||
} | ||
Expand-Archive $env:TEMP/Eshell.zip $env:TEMP -Force | ||
Remove-Item $env:TEMP/Eshell.zip -Force | ||
Move-Item $env:TEMP/esh-master $env:LOCALAPPDATA/esh -Force | ||
$eshDir = "$env:LOCALAPPDATA/esh" | ||
try { Invoke-WebRequest 'https://bit.ly/SAO-lib' -OutFile "$eshDir/data/SAO-lib.txt" } | ||
catch { | ||
Write-Host "啊哦 SAO-lib下载失败了`n这不会影响什么,不过你可以在Esh启动后使用``Update-SAO-lib``来让Esh有机会显示更多骚话" | ||
} | ||
} | ||
|
||
if ($RunInstall){ | ||
. $eshDir/src/opt/install.ps1 $RemainingArguments | ||
exit | ||
} | ||
if (-not (Get-Command pwsh -ErrorAction Ignore)) { | ||
$Host.UI.WriteErrorLine("esh的运行需要PowerShell 6或以上`n访问 https://aka.ms/pscore6 来获取PowerShell 6+ 并使得``pwsh``命令在环境中可用以使得esh能够正常工作") | ||
do { | ||
$response = $Host.UI.PromptForChoice("未找到可用的pwsh", "尝试自动安装PowerShell吗?", @("自动安装","带我到下载页面","退出"), 0) | ||
} until ($response -ne -1) | ||
switch ($response) { | ||
0 { | ||
if (-not (Get-Command winget -ErrorAction Ignore)) { | ||
Import-Module Appx | ||
Add-AppxPackage -RegisterByFamilyName -MainPackage Microsoft.DesktopAppInstaller_8wekyb3d8bbwe | ||
} | ||
Invoke-Expression "winget install --id Microsoft.Powershell $( | ||
if([System.Environment]::OSVersion.Version.Major -le 7){'-v 7.2.15'} | ||
)" | ||
} | ||
1 { Start-Process https://aka.ms/pscore6 } | ||
2 { exit 1 } | ||
} | ||
} | ||
if (Get-Command pwsh -ErrorAction Ignore) { | ||
if (Get-Command wt -ErrorAction Ignore) { | ||
wt $eshDir/path/esh.cmd $RemainingArguments | ||
} | ||
else{ & $eshDir/path/esh $RemainingArguments } | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,12 @@ | ||
# 假如在win8以下的系统上运行,那么我们需要检查和修复输出编码 | ||
if ($IsWindows -and ([System.Environment]::OSVersion.Version.Major -le 7)) { | ||
if ($IsWindows -and ([Console]::OutputEncoding -ne [System.Text.Encoding]::UTF8)) { | ||
$CursorPosBackUp = $host.UI.RawUI.CursorPosition | ||
$CodingBackUp = [Console]::OutputEncoding | ||
$TestText = '中文测试你好小笼包我是冰激凌' | ||
function TestAndSet ($Encoding) { | ||
try { Write-Host $TestText } | ||
catch { $error.RemoveAt(0); [Console]::OutputEncoding = $Encoding } | ||
$host.UI.RawUI.CursorPosition = $CursorPosBackUp | ||
foreach ($Encoding in [System.Text.Encoding]::GetEncodings()) { | ||
try { Write-Host $TestText;break } | ||
catch { $error.RemoveAt(0);[Console]::OutputEncoding = $Encoding } | ||
try{ $host.UI.RawUI.CursorPosition = $CursorPosBackUp } catch { $Error.RemoveAt(0) } | ||
} | ||
TestAndSet ([System.Text.Encoding]::GetEncoding(936)) | ||
TestAndSet $CodingBackUp | ||
Write-Host $(' ' * $TestText.Length * 2) | ||
$host.UI.RawUI.CursorPosition = $CursorPosBackUp | ||
Remove-Variable @('CursorPosBackUp', 'CodingBackUp', 'TestText') | ||
Remove-Item function:TestAndSet | ||
try{ $host.UI.RawUI.CursorPosition = $CursorPosBackUp } catch { $Error.RemoveAt(0) } | ||
Remove-Variable @('CursorPosBackUp', 'TestText') | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.