Skip to content

Commit

Permalink
Code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
farag2 committed Apr 7, 2024
1 parent f974af5 commit 3e5cbc1
Show file tree
Hide file tree
Showing 66 changed files with 1,115 additions and 1,033 deletions.
24 changes: 11 additions & 13 deletions Download_Sophia.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -199,11 +199,16 @@ switch ($Version)
}
}

$SetForegroundWindow = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
MemberDefinition = @"
# https://github.com/PowerShell/PowerShell/issues/21070
$CompilerParameters = [System.CodeDom.Compiler.CompilerParameters]::new("System.dll")
$CompilerParameters.TempFiles = [System.CodeDom.Compiler.TempFileCollection]::new($env:TEMP, $false)
$CompilerParameters.GenerateInMemory = $true
$Signature = @{
Namespace = "WinAPI"
Name = "ForegroundWindow"
Language = "CSharp"
CompilerParameters = $CompilerParameters
MemberDefinition = @"
[DllImport("user32.dll")]
public static extern bool ShowWindowAsync(IntPtr hWnd, int nCmdShow);
[DllImport("user32.dll")]
Expand All @@ -213,14 +218,7 @@ public static extern bool SetForegroundWindow(IntPtr hWnd);
}
if (-not ("WinAPI.ForegroundWindow" -as [type]))
{
try
{
Add-Type @SetForegroundWindow
}
catch [System.ComponentModel.Win32Exception]
{
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."
}
Add-Type @Signature
}

