diff --git a/Consts/MainConst.cs b/Consts/MainConst.cs index f854f8a..faf8ae0 100644 --- a/Consts/MainConst.cs +++ b/Consts/MainConst.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +using System.Security.Principal; +using System.Text.RegularExpressions; namespace Sheas_Cealer.Consts; @@ -7,6 +8,8 @@ internal partial class MainConst : MainMultilangConst internal enum SettingsMode { BrowserPathMode, UpstreamUrlMode, ExtraArgsMode }; + public static bool IsAdmin => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); + internal static string DefaultUpstreamUrl => "https://gitlab.com/SpaceTimee/Cealing-Host/raw/main/Cealing-Host.json"; [GeneratedRegex(@"^(https?:\/\/)?[a-zA-Z0-9](-*[a-zA-Z0-9])*(\.[a-zA-Z0-9](-*[a-zA-Z0-9])*)*(:\d{1,5})?(\/[a-zA-Z0-9.\-_\~\!\$\&\'\(\)\*\+\,\;\=\:\@\%]*)*$")] diff --git a/Consts/MainMultilangConst.Designer.cs b/Consts/MainMultilangConst.Designer.cs index df1e798..1214bce 100644 --- a/Consts/MainMultilangConst.Designer.cs +++ b/Consts/MainMultilangConst.Designer.cs @@ -186,6 +186,24 @@ namespace Sheas_Cealer.Consts { } } + /// + /// 查找类似 Start Proxy 的本地化字符串。 + /// + public static string ProxyButtonContent { + get { + return ResourceManager.GetString("ProxyButtonContent", resourceCulture); + } + } + + /// + /// 查找类似 Click to launch a local proxy 的本地化字符串。 + /// + public static string ProxyButtonToolTip { + get { + return ResourceManager.GetString("ProxyButtonToolTip", resourceCulture); + } + } + /// /// 查找类似 Fill in a Chromium-based browser path 的本地化字符串。 /// diff --git a/Consts/MainMultilangConst.resx b/Consts/MainMultilangConst.resx index 36a300a..a2f702b 100644 --- a/Consts/MainMultilangConst.resx +++ b/Consts/MainMultilangConst.resx @@ -141,6 +141,12 @@ Extra Args + + Start Proxy + + + Click to launch a local proxy + Fill in a Chromium-based browser path @@ -198,9 +204,6 @@ The args cannot be recognized, check if the hosts contain syntax errors - - Upstream host has been updated to the latest - All processes of the selected browser will be closed before launching, do you want to continue? @@ -210,4 +213,7 @@ Update successfully + + Upstream host has been updated to the latest + \ No newline at end of file diff --git a/Consts/MainMultilangConst.zh.resx b/Consts/MainMultilangConst.zh.resx index a43684d..da56feb 100644 --- a/Consts/MainMultilangConst.zh.resx +++ b/Consts/MainMultilangConst.zh.resx @@ -141,6 +141,12 @@ 额外参数 + + 启动代理 + + + 点击启动本地代理 + 填入任意以 Chromium 为内核的浏览器路径 @@ -198,9 +204,6 @@ 规则无法识别,请检查伪造规则中是否含有语法错误 - - 上游规则已经更到最新了 - 启动前将关闭所选浏览器的所有进程,是否继续? @@ -210,4 +213,7 @@ 更新已完成 + + 上游规则已经更到最新了 + \ No newline at end of file diff --git a/Preses/MainPres.cs b/Preses/MainPres.cs index fb37afb..84bc5b1 100644 --- a/Preses/MainPres.cs +++ b/Preses/MainPres.cs @@ -17,7 +17,7 @@ internal partial class MainPres : ObservableObject int upstreamUrlIndex = Array.FindIndex(args, arg => arg.Equals("-u", StringComparison.OrdinalIgnoreCase)) + 1; int extraArgsIndex = Array.FindIndex(args, arg => arg.Equals("-e", StringComparison.OrdinalIgnoreCase)) + 1; - BrowserPath = browserPathIndex != 0 && browserPathIndex != args.Length ?args[browserPathIndex]: + BrowserPath = browserPathIndex != 0 && browserPathIndex != args.Length ? args[browserPathIndex] : !string.IsNullOrWhiteSpace(Settings.Default.BrowserPath) ? Settings.Default.BrowserPath : (Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe", string.Empty, null) ?? Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", string.Empty, null) ?? diff --git a/Sheas-Cealer.csproj b/Sheas-Cealer.csproj index c82449d..a0db81e 100644 --- a/Sheas-Cealer.csproj +++ b/Sheas-Cealer.csproj @@ -21,9 +21,9 @@ git Copyright © 2077 WinExe - net8.0-windows10.0.22621.0 + net8.0-windows10.0.26100.0 10.0.17763.0 - 10.0.22621.41 + 10.0.26100.41 Sheas_Cealer enable true diff --git a/Wins/MainWin.xaml b/Wins/MainWin.xaml index 328843d..c9b80df 100644 --- a/Wins/MainWin.xaml +++ b/Wins/MainWin.xaml @@ -76,20 +76,31 @@ - + @@ -102,8 +113,7 @@