Skip to content

Commit d12c81b

Browse files
committed
Code refactoring
1 parent f974af5 commit d12c81b

File tree

78 files changed

+1222
-1140
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

78 files changed

+1222
-1140
lines changed

Download_Sophia.ps1

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -199,11 +199,16 @@ switch ($Version)
199199
}
200200
}
201201

202-
$SetForegroundWindow = @{
203-
Namespace = "WinAPI"
204-
Name = "ForegroundWindow"
205-
Language = "CSharp"
206-
MemberDefinition = @"
202+
# https://github.com/PowerShell/PowerShell/issues/21070
203+
$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
204+
$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
205+
$CompilerParameters.GenerateInMemory = $true
206+
$Signature = @{
207+
Namespace = "WinAPI"
208+
Name = "ForegroundWindow"
209+
Language = "CSharp"
210+
CompilerParameters = $CompilerParameters
211+
MemberDefinition = @"
207212
[DllImport("user32.dll")]
208213
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
209214
[DllImport("user32.dll")]
@@ -213,14 +218,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
213218
}
214219
if (-not ("WinAPI.ForegroundWindow" -as [type]))
215220
{
216-
try
217-
{
218-
Add-Type @SetForegroundWindow
219-
}
220-
catch [System.ComponentModel.Win32Exception]
221-
{
222-
Write-Warning -Message "PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Ignore this error message. Open background folder manually."
223-
}
221+
Add-Type @Signature
224222
}
225223

226224
Start-Sleep -Seconds 1

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
2727
[telegram-news]: https://t.me/sophianews
2828
[telegram-group]: https://t.me/sophia_chat
29-
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
29+
[telegram-group-badge]: https://img.shields.io/endpoint?color=neon&label=Sophia%20Chat&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsophia_chat
3030

3131
[![Telegram][telegram-news-badge]][telegram-news]
3232
[![Telegram][telegram-group-badge]][telegram-group]
@@ -114,10 +114,10 @@
114114
| Version | Marketing name | Build | Editions |
115115
|:-----------------------------------------|--------------------:|:-----------:|:-------------------:|
116116
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | Home/Pro/Enterprise |
117-
| Windows 11 23H2 | 2023 Update | 22631.3155+ | Home/Pro/Enterprise |
118-
| Windows 10 x64 22H2 | 2022 Update | 19045.4046+ | Home/Pro/Enterprise |
119-
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4046+ | Enterprise |
120-
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5458+ | Enterprise |
117+
| Windows 11 23H2 | 2023 Update | 22631.3296+ | Home/Pro/Enterprise |
118+
| Windows 10 x64 22H2 | 2022 Update | 19045.4170+ | Home/Pro/Enterprise |
119+
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4170+ | Enterprise |
120+
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5579+ | Enterprise |
121121

122122
### Warning
123123

README_de-de.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
2727
[telegram-news]: https://t.me/sophianews
2828
[telegram-group]: https://t.me/sophia_chat
29-
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
29+
[telegram-group-badge]: https://img.shields.io/endpoint?color=neon&label=Sophia%20Chat&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsophia_chat
3030

3131
[![Telegram][telegram-news-badge]][telegram-news]
3232
[![Telegram][telegram-group-badge]][telegram-group]
@@ -114,10 +114,10 @@
114114
| Version | Marketing name | Build | Editions |
115115
|:-----------------------------------------|--------------------:|:-----------:|:-------------------:|
116116
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | Home/Pro/Enterprise |
117-
| Windows 11 23H2 | 2023 Update | 22631.3155+ | Home/Pro/Enterprise |
118-
| Windows 10 x64 22H2 | 2022 Update | 19045.4046+ | Home/Pro/Enterprise |
119-
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4046+ | Enterprise |
120-
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5458+ | Enterprise |
117+
| Windows 11 23H2 | 2023 Update | 22631.3296+ | Home/Pro/Enterprise |
118+
| Windows 10 x64 22H2 | 2022 Update | 19045.4170+ | Home/Pro/Enterprise |
119+
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4170+ | Enterprise |
120+
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5579+ | Enterprise |
121121

122122
### Warnung
123123

README_uk-ua.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@
1414
<a href="https://github.com/farag2/Sophia-Script-for-Windows/actions"><img src="https://img.shields.io/github/actions/workflow/status/farag2/Sophia-Script-for-Windows/Sophia.yml?label=GitHub%20Actions&logo=GitHub"></a>
1515
<img src="https://img.shields.io/badge/PowerShell%205.1%20&%207.3-Ready-blue.svg?color=5391FE&style=flat&logo=powershell">
1616

17-
<a href="https://github.com/farag2/Sophia-Script-for-Windows/releases"><img src="https://img.shields.io/github/v/release/farag2/Sophia-Script-for-Windows">
18-
</a><a href="https://github.com/farag2/Sophia-Script-for-Windows"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/farag2/9852d6b9569a91bf69ceba8a94cc97f4/raw/SophiaScript.json"></a>
17+
<a href="https://github.com/farag2/Sophia-Script-for-Windows/releases"><img src="https://img.shields.io/github/v/release/farag2/Sophia-Script-for-Windows"></a>
18+
<a href="https://github.com/farag2/Sophia-Script-for-Windows"><img src="https://img.shields.io/endpoint?url=https://gist.githubusercontent.com/farag2/9852d6b9569a91bf69ceba8a94cc97f4/raw/SophiaScript.json"></a>
1919

2020
<a href="https://github.com/farag2/Sophia-Script-for-Windows/releases"><img src="https://img.shields.io/github/downloads/farag2/Sophia-Script-for-Windows/total?label=downloads%20%28since%20May%202020%29"></a>
2121
<a href="https://community.chocolatey.org/packages/sophia"><img src="https://img.shields.io/chocolatey/dt/sophia?color=blue&label=chocolatey%20package"></a>
@@ -26,7 +26,7 @@
2626
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
2727
[telegram-news]: https://t.me/sophianews
2828
[telegram-group]: https://t.me/sophia_chat
29-
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
29+
[telegram-group-badge]: https://img.shields.io/endpoint?color=neon&label=Sophia%20Chat&style=flat&url=https%3A%2F%2Ftg.sumanjay.workers.dev%2Fsophia_chat
3030

3131
[![Telegram][telegram-news-badge]][telegram-news]
3232
[![Telegram][telegram-group-badge]][telegram-group]
@@ -114,10 +114,10 @@
114114
| Версія | Маркетингова назва | Збіркa | Видання |
115115
|:-----------------------------------------|--------------------:|:-----------:|:-------------------:|
116116
| Windows 11 Insider Preview 24H2 | 2024 Update | 22509+ | Home/Pro/Enterprise |
117-
| Windows 11 23H2 | 2023 Update | 22631.3155+ | Home/Pro/Enterprise |
118-
| Windows 10 x64 22H2 | 2022 Update | 19045.4046+ | Home/Pro/Enterprise |
119-
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4046+ | Enterprise |
120-
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5458+ | Enterprise |
117+
| Windows 11 23H2 | 2023 Update | 22631.3296+ | Home/Pro/Enterprise |
118+
| Windows 10 x64 22H2 | 2022 Update | 19045.4170+ | Home/Pro/Enterprise |
119+
| Windows 10 x64 21H2 Enterprise LTSC 2021 | October 2021 Update | 19044.4170+ | Enterprise |
120+
| Windows 10 x64 1809 Enterprise LTSC 2019 | October 2018 Update | 17763.5579+ | Enterprise |
121121

122122
### Увага
123123

Wrapper/SophiaScriptWrapper.exe

1.5 KB
Binary file not shown.

sophia_script_versions.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
{
2-
"Sophia_Script_Windows_10_PowerShell_5_1": "5.18.3",
3-
"Sophia_Script_Windows_10_PowerShell_7": "5.18.3",
4-
"Sophia_Script_Windows_10_LTSC2019": "5.8.3",
5-
"Sophia_Script_Windows_10_LTSC2021": "5.18.3",
6-
"Sophia_Script_Windows_11_PowerShell_5_1": "6.6.3",
7-
"Sophia_Script_Windows_11_PowerShell_7": "6.6.3",
8-
"Sophia_Script_Wrapper": "2.6.20"
2+
"Sophia_Script_Windows_10_PowerShell_5_1": "5.18.4",
3+
"Sophia_Script_Windows_10_PowerShell_7": "5.18.4",
4+
"Sophia_Script_Windows_10_LTSC2019": "5.8.4",
5+
"Sophia_Script_Windows_10_LTSC2021": "5.18.4",
6+
"Sophia_Script_Windows_11_PowerShell_5_1": "6.6.4",
7+
"Sophia_Script_Windows_11_PowerShell_7": "6.6.4",
8+
"Sophia_Script_Wrapper": "2.7.0"
99
}

src/Sophia_Script_for_Windows_10/Functions.ps1

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
.SYNOPSIS
33
The TAB completion for functions and their arguments
44
5-
Version: v5.18.3
6-
Date: 01.04.2024
5+
Version: v5.18.4
6+
Date: 07.04.2024
77
88
Copyright (c) 2014—2024 farag, Inestic & lowl1f3
99
@@ -49,7 +49,7 @@ function Sophia
4949

5050
Clear-Host
5151

52-
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.3 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
52+
$Host.UI.RawUI.WindowTitle = "Sophia Script for Windows 10 v5.18.4 | Made with $([System.Char]::ConvertFromUtf32(0x1F497)) of Windows | $([System.Char]0x00A9) farag, Inestic & lowl1f3, 2014$([System.Char]0x2013)2024"
5353

5454
Remove-Module -Name Sophia -Force -ErrorAction Ignore
5555
Import-Module -Name $PSScriptRoot\Manifest\Sophia.psd1 -PassThru -Force

src/Sophia_Script_for_Windows_10/Localizations/de-DE/Sophia.psd1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ConvertFrom-StringData -StringData @'
22
UnsupportedOSBitness = Das Skript unterstützt nur 64-Bit-Windows.
33
UnsupportedOSBuild = Das Skript unterstützt Windows 10 22H2.
4-
NonLatinUsernameWarning = PowerShell 5.1 kompiliert keinen Code, wenn der Benutzername nicht-lateinische Zeichen (einschließlich Emoji) enthält und in Kleinbuchstaben geschrieben ist. Bitte verwenden Sie PowerShell 7.
54
UpdateWarning = Ihr Windows 10-Build: {0}.{1}. Unterstützter Builds: {2}+. Führen Sie Windows Update aus und versuchen Sie es erneut.
65
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
76
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.

src/Sophia_Script_for_Windows_10/Localizations/en-US/Sophia.psd1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ConvertFrom-StringData -StringData @'
22
UnsupportedOSBitness = The script supports 64-bit Windows only.
33
UnsupportedOSBuild = The script supports Windows 10 22H2.
4-
NonLatinUsernameWarning = PowerShell 5.1 does not compile code if the username contains non-Latin characters (including emoji) and is written in lowercase. Please, use PowerShell 7.
54
UpdateWarning = Your Windows 10 build: {0}.{1}. Supported builds: {2}+. Run Windows Update and try again.
65
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode.
76
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights.

src/Sophia_Script_for_Windows_10/Localizations/es-ES/Sophia.psd1

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
ConvertFrom-StringData -StringData @'
22
UnsupportedOSBitness = El script sólo es compatible con Windows de 64 bits.
33
UnsupportedOSBuild = El script es compatible con versión Windows 10 22H2.
4-
NonLatinUsernameWarning = PowerShell 5.1 no compila código si el nombre de usuario contiene caracteres no latinos (incluidos los emoji) y está escrito en minúsculas. Por favor, utiliza PowerShell 7.
54
UpdateWarning = Su build de Windows 10: {0}.{1}. Compilaciones compatibles: {2}+. Ejecute Windows Update y vuelva a intentarlo.
65
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
76
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.

0 commit comments

Comments
 (0)