diff --git a/App.xaml.cs b/App.xaml.cs
index 43005ae..84bb9d6 100644
--- a/App.xaml.cs
+++ b/App.xaml.cs
@@ -1,11 +1,12 @@
using System.Windows;
using System.Windows.Threading;
+using Sheas_Cealer.Wins;
namespace Sheas_Cealer
{
public partial class App : Application
{
- protected override void OnStartup(StartupEventArgs e) => new MainWindow(e.Args).Show();
+ protected override void OnStartup(StartupEventArgs e) => new MainWin(e.Args).Show();
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
diff --git a/Consts/AboutConst.cs b/Consts/AboutConst.cs
new file mode 100644
index 0000000..d8e3b54
--- /dev/null
+++ b/Consts/AboutConst.cs
@@ -0,0 +1,16 @@
+using System.Reflection;
+
+namespace Sheas_Cealer.Consts
+{
+ internal class AboutConst : AboutMultilangConst
+ {
+ public static string Version => Assembly.GetExecutingAssembly().GetName().Version!.ToString()[0..^2];
+ public static string DeveloperButtonUrl => "https://www.spacetimee.xyz";
+ public static string VersionButtonUrl => "https://spacetime.lanzouu.com/b017hp0lc";
+ public static string EmailButtonUrl => "Zeus6_6@163.com";
+ public static string InstructionButtonUrl => "https://github.com/SpaceTimee/Sheas-Cealer/wiki/Sheas-Cealer-Instruction";
+ public static string OpenSourceButtonUrl => "https://github.com/SpaceTimee/Sheas-Cealer";
+ public static string PrivacyButtonUrl => "https://thoughts.teambition.com/share/6264eda98adeb10041b92fda#title=Sheas_Cealer_隐私政策";
+ public static string AgreementButtonUrl => "https://thoughts.teambition.com/share/6264edd78adeb10041b92fdb#title=Sheas_Cealer_使用协议";
+ }
+}
\ No newline at end of file
diff --git a/Consts/AboutMultilangConst.Designer.cs b/Consts/AboutMultilangConst.Designer.cs
new file mode 100644
index 0000000..5ecb36a
--- /dev/null
+++ b/Consts/AboutMultilangConst.Designer.cs
@@ -0,0 +1,126 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace Sheas_Cealer.Consts {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class AboutMultilangConst {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal AboutMultilangConst() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer.Consts.AboutMultilangConst", typeof(AboutMultilangConst).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// 查找类似 ToS. 的本地化字符串。
+ ///
+ public static string AgreementButtonContent {
+ get {
+ return ResourceManager.GetString("AgreementButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Dev. Space Time 的本地化字符串。
+ ///
+ public static string DeveloperButtonContent {
+ get {
+ return ResourceManager.GetString("DeveloperButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Email 的本地化字符串。
+ ///
+ public static string EmailButtonContent {
+ get {
+ return ResourceManager.GetString("EmailButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Docs 的本地化字符串。
+ ///
+ public static string InstructionButtonContent {
+ get {
+ return ResourceManager.GetString("InstructionButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Repo 的本地化字符串。
+ ///
+ public static string OpenSourceButtonContent {
+ get {
+ return ResourceManager.GetString("OpenSourceButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 PP. 的本地化字符串。
+ ///
+ public static string PrivacyButtonContent {
+ get {
+ return ResourceManager.GetString("PrivacyButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Ver. 的本地化字符串。
+ ///
+ public static string VersionButtonContent {
+ get {
+ return ResourceManager.GetString("VersionButtonContent", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/Consts/AboutMultilangConst.resx b/Consts/AboutMultilangConst.resx
new file mode 100644
index 0000000..fac6fad
--- /dev/null
+++ b/Consts/AboutMultilangConst.resx
@@ -0,0 +1,141 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ ToS.
+
+
+ Dev. Space Time
+
+
+ Email
+
+
+ Docs
+
+
+ Repo
+
+
+ PP.
+
+
+ Ver.
+
+
\ No newline at end of file
diff --git a/Consts/AboutMultilangConst.zh.resx b/Consts/AboutMultilangConst.zh.resx
new file mode 100644
index 0000000..41d71d9
--- /dev/null
+++ b/Consts/AboutMultilangConst.zh.resx
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 使用协议
+
+
+ 开发者: Space Time
+
+
+ 联系邮箱
+
+
+ 使用文档
+
+
+ 开源地址
+
+
+ 隐私政策
+
+
+ 版本号:
+
+
\ No newline at end of file
diff --git a/Consts/MainConst.cs b/Consts/MainConst.cs
new file mode 100644
index 0000000..83549a5
--- /dev/null
+++ b/Consts/MainConst.cs
@@ -0,0 +1,21 @@
+using System.Text.RegularExpressions;
+
+namespace Sheas_Cealer.Consts
+{
+ internal partial class MainConst : MainMultilangConst
+ {
+ internal enum Mode
+ { browserPathMode, upstreamUrlMode, extraArgsMode };
+
+ internal static string DefaultUpstreamUrl => "https://gitlab.com/SpaceTimee/Cealing-Host/raw/main/Cealing-Host.json";
+
+ [GeneratedRegex(@"^\r$")]
+ internal static partial Regex HostRegex();
+
+ [GeneratedRegex(@"^((((ht|f)tps?):\/\/)?[a-zA-Z0-9](-*[a-zA-Z0-9])*(\.[a-zA-Z0-9](-*[a-zA-Z0-9])*)*(:\d{1,5})?(\/[a-zA-Z0-9.-_\~\!\$\&\'\(\)\*\+\,\;\=\:\@\%]*)*)?$")]
+ internal static partial Regex UrlRegex();
+
+ [GeneratedRegex(@"^(--[a-z](-?[a-z])*( --[a-z](-?[a-z])*)*)?$")]
+ internal static partial Regex ArgsRegex();
+ }
+}
\ No newline at end of file
diff --git a/Consts/MainMultilangConst.Designer.cs b/Consts/MainMultilangConst.Designer.cs
new file mode 100644
index 0000000..b16c670
--- /dev/null
+++ b/Consts/MainMultilangConst.Designer.cs
@@ -0,0 +1,144 @@
+//------------------------------------------------------------------------------
+//
+// 此代码由工具生成。
+// 运行时版本:4.0.30319.42000
+//
+// 对此文件的更改可能会导致不正确的行为,并且如果
+// 重新生成代码,这些更改将会丢失。
+//
+//------------------------------------------------------------------------------
+
+namespace Sheas_Cealer.Consts {
+ using System;
+
+
+ ///
+ /// 一个强类型的资源类,用于查找本地化的字符串等。
+ ///
+ // 此类是由 StronglyTypedResourceBuilder
+ // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
+ // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
+ // (以 /str 作为命令选项),或重新生成 VS 项目。
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
+ public class MainMultilangConst {
+
+ private static global::System.Resources.ResourceManager resourceMan;
+
+ private static global::System.Globalization.CultureInfo resourceCulture;
+
+ [global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
+ internal MainMultilangConst() {
+ }
+
+ ///
+ /// 返回此类使用的缓存的 ResourceManager 实例。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Resources.ResourceManager ResourceManager {
+ get {
+ if (object.ReferenceEquals(resourceMan, null)) {
+ global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer.Consts.MainMultilangConst", typeof(MainMultilangConst).Assembly);
+ resourceMan = temp;
+ }
+ return resourceMan;
+ }
+ }
+
+ ///
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
+ ///
+ [global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
+ public static global::System.Globalization.CultureInfo Culture {
+ get {
+ return resourceCulture;
+ }
+ set {
+ resourceCulture = value;
+ }
+ }
+
+ ///
+ /// 查找类似 About Me 的本地化字符串。
+ ///
+ public static string AboutButtonContent {
+ get {
+ return ResourceManager.GetString("AboutButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Browse 的本地化字符串。
+ ///
+ public static string BrowseButtonContent {
+ get {
+ return ResourceManager.GetString("BrowseButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 (Fill in the path of a Chromium-based browser) 的本地化字符串。
+ ///
+ public static string BrowserPathPlaceHolder {
+ get {
+ return ResourceManager.GetString("BrowserPathPlaceHolder", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Edit Host 的本地化字符串。
+ ///
+ public static string EditHostButtonContent {
+ get {
+ return ResourceManager.GetString("EditHostButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 (fill in extra Chromium startup arguments) 的本地化字符串。
+ ///
+ public static string ExtraArgsPlaceHolder {
+ get {
+ return ResourceManager.GetString("ExtraArgsPlaceHolder", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Start Cealing 的本地化字符串。
+ ///
+ public static string StartCealButtonContent {
+ get {
+ return ResourceManager.GetString("StartCealButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Switch 的本地化字符串。
+ ///
+ public static string SwitchModeButtonContent {
+ get {
+ return ResourceManager.GetString("SwitchModeButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 Update Host 的本地化字符串。
+ ///
+ public static string UpdateHostButtonContent {
+ get {
+ return ResourceManager.GetString("UpdateHostButtonContent", resourceCulture);
+ }
+ }
+
+ ///
+ /// 查找类似 (Fill in the link to an upstream Cealing Host) 的本地化字符串。
+ ///
+ public static string UpstreamUrlPlaceHolder {
+ get {
+ return ResourceManager.GetString("UpstreamUrlPlaceHolder", resourceCulture);
+ }
+ }
+ }
+}
diff --git a/Consts/MainMultilangConst.resx b/Consts/MainMultilangConst.resx
new file mode 100644
index 0000000..2a35480
--- /dev/null
+++ b/Consts/MainMultilangConst.resx
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 1.3
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ About Me
+
+
+ Browse
+
+
+ (Fill in the path of a Chromium-based browser)
+
+
+ Edit Host
+
+
+ (fill in extra Chromium startup arguments)
+
+
+ Switch
+
+
+ Start Cealing
+
+
+ Update Host
+
+
+ (Fill in the link to an upstream Cealing Host)
+
+
\ No newline at end of file
diff --git a/Consts/MainMultilangConst.zh.resx b/Consts/MainMultilangConst.zh.resx
new file mode 100644
index 0000000..6757cf8
--- /dev/null
+++ b/Consts/MainMultilangConst.zh.resx
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ text/microsoft-resx
+
+
+ 2.0
+
+
+ System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ 关于项目
+
+
+ 浏览
+
+
+ (填入任意以 Chromium 为内核的浏览器的路径)
+
+
+ 编辑规则
+
+
+ (填入任意额外的 Chromium 启动参数)
+
+
+ 切换
+
+
+ 启动伪造
+
+
+ 更新规则
+
+
+ (填入任意上游伪造规则的链接)
+
+
\ No newline at end of file
diff --git a/Convs/AboutVersionButtonContentConv.cs b/Convs/AboutVersionButtonContentConv.cs
new file mode 100644
index 0000000..01e9a4e
--- /dev/null
+++ b/Convs/AboutVersionButtonContentConv.cs
@@ -0,0 +1,22 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+
+namespace Sheas_Cealer.Convs
+{
+ internal class AboutVersionButtonContentConv : IMultiValueConverter
+ {
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ string? VersionButtonContent = values[0] as string;
+ string? version = values[1] as string;
+
+ return VersionButtonContent + version;
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Convs/MainContentBoxForegroundConv.cs b/Convs/MainContentBoxForegroundConv.cs
new file mode 100644
index 0000000..ea6aa5b
--- /dev/null
+++ b/Convs/MainContentBoxForegroundConv.cs
@@ -0,0 +1,48 @@
+using System;
+using System.Globalization;
+using System.Windows.Data;
+using System.Windows.Media;
+using Sheas_Cealer.Consts;
+
+namespace Sheas_Cealer.Convs
+{
+ internal class MainContentBoxForegroundConv : IMultiValueConverter
+ {
+ private static readonly MainConst MainConst = new();
+
+ public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
+ {
+ MainConst.Mode? mode = values[0] as MainConst.Mode?;
+ bool? isFocused = values[1] as bool?;
+ string? browserPath = values[2] as string;
+ string? upstreamUrl = values[3] as string;
+ string? extraArgs = values[4] as string;
+
+ if (!(bool)isFocused!)
+ {
+ switch (mode)
+ {
+ case MainConst.Mode.browserPathMode:
+ if (browserPath == MainConst.BrowserPathPlaceHolder)
+ return new SolidColorBrush(Color.FromRgb(191, 205, 219));
+ break;
+ case MainConst.Mode.upstreamUrlMode:
+ if (upstreamUrl == MainConst.UpstreamUrlPlaceHolder)
+ return new SolidColorBrush(Color.FromRgb(191, 205, 219));
+ break;
+ case MainConst.Mode.extraArgsMode:
+ if (extraArgs == MainConst.ExtraArgsPlaceHolder)
+ return new SolidColorBrush(Color.FromRgb(191, 205, 219));
+ break;
+ }
+ }
+
+ return new SolidColorBrush(Color.FromRgb(0, 0, 0));
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Convs/MainContentBoxTextConv.cs b/Convs/MainContentBoxTextConv.cs
new file mode 100644
index 0000000..d21d6ca
--- /dev/null
+++ b/Convs/MainContentBoxTextConv.cs
@@ -0,0 +1,57 @@
+using System;
+using System.Windows.Data;
+using Sheas_Cealer.Consts;
+
+namespace Sheas_Cealer.Convs
+{
+ internal class MainContentBoxTextConv : IMultiValueConverter
+ {
+ private static readonly MainConst MainConst = new();
+
+ public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
+ {
+ MainConst.Mode? mode = values[0] as MainConst.Mode?;
+ bool? isFocused = values[1] as bool?;
+ string? browserPath = values[2] as string;
+ string? upstreamUrl = values[3] as string;
+ string? extraArgs = values[4] as string;
+
+ if (mode == MainConst.Mode.browserPathMode)
+ {
+ if((bool)!isFocused! && string.IsNullOrEmpty(browserPath))
+ return MainConst.BrowserPathPlaceHolder;
+ else if((bool)isFocused! && browserPath == MainConst.BrowserPathPlaceHolder)
+ return string.Empty;
+ else
+ return browserPath!;
+ }
+ else if (mode == MainConst.Mode.upstreamUrlMode)
+ {
+ if ((bool)!isFocused! && string.IsNullOrEmpty(upstreamUrl))
+ return MainConst.UpstreamUrlPlaceHolder;
+ else if ((bool)isFocused! && upstreamUrl == MainConst.UpstreamUrlPlaceHolder)
+ return string.Empty;
+ else
+ return upstreamUrl!;
+ }
+ else if (mode == MainConst.Mode.extraArgsMode)
+ {
+ if ((bool)!isFocused! && string.IsNullOrEmpty(extraArgs))
+ return MainConst.ExtraArgsPlaceHolder;
+ else if ((bool)isFocused! && extraArgs == MainConst.ExtraArgsPlaceHolder)
+ return string.Empty;
+ else
+ return extraArgs!;
+ }
+ else
+ {
+ throw new Exception("Invalid mode");
+ }
+ }
+
+ public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture)
+ {
+ throw new NotImplementedException();
+ }
+ }
+}
\ No newline at end of file
diff --git a/Preses/MainPres.cs b/Preses/MainPres.cs
new file mode 100644
index 0000000..10f0689
--- /dev/null
+++ b/Preses/MainPres.cs
@@ -0,0 +1,65 @@
+using System.IO;
+using CommunityToolkit.Mvvm.ComponentModel;
+using Sheas_Cealer.Consts;
+using File = System.IO.File;
+
+namespace Sheas_Cealer.Preses
+{
+ internal partial class MainPres : ObservableObject
+ {
+ private static readonly MainConst MainConst = new();
+
+ internal MainPres(string[] args)
+ {
+ if (args.Length > 0)
+ BrowserPath = args[0];
+ else if (!string.IsNullOrWhiteSpace(Props.Settings.Default.BrowserPath))
+ BrowserPath = Props.Settings.Default.BrowserPath;
+
+ if (!string.IsNullOrWhiteSpace(Props.Settings.Default.UpstreamUrl))
+ UpstreamUrl = Props.Settings.Default.UpstreamUrl;
+
+ if (!string.IsNullOrWhiteSpace(Props.Settings.Default.ExtraArgs))
+ ExtraArgs = Props.Settings.Default.ExtraArgs;
+ }
+
+ [ObservableProperty]
+ private MainConst.Mode mode = MainConst.Mode.browserPathMode;
+
+ [ObservableProperty]
+ private bool isContentBoxFocused = true;
+
+ [ObservableProperty]
+ private string browserPath = string.Empty;
+ partial void OnBrowserPathChanged(string value)
+ {
+ if (File.Exists(value) && Path.GetFileName(value).ToLower().EndsWith(".exe"))
+ {
+ Props.Settings.Default.BrowserPath = value;
+ Props.Settings.Default.Save();
+ }
+ }
+
+ [ObservableProperty]
+ private string upstreamUrl = MainConst.DefaultUpstreamUrl;
+ partial void OnUpstreamUrlChanged(string value)
+ {
+ if (MainConst.UrlRegex().IsMatch(value))
+ {
+ Props.Settings.Default.UpstreamUrl = value;
+ Props.Settings.Default.Save();
+ }
+ }
+
+ [ObservableProperty]
+ private string extraArgs = string.Empty;
+ partial void OnExtraArgsChanged(string value)
+ {
+ if (MainConst.ArgsRegex().IsMatch(value))
+ {
+ Props.Settings.Default.ExtraArgs = value;
+ Props.Settings.Default.Save();
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Properties/AssemblyInfo.cs b/Props/AssemblyInfo.cs
similarity index 100%
rename from Properties/AssemblyInfo.cs
rename to Props/AssemblyInfo.cs
diff --git a/Properties/Settings.Designer.cs b/Props/Settings.Designer.cs
similarity index 61%
rename from Properties/Settings.Designer.cs
rename to Props/Settings.Designer.cs
index 19cb3d4..4166d68 100644
--- a/Properties/Settings.Designer.cs
+++ b/Props/Settings.Designer.cs
@@ -8,11 +8,11 @@
//
//------------------------------------------------------------------------------
-namespace Sheas_Cealer.Properties {
+namespace Sheas_Cealer.Props {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
- [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.1.0.0")]
+ [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.10.0.0")]
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
@@ -34,5 +34,29 @@ namespace Sheas_Cealer.Properties {
this["BrowserPath"] = value;
}
}
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string UpstreamUrl {
+ get {
+ return ((string)(this["UpstreamUrl"]));
+ }
+ set {
+ this["UpstreamUrl"] = value;
+ }
+ }
+
+ [global::System.Configuration.UserScopedSettingAttribute()]
+ [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
+ [global::System.Configuration.DefaultSettingValueAttribute("")]
+ public string ExtraArgs {
+ get {
+ return ((string)(this["ExtraArgs"]));
+ }
+ set {
+ this["ExtraArgs"] = value;
+ }
+ }
}
}
diff --git a/Properties/Settings.settings b/Props/Settings.settings
similarity index 54%
rename from Properties/Settings.settings
rename to Props/Settings.settings
index 30558fa..ae75391 100644
--- a/Properties/Settings.settings
+++ b/Props/Settings.settings
@@ -1,9 +1,15 @@
-
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Sheas-Cealer.csproj b/Sheas-Cealer.csproj
index db004ea..11e2211 100644
--- a/Sheas-Cealer.csproj
+++ b/Sheas-Cealer.csproj
@@ -21,7 +21,7 @@
git
Copyright © 2077
WinExe
- net8.0-windows10.0.22000.0
+ net8.0-windows10.0.22621.0
10.0.17763.0
Sheas_Cealer
enable
@@ -31,6 +31,7 @@
True
none
true
+ Props
@@ -72,6 +73,7 @@
+
@@ -86,15 +88,36 @@
-
+
+ True
+ True
+ AboutMultilangConst.resx
+
+
True
True
Settings.settings
+
+ True
+ True
+ MainMultilangConst.resx
+
-
+
+ PublicResXFileCodeGenerator
+ AboutMultilangConst.Designer.cs
+
+
+ PublicResXFileCodeGenerator
+ MainMultilangConst.Designer.cs
+
+
+
+
+
SettingsSingleFileGenerator
Settings.Designer.cs
diff --git a/Sheas-Cealer.sln b/Sheas-Cealer.sln
index 8158f2f..cc9fcad 100644
--- a/Sheas-Cealer.sln
+++ b/Sheas-Cealer.sln
@@ -32,6 +32,12 @@ Global
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
+ RESX_DuplicateKeyHandling = Fail
+ RESX_AutoCreateNewLanguageFiles = True
+ RESX_ConfirmAddLanguageFile = True
+ RESX_NeutralResourcesLanguage = en-US
SolutionGuid = {33005A8D-2D3D-4101-AFF0-F68B29FE9B28}
+ RESX_SortFileContentOnSave = True
+ RESX_Rules = {"EnabledRules":["StringFormat","WhiteSpaceLead","WhiteSpaceTail","PunctuationLead"]}
EndGlobalSection
EndGlobal
diff --git a/Utilities/Command.cs b/Utils/Command.cs
similarity index 94%
rename from Utilities/Command.cs
rename to Utils/Command.cs
index 31a998f..8d6ba35 100644
--- a/Utilities/Command.cs
+++ b/Utils/Command.cs
@@ -2,7 +2,7 @@
using System.Diagnostics;
using SheasCore;
-namespace Sheas_Cealer
+namespace Sheas_Cealer.Utils
{
internal class Command : Proc
{
diff --git a/Utils/FocusExtension.cs b/Utils/FocusExtension.cs
new file mode 100644
index 0000000..d1ba1ae
--- /dev/null
+++ b/Utils/FocusExtension.cs
@@ -0,0 +1,66 @@
+using System;
+using System.Windows;
+
+namespace Sheas_Cealer.Utils
+{
+ public static class FocusExtension
+ {
+ public static readonly DependencyProperty IsFocusedProperty =
+ DependencyProperty.RegisterAttached("IsFocused", typeof(bool?), typeof(FocusExtension), new FrameworkPropertyMetadata(IsFocusedChanged) { BindsTwoWayByDefault = true });
+
+ public static bool? GetIsFocused(DependencyObject element)
+ {
+ ArgumentNullException.ThrowIfNull(element);
+
+ return (bool?)element.GetValue(IsFocusedProperty);
+ }
+
+ public static void SetIsFocused(DependencyObject element, bool? value)
+ {
+ ArgumentNullException.ThrowIfNull(element);
+
+ element.SetValue(IsFocusedProperty, value);
+ }
+
+ private static void IsFocusedChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ var fe = (FrameworkElement)d;
+
+ if (e.OldValue == null)
+ {
+ fe.GotFocus += FrameworkElement_GotFocus;
+ fe.LostFocus += FrameworkElement_LostFocus;
+ }
+
+ if (!fe.IsVisible)
+ {
+ fe.IsVisibleChanged += new DependencyPropertyChangedEventHandler(fe_IsVisibleChanged);
+ }
+
+ if (e.NewValue != null && (bool)e.NewValue)
+ {
+ fe.Focus();
+ }
+ }
+
+ private static void fe_IsVisibleChanged(object sender, DependencyPropertyChangedEventArgs e)
+ {
+ var fe = (FrameworkElement)sender;
+ if (fe.IsVisible && (bool)fe.GetValue(IsFocusedProperty))
+ {
+ fe.IsVisibleChanged -= fe_IsVisibleChanged;
+ fe.Focus();
+ }
+ }
+
+ private static void FrameworkElement_GotFocus(object sender, RoutedEventArgs e)
+ {
+ ((FrameworkElement)sender).SetValue(IsFocusedProperty, true);
+ }
+
+ private static void FrameworkElement_LostFocus(object sender, RoutedEventArgs e)
+ {
+ ((FrameworkElement)sender).SetValue(IsFocusedProperty, false);
+ }
+ }
+}
diff --git a/Utilities/IconRemover.cs b/Utils/IconRemover.cs
similarity index 82%
rename from Utilities/IconRemover.cs
rename to Utils/IconRemover.cs
index a141cf3..be4cbe6 100644
--- a/Utilities/IconRemover.cs
+++ b/Utils/IconRemover.cs
@@ -2,10 +2,11 @@
using System.Runtime.InteropServices;
using System.Windows;
using System.Windows.Interop;
+using Sheas_Cealer.Utils;
-namespace Sheas_Cealer
+namespace Sheas_Cealer.Utils
{
- //定义IconRemover
+ // 定义IconRemover
internal static partial class IconRemover
{
private const int GWL_EXSTYLE = -20;
@@ -28,27 +29,30 @@ namespace Sheas_Cealer
internal static void RemoveIcon(Window window)
{
- //获取该窗口句柄
+ // 获取该窗口句柄
IntPtr hwnd = new WindowInteropHelper(window).Handle;
- //将窗口更改为不显示窗口图标
+ // 将窗口更改为不显示窗口图标
_ = SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_DLGMODALFRAME);
- //更新窗口的非客户区域来显示更改
+ // 更新窗口的非客户区域来显示更改
SetWindowPos(hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED);
- //防止自定义图标生效
+ // 防止自定义图标生效
SendMessage(hwnd, WM_SETICON, new IntPtr(1), IntPtr.Zero);
SendMessage(hwnd, WM_SETICON, IntPtr.Zero, IntPtr.Zero);
}
}
+}
- //使用IconRemover
- public partial class MainWindow
+namespace Sheas_Cealer.Wins
+{
+ // 使用IconRemover
+ public partial class MainWin
{
protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this);
}
- public partial class AboutWindow
+ public partial class AboutWin
{
protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this);
}
diff --git a/Windows/AboutWindow.xaml b/Windows/AboutWindow.xaml
deleted file mode 100644
index 7a604a5..0000000
--- a/Windows/AboutWindow.xaml
+++ /dev/null
@@ -1,31 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Windows/MainWindow.xaml b/Windows/MainWindow.xaml
deleted file mode 100644
index adc639f..0000000
--- a/Windows/MainWindow.xaml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Wins/AboutWin.xaml b/Wins/AboutWin.xaml
new file mode 100644
index 0000000..baf51a8
--- /dev/null
+++ b/Wins/AboutWin.xaml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Windows/AboutWindow.xaml.cs b/Wins/AboutWin.xaml.cs
similarity index 57%
rename from Windows/AboutWindow.xaml.cs
rename to Wins/AboutWin.xaml.cs
index 85f1507..3af7ba1 100644
--- a/Windows/AboutWindow.xaml.cs
+++ b/Wins/AboutWin.xaml.cs
@@ -1,25 +1,23 @@
using System.Diagnostics;
-using System.Reflection;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-namespace Sheas_Cealer
+namespace Sheas_Cealer.Wins
{
- public partial class AboutWindow : Window
+ public partial class AboutWin : Window
{
- internal AboutWindow()
+ internal AboutWin()
{
InitializeComponent();
}
- private void AboutWin_Loaded(object sender, RoutedEventArgs e) => UpdateButton.Content = "版本号: " + Assembly.GetExecutingAssembly().GetName().Version!.ToString()[0..^2];
private void AboutButton_Click(object sender, RoutedEventArgs e)
{
- if (sender == UpdateButton)
+ if (sender == VersionButton)
MessageBox.Show("密码: 3wnj");
- ProcessStartInfo processStartInfo = new(sender == EmailButton ? "mailto:" : string.Empty + ((Button)sender).ToolTip) { UseShellExecute = true };
+ ProcessStartInfo processStartInfo = new(sender == EmailButton ? "mailto:" : string.Empty + (sender as Button)!.ToolTip) { UseShellExecute = true };
Process.Start(processStartInfo);
}
diff --git a/Wins/MainWin.xaml b/Wins/MainWin.xaml
new file mode 100644
index 0000000..a1a3a8e
--- /dev/null
+++ b/Wins/MainWin.xaml
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Windows/MainWindow.xaml.cs b/Wins/MainWin.xaml.cs
similarity index 54%
rename from Windows/MainWindow.xaml.cs
rename to Wins/MainWin.xaml.cs
index def6aee..5408a70 100644
--- a/Windows/MainWindow.xaml.cs
+++ b/Wins/MainWin.xaml.cs
@@ -3,79 +3,45 @@ using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Net.Http;
-using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
-using System.Windows.Media;
-using System.Windows.Threading;
using IWshRuntimeLibrary;
using Microsoft.Win32;
using Newtonsoft.Json.Linq;
using OnaCore;
+using Sheas_Cealer.Consts;
+using Sheas_Cealer.Preses;
+using Sheas_Cealer.Utils;
using File = System.IO.File;
-namespace Sheas_Cealer
+namespace Sheas_Cealer.Wins
{
- public partial class MainWindow : Window
+ public partial class MainWin : Window
{
- private readonly HttpClient MAIN_CLIENT = new(); //当前窗口使用的唯一的 HttpClient
- private static readonly FileSystemWatcher CEALING_HOST_WATCHER = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
- [GeneratedRegex(@"\r")] private static partial Regex HOST_REGEX();
- private static string? CEALING_ARGUMENT;
+ private static string CealArgs = string.Empty;
+ private static readonly HttpClient MainClient = new();
+ private static readonly FileSystemWatcher CealingHostWatcher = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
+ private static MainPres? MainPres;
+ private static readonly MainConst MainConst = new();
- internal MainWindow(string[] args)
+ internal MainWin(string[] args)
{
InitializeComponent();
+ MainPres = new(args);
+ DataContext = MainPres;
+
Task.Run(() =>
{
- if (args.Length > 0)
- Dispatcher.Invoke(() => PathBox.Text = args[0]);
- else if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.BrowserPath))
- Dispatcher.Invoke(() => PathBox.Text = Properties.Settings.Default.BrowserPath);
-
- CEALING_HOST_WATCHER.Changed += CEALING_HOST_WATCHER_Changed;
- CEALING_HOST_WATCHER_Changed(null!, null!);
+ CealingHostWatcher.Changed += CealingHostWatcher_Changed;
+ CealingHostWatcher_Changed(null!, null!);
});
}
- private void MainWin_Loaded(object sender, RoutedEventArgs e) => PathBox.Focus();
+ private void MainWin_Loaded(object sender, RoutedEventArgs e) => MainPres!.IsContentBoxFocused = true;
private void MainWin_Closing(object sender, CancelEventArgs e) => Environment.Exit(0);
- private void PathBox_GotFocus(object sender, RoutedEventArgs e)
- {
- if (PathBox.Foreground != Foreground)
- {
- //PlaceHold状态
- PathBox.Text = string.Empty;
- PathBox.Foreground = Foreground;
- }
- }
- private void PathBox_LostFocus(object sender, RoutedEventArgs e)
- {
- if (string.IsNullOrEmpty(PathBox.Text))
- {
- PathBox.Text = "(填入任意以 Chromium 为内核的浏览器的路径)";
- PathBox.Foreground = new SolidColorBrush(Color.FromRgb(191, 205, 219));
- }
- }
- private void PathBox_TextChanged(object sender, TextChangedEventArgs e)
- {
- if (StartButton == null)
- return;
-
- if (File.Exists(PathBox.Text) && Path.GetFileName(PathBox.Text).EndsWith(".exe"))
- {
- StartButton.IsEnabled = true;
-
- Properties.Settings.Default.BrowserPath = PathBox.Text;
- Properties.Settings.Default.Save();
- }
- else
- StartButton.IsEnabled = false;
- }
-
private void MainWin_DragEnter(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
@@ -88,73 +54,101 @@ namespace Sheas_Cealer
private void MainWin_Drop(object sender, DragEventArgs e)
{
if (e.Data.GetDataPresent(DataFormats.FileDrop))
- PathBox.Text = ((string[])e.Data.GetData(DataFormats.FileDrop))[0];
+ MainPres!.BrowserPath = ((string[])e.Data.GetData(DataFormats.FileDrop))[0];
}
+ private void ContentBox_TextChanged(object sender, TextChangedEventArgs e)
+ {
+ TextBox? ContentBox = sender as TextBox;
+
+ switch (MainPres!.Mode)
+ {
+ case MainConst.Mode.browserPathMode:
+ MainPres.BrowserPath = ContentBox!.Text;
+ return;
+ case MainConst.Mode.upstreamUrlMode:
+ MainPres.UpstreamUrl = ContentBox!.Text;
+ return;
+ case MainConst.Mode.extraArgsMode:
+ MainPres.ExtraArgs = ContentBox!.Text;
+ return;
+ };
+ }
private void BrowseButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
if (openFileDialog.ShowDialog() == true)
{
- PathBox.Focus();
- PathBox.Text = openFileDialog.FileName;
+ MainPres!.IsContentBoxFocused = true;
+ MainPres!.BrowserPath = openFileDialog.FileName;
}
}
-
- private void StartButton_Click(object sender, RoutedEventArgs e)
+ private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
{
- if (string.IsNullOrWhiteSpace(CEALING_ARGUMENT))
+ if (MainPres!.Mode == MainConst.Mode.browserPathMode)
+ MainPres!.Mode = MainConst.Mode.upstreamUrlMode;
+ else if (MainPres!.Mode == MainConst.Mode.upstreamUrlMode)
+ MainPres!.Mode = MainConst.Mode.extraArgsMode;
+ else if (MainPres!.Mode == MainConst.Mode.extraArgsMode)
+ MainPres!.Mode = MainConst.Mode.browserPathMode;
+ }
+
+ private void StartCealButton_Click(object sender, RoutedEventArgs e)
+ {
+ if (string.IsNullOrWhiteSpace(CealArgs))
throw new Exception("规则无法识别,请检查伪造规则是否含有语法错误");
if (MessageBox.Show("启动前将关闭所选浏览器的所有进程,是否继续?", string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
IWshShortcut uncealedBrowserShortcut = (IWshShortcut)new WshShell().CreateShortcut(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Uncealed-Browser.lnk"));
- uncealedBrowserShortcut.TargetPath = PathBox.Text;
+ uncealedBrowserShortcut.TargetPath = MainPres!.BrowserPath;
uncealedBrowserShortcut.Description = "Created By Sheas Cealer";
uncealedBrowserShortcut.Save();
- foreach (Process browserProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(PathBox.Text)))
+ foreach (Process browserProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainPres!.BrowserPath)))
{
browserProcess.Kill();
browserProcess.WaitForExit();
}
- new Command().ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, CEALING_ARGUMENT);
+ new Command().ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, CealArgs + " " + MainPres!.ExtraArgs);
}
- private void HostEditButton_Click(object sender, RoutedEventArgs e)
+ private void EditHostButton_Click(object sender, RoutedEventArgs e)
{
ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json")) { UseShellExecute = true };
Process.Start(processStartInfo);
}
- private async void HostUpdateButton_Click(object sender, RoutedEventArgs e)
+ private async void UpdateHostButton_Click(object sender, RoutedEventArgs e)
{
- const string hostUrl = @"https://gitlab.com/SpaceTimee/Cealing-Host/raw/main/Cealing-Host.json";
+ string hostUrl = MainPres!.UpstreamUrl;
- string hostUpdateString = await Http.GetAsync(hostUrl, MAIN_CLIENT);
+ string UpdateHostString = await Http.GetAsync(hostUrl, MainClient);
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
string hostLocalString = hostLocalStreamReader.ReadToEnd();
hostLocalStreamReader.Close();
- if (HOST_REGEX().Replace(hostLocalString, string.Empty) == hostUpdateString)
+ if (MainConst.HostRegex().Replace(hostLocalString, string.Empty) == UpdateHostString)
MessageBox.Show("本地伪造规则和上游一模一样");
else
{
- MessageBoxResult overrideResult = MessageBox.Show("本地伪造规则和上游略有不同,需要覆盖本地吗? 否则只为你打开上游规则的网页", "", MessageBoxButton.YesNoCancel);
+ MessageBoxResult overrideResult = MessageBox.Show("本地伪造规则和上游略有不同,需要覆盖本地吗? 否则只为你打开上游规则的网页", string.Empty, MessageBoxButton.YesNoCancel);
if (overrideResult == MessageBoxResult.Yes)
{
- File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"), hostUpdateString);
+ File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"), UpdateHostString);
MessageBox.Show("更新已完成");
}
else if (overrideResult == MessageBoxResult.No)
Process.Start(new ProcessStartInfo(hostUrl) { UseShellExecute = true });
}
}
+ private void AboutButton_Click(object sender, RoutedEventArgs e)
+ {
+ new AboutWin().ShowDialog();
+ }
- private void AboutButton_Click(object sender, RoutedEventArgs e) => new AboutWindow().ShowDialog();
-
- private void CEALING_HOST_WATCHER_Changed(object sender, FileSystemEventArgs e)
+ private void CealingHostWatcher_Changed(object sender, FileSystemEventArgs e)
{
try
{
@@ -168,18 +162,21 @@ namespace Sheas_Cealer
if (string.IsNullOrWhiteSpace(hostJToken[1]!.ToString()))
hostJToken[1] = "c" + ruleIndex;
- hostResolverRules += "MAP " + hostJToken[1]!.ToString() + " " + hostJToken[2]!.ToString() + ",";
foreach (var hostName in hostJToken[0]!)
- hostRules += "MAP " + hostName.ToString() + " " + hostJToken[1] + ",";
+ {
+ if (hostName != hostJToken[1])
+ hostRules += "MAP " + hostName + " " + hostJToken[1] + ",";
+ }
+
+ hostResolverRules += "MAP " + hostJToken[1] + " " + hostJToken[2] + ",";
++ruleIndex;
}
- CEALING_ARGUMENT = @"/c @start .\""Uncealed-Browser.lnk"" --host-rules=""" + hostRules[0..^1] + @""" --host-resolver-rules=""" + hostResolverRules[0..^1] + @""" --test-type --ignore-certificate-errors";
+ CealArgs = @"/c @start .\""Uncealed-Browser.lnk"" --host-rules=""" + hostRules[0..^1] + @""" --host-resolver-rules=""" + hostResolverRules[0..^1] + @""" --ignore-certificate-errors " + MainPres!.ExtraArgs;
}
- catch { CEALING_ARGUMENT = string.Empty; }
+ catch { CealArgs = string.Empty; }
}
-
private void MainWin_KeyDown(object sender, KeyEventArgs e)
{
if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.W)