Start-Sleep -Seconds 1
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
[telegram-news]: https://t.me/sophianews
[telegram-group]: https://t.me/sophia_chat
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
[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

[![Telegram][telegram-news-badge]][telegram-news]
[![Telegram][telegram-group-badge]][telegram-group]
Expand Down
2 changes: 1 addition & 1 deletion README_de-de.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
[telegram-news]: https://t.me/sophianews
[telegram-group]: https://t.me/sophia_chat
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
[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

[![Telegram][telegram-news-badge]][telegram-news]
[![Telegram][telegram-group-badge]][telegram-group]
Expand Down
6 changes: 3 additions & 3 deletions README_uk-ua.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<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>
<img src="https://img.shields.io/badge/PowerShell%205.1%20&%207.3-Ready-blue.svg?color=5391FE&style=flat&logo=powershell">

<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><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>
<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>
<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>

<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>
<a href="https://community.chocolatey.org/packages/sophia"><img src="https://img.shields.io/chocolatey/dt/sophia?color=blue&label=chocolatey%20package"></a>
Expand All @@ -26,7 +26,7 @@
[telegram-news-badge]: https://img.shields.io/badge/Sophia%20News-Telegram-blue?style=flat&logo=Telegram
[telegram-news]: https://t.me/sophianews
[telegram-group]: https://t.me/sophia_chat
[telegram-group-badge]: https://img.shields.io/badge/Sophia%20Chat-Telegram-blue?style=flat&logo=Telegram
[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

[![Telegram][telegram-news-badge]][telegram-news]
[![Telegram][telegram-group-badge]][telegram-group]
Expand Down
Binary file modified Wrapper/SophiaScriptWrapper.exe
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Das Skript unterstützt nur 64-Bit-Windows.
UnsupportedOSBuild = Das Skript unterstützt Windows 10 22H2.
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.
UpdateWarning = Ihr Windows 10-Build: {0}.{1}. Unterstützter Builds: {2}+. Führen Sie Windows Update aus und versuchen Sie es erneut.
UnsupportedLanguageMode = Die PowerShell-Sitzung wird in einem eingeschränkten Sprachmodus ausgeführt.
LoggedInUserNotAdmin = Der angemeldete Benutzer hat keine Administratorrechte.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = The script supports 64-bit Windows only.
UnsupportedOSBuild = The script supports Windows 10 22H2.
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.
UpdateWarning = Your Windows 10 build: {0}.{1}. Supported builds: {2}+. Run Windows Update and try again.
UnsupportedLanguageMode = The PowerShell session in running in a limited language mode.
LoggedInUserNotAdmin = The logged-on user doesn't have admin rights.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = El script sólo es compatible con Windows de 64 bits.
UnsupportedOSBuild = El script es compatible con versión Windows 10 22H2.
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.
UpdateWarning = Su build de Windows 10: {0}.{1}. Compilaciones compatibles: {2}+. Ejecute Windows Update y vuelva a intentarlo.
UnsupportedLanguageMode = Sesión de PowerShell ejecutada en modo de lenguaje limitado.
LoggedInUserNotAdmin = El usuario que inició sesión no tiene derechos de administrador.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Le script n'est compatible qu'avec Windows 64 bits.
UnsupportedOSBuild = Le script supporte les versions Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 ne compile pas le code si le nom d'utilisateur contient des caractères non latins (y compris emoji) et est écrit en minuscules. Veuillez utiliser PowerShell 7.
UpdateWarning = Votre version de Windows 10: {0}.{1}. Versions prises en charge: {2}+. Exécutez Windows Update et réessayez.
UnsupportedLanguageMode = La session PowerShell s'exécute dans un mode de langue limité.
LoggedInUserNotAdmin = L'utilisateur connecté n'a pas de droits d'administrateur.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = A szkript csak a 64 bites Windows-t támogatja.
UnsupportedOSBuild = A szkript támogatja a Windows 10 22H2 verzióját.
NonLatinUsernameWarning = A PowerShell 5.1 nem fordít kódot, ha a felhasználónév nem latin betűket tartalmaz (beleértve az emojikat is), és kisbetűvel van írva. Kérjük, használja a PowerShell 7-et.
UpdateWarning = Az Ön Windows 10 építése: {0}.{1}. Támogatott buildek: {2}+. Futtassa a Windows Update programot, és próbálja meg újra.
UnsupportedLanguageMode = A PowerShell munkamenet korlátozott nyelvi üzemmódban fut.
LoggedInUserNotAdmin = A bejelentkezett felhasználó nem rendelkezik admin jogokkal.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Lo script supporta solo Windows a 64 bit.
UnsupportedOSBuild = Lo script supporta Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 non compila il codice se il nome utente contiene caratteri non latini (compresi gli emoji) ed è scritto in minuscolo. Si prega di utilizzare PowerShell 7.
UpdateWarning = La tua build di Windows 10 {0}.{1} non è supportata. Build supportate: {2}+. Eseguire Windows Update e riprovare.
UnsupportedLanguageMode = La sessione PowerShell è in esecuzione in modalità lingua limitata.
LoggedInUserNotAdmin = L'utente in suo non ha i diritti di amministratore.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Skrypt obsługuje tylko 64-bitowe systemy Windows.
UnsupportedOSBuild = Skrypt obsługuje system Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 nie kompiluje kodu, jeśli nazwa użytkownika zawiera znaki spoza alfabetu łacińskiego (w tym emoji) i jest zapisana małymi literami. Prosimy o używanie PowerShell 7.
UpdateWarning = Twoja wersja systemu Windows 10: {0}.{1}. Obsługiwane kompilacje: {2}+. Uruchom aktualizację systemu Windows i spróbuj ponownie.
UnsupportedLanguageMode = Sesja PowerShell działa w trybie ograniczonego języka.
LoggedInUserNotAdmin = Zalogowany użytkownik nie posiada uprawnień administratora.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = O guião suporta apenas Windows de 64 bits.
UnsupportedOSBuild = O script suporta versões Windows 10 22H2.
NonLatinUsernameWarning = O PowerShell 5.1 não compilará o código se o nome de usuário contiver caracteres não latinos (inclusive emoji) e estiver escrito em letras minúsculas. Por favor, use o PowerShell 7.
UpdateWarning = La tua build di Windows 10: {0}.{1}. Build suportadas: {2}+. Execute o Windows Update e tente novamente.
UnsupportedLanguageMode = A sessão PowerShell em funcionamento em um modo de linguagem limitada.
LoggedInUserNotAdmin = O usuário logado não tem direitos de administrador.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт поддерживает только 64-битную версию Windows.
UnsupportedOSBuild = Скрипт поддерживает Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 не компилирует код, если имя пользователя содержит нелатинские символы (включая эмодзи) и написано со строчной буквы. Пожалуйста, используйте PowerShell 7.
UpdateWarning = Ваш билд Windows 10: {0}.{1}. Поддерживаемые сборки: {2}+. Запустите обновление Windows и попробуйте заново.
UnsupportedLanguageMode = Сессия PowerShell работает в ограниченном режиме.
LoggedInUserNotAdmin = Текущий вошедший пользователь не обладает правами администратора.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Komut dosyası yalnızca 64 bit Windows'u destekler.
UnsupportedOSBuild = Komut dosyası Windows 10 22H2'u destekler.
NonLatinUsernameWarning = PowerShell 5.1, kullanıcı adı Latin olmayan karakterler içeriyorsa (emoji dahil) ve küçük harfle yazılmışsa kodu derlemez. Lütfen PowerShell 7 kullanın.
UpdateWarning = Windows 10 yapınız: {0}.{1}. Desteklenen yapılar: {2}+. Windows Update'i çalıştırın ve tekrar deneyin.
UnsupportedLanguageMode = Sınırlı bir dil modunda çalışan PowerShell oturumu.
LoggedInUserNotAdmin = Oturum açan kullanıcının yönetici hakları yok.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = Скрипт підтримує тільки 64-розрядну версію Windows.
UnsupportedOSBuild = Скрипт підтримує Windows 10 22H2.
NonLatinUsernameWarning = PowerShell 5.1 не компілює код, якщо ім'я користувача містить нелатинські символи (включно з емодзі) і написане з малої літери. Будь ласка, використовуйте PowerShell 7.
UpdateWarning = Ваш білд Windows 10: {0}.{1}. Підтримувані збірки: {2}+. Запустіть Windows Update і повторіть спробу.
UnsupportedLanguageMode = Сесія PowerShell працює в обмеженому режимі.
LoggedInUserNotAdmin = Поточний користувач, що увійшов, не має прав адміністратора.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
ConvertFrom-StringData -StringData @'
UnsupportedOSBitness = 该脚本仅支持64位Windows。
UnsupportedOSBuild = 该脚本支持Windows 10版本22H2和更高版本。
NonLatinUsernameWarning = 如果用户名包含非拉丁字符(包括表情符号)且以小写字母书写,PowerShell 5.1 将无法编译代码。请使用 PowerShell 7。
UpdateWarning = 您的Windows 10构建: {0}.{1}。支持的构建: {2}+。运行Windows Update并再次尝试。
UnsupportedLanguageMode = PowerShell会话在有限的语言模式下运行。
LoggedInUserNotAdmin = 登录的用户没有管理员的权利。
Expand Down
Loading

0 comments on commit 3e5cbc1

Please sign in to comment.