1.1.0 -> 1.1.1 第7次更新

This commit is contained in:
Space Time 2024-05-18 20:39:36 +08:00
parent 9c44edfed9
commit 353d5ec8cf
11 changed files with 251 additions and 225 deletions

View File

@ -69,15 +69,6 @@ namespace Sheas_Cealer.Consts {
}
}
/// <summary>
/// 查找类似 (Fill in the path of a Chromium-based browser) 的本地化字符串。
/// </summary>
public static string BrowserPathPlaceHolder {
get {
return ResourceManager.GetString("BrowserPathPlaceHolder", resourceCulture);
}
}
/// <summary>
/// 查找类似 Edit Host 的本地化字符串。
/// </summary>
@ -88,38 +79,83 @@ namespace Sheas_Cealer.Consts {
}
/// <summary>
/// 查找类似 (fill in extra Chromium startup arguments) 的本地化字符串。
/// 查找类似 (Fill in the path of a Chromium-based browser) 的本地化字符串。
/// </summary>
public static string ExtraArgsPlaceHolder {
public static string SettingsBoxBrowserPathPlaceHolder {
get {
return ResourceManager.GetString("ExtraArgsPlaceHolder", resourceCulture);
return ResourceManager.GetString("SettingsBoxBrowserPathPlaceHolder", resourceCulture);
}
}
/// <summary>
/// 查找类似 (Fill in extra Chromium startup arguments) 的本地化字符串。
/// </summary>
public static string SettingsBoxExtraArgsPlaceHolder {
get {
return ResourceManager.GetString("SettingsBoxExtraArgsPlaceHolder", resourceCulture);
}
}
/// <summary>
/// 查找类似 (Fill in the link to an upstream Cealing Host) 的本地化字符串。
/// </summary>
public static string SettingsBoxUpstreamUrlPlaceHolder {
get {
return ResourceManager.GetString("SettingsBoxUpstreamUrlPlaceHolder", resourceCulture);
}
}
/// <summary>
/// 查找类似 Browse 的本地化字符串。
/// </summary>
public static string FunctionButtonBrowserPathContent {
public static string SettingsFunctionButtonBrowserPathContent {
get {
return ResourceManager.GetString("FunctionButtonBrowserPathContent", resourceCulture);
return ResourceManager.GetString("SettingsFunctionButtonBrowserPathContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Clear 的本地化字符串。
/// </summary>
public static string FunctionButtonExtraArgsContent {
public static string SettingsFunctionButtonExtraArgsContent {
get {
return ResourceManager.GetString("FunctionButtonExtraArgsContent", resourceCulture);
return ResourceManager.GetString("SettingsFunctionButtonExtraArgsContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Reset 的本地化字符串。
/// </summary>
public static string FunctionButtonUpstreamUrlContent {
public static string SettingsFunctionButtonUpstreamUrlContent {
get {
return ResourceManager.GetString("FunctionButtonUpstreamUrlContent", resourceCulture);
return ResourceManager.GetString("SettingsFunctionButtonUpstreamUrlContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Browser Path &gt; 的本地化字符串。
/// </summary>
public static string SettingsModeButtonBrowserPathContent {
get {
return ResourceManager.GetString("SettingsModeButtonBrowserPathContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Additional Args &gt; 的本地化字符串。
/// </summary>
public static string SettingsModeButtonExtraArgsContent {
get {
return ResourceManager.GetString("SettingsModeButtonExtraArgsContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Upstream Url &gt; 的本地化字符串。
/// </summary>
public static string SettingsModeButtonUpstreamUrlContent {
get {
return ResourceManager.GetString("SettingsModeButtonUpstreamUrlContent", resourceCulture);
}
}
@ -132,33 +168,6 @@ namespace Sheas_Cealer.Consts {
}
}
/// <summary>
/// 查找类似 Browser Path &gt; 的本地化字符串。
/// </summary>
public static string SwitchModeButtonBrowserPathContent {
get {
return ResourceManager.GetString("SwitchModeButtonBrowserPathContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Additional Args &gt; 的本地化字符串。
/// </summary>
public static string SwitchModeButtonExtraArgsContent {
get {
return ResourceManager.GetString("SwitchModeButtonExtraArgsContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Upstream Url &gt; 的本地化字符串。
/// </summary>
public static string SwitchModeButtonUpstreamUrlContent {
get {
return ResourceManager.GetString("SwitchModeButtonUpstreamUrlContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Update Host 的本地化字符串。
/// </summary>
@ -167,14 +176,5 @@ namespace Sheas_Cealer.Consts {
return ResourceManager.GetString("UpdateHostButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 (Fill in the link to an upstream Cealing Host) 的本地化字符串。
/// </summary>
public static string UpstreamUrlPlaceHolder {
get {
return ResourceManager.GetString("UpstreamUrlPlaceHolder", resourceCulture);
}
}
}
}

View File

@ -1,76 +1,96 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
Version 1.3
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConv classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">1.3</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1">this is my long string</data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
[base64 mime encoded serialized .NET Framework object]
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
[base64 mime encoded string representing a byte array form of the .NET Framework object]
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConv architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConv
: and then encoded with base64 encoding.
-->
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
@ -89,51 +109,51 @@
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>1.3</value>
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.3500.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="AboutButtonContent" xml:space="preserve">
<value>About Me</value>
</data>
<data name="BrowserPathPlaceHolder" xml:space="preserve">
<value>(Fill in the path of a Chromium-based browser)</value>
</data>
<data name="EditHostButtonContent" xml:space="preserve">
<value>Edit Host</value>
</data>
<data name="ExtraArgsPlaceHolder" xml:space="preserve">
<value>(fill in extra Chromium startup arguments)</value>
<data name="SettingsBoxBrowserPathPlaceHolder" xml:space="preserve">
<value>(Fill in the path of a Chromium-based browser)</value>
</data>
<data name="FunctionButtonBrowserPathContent" xml:space="preserve">
<data name="SettingsBoxExtraArgsPlaceHolder" xml:space="preserve">
<value>(Fill in extra Chromium startup arguments)</value>
</data>
<data name="SettingsBoxUpstreamUrlPlaceHolder" xml:space="preserve">
<value>(Fill in the link to an upstream Cealing Host)</value>
</data>
<data name="SettingsFunctionButtonBrowserPathContent" xml:space="preserve">
<value>Browse</value>
</data>
<data name="FunctionButtonExtraArgsContent" xml:space="preserve">
<data name="SettingsFunctionButtonExtraArgsContent" xml:space="preserve">
<value>Clear</value>
</data>
<data name="FunctionButtonUpstreamUrlContent" xml:space="preserve">
<data name="SettingsFunctionButtonUpstreamUrlContent" xml:space="preserve">
<value>Reset</value>
</data>
<data name="SettingsModeButtonBrowserPathContent" xml:space="preserve">
<value>Browser Path &gt;</value>
</data>
<data name="SettingsModeButtonExtraArgsContent" xml:space="preserve">
<value>Additional Args &gt;</value>
</data>
<data name="SettingsModeButtonUpstreamUrlContent" xml:space="preserve">
<value>Upstream Url &gt;</value>
</data>
<data name="StartCealButtonContent" xml:space="preserve">
<value>Start Cealing</value>
</data>
<data name="SwitchModeButtonBrowserPathContent" xml:space="preserve">
<value>Browser Path &gt;</value>
</data>
<data name="SwitchModeButtonExtraArgsContent" xml:space="preserve">
<value>Additional Args &gt;</value>
</data>
<data name="SwitchModeButtonUpstreamUrlContent" xml:space="preserve">
<value>Upstream Url &gt;</value>
</data>
<data name="UpdateHostButtonContent" xml:space="preserve">
<value>Update Host</value>
</data>
<data name="UpstreamUrlPlaceHolder" xml:space="preserve">
<value>(Fill in the link to an upstream Cealing Host)</value>
</data>
</root>

View File

@ -7,7 +7,7 @@
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConv classes
various data types are done through the TypeConverter classes
associated with the data types.
Example:
@ -32,7 +32,7 @@
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConv architecture.
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
@ -56,7 +56,7 @@
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConv
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
@ -120,40 +120,40 @@
<data name="AboutButtonContent" xml:space="preserve">
<value>关于项目</value>
</data>
<data name="BrowserPathPlaceHolder" xml:space="preserve">
<value>(填入任意以 Chromium 为内核的浏览器的路径)</value>
</data>
<data name="EditHostButtonContent" xml:space="preserve">
<value>编辑规则</value>
</data>
<data name="ExtraArgsPlaceHolder" xml:space="preserve">
<data name="SettingsBoxBrowserPathPlaceHolder" xml:space="preserve">
<value>(填入任意以 Chromium 为内核的浏览器的路径)</value>
</data>
<data name="SettingsBoxExtraArgsPlaceHolder" xml:space="preserve">
<value>(填入任意额外的 Chromium 启动参数)</value>
</data>
<data name="FunctionButtonBrowserPathContent" xml:space="preserve">
<data name="SettingsBoxUpstreamUrlPlaceHolder" xml:space="preserve">
<value>(填入任意上游伪造规则的链接)</value>
</data>
<data name="SettingsFunctionButtonBrowserPathContent" xml:space="preserve">
<value>浏览</value>
</data>
<data name="FunctionButtonExtraArgsContent" xml:space="preserve">
<data name="SettingsFunctionButtonExtraArgsContent" xml:space="preserve">
<value>清除</value>
</data>
<data name="FunctionButtonUpstreamUrlContent" xml:space="preserve">
<data name="SettingsFunctionButtonUpstreamUrlContent" xml:space="preserve">
<value>重置</value>
</data>
<data name="SettingsModeButtonBrowserPathContent" xml:space="preserve">
<value>文件路径 &gt;</value>
</data>
<data name="SettingsModeButtonExtraArgsContent" xml:space="preserve">
<value>额外参数 &gt;</value>
</data>
<data name="SettingsModeButtonUpstreamUrlContent" xml:space="preserve">
<value>上游链接 &gt;</value>
</data>
<data name="StartCealButtonContent" xml:space="preserve">
<value>启动伪造</value>
</data>
<data name="SwitchModeButtonBrowserPathContent" xml:space="preserve">
<value>文件路径 &gt;</value>
</data>
<data name="SwitchModeButtonExtraArgsContent" xml:space="preserve">
<value>额外参数 &gt;</value>
</data>
<data name="SwitchModeButtonUpstreamUrlContent" xml:space="preserve">
<value>上游链接 &gt;</value>
</data>
<data name="UpdateHostButtonContent" xml:space="preserve">
<value>更新规则</value>
</data>
<data name="UpstreamUrlPlaceHolder" xml:space="preserve">
<value>(填入任意上游伪造规则的链接)</value>
</data>
</root>

View File

@ -6,7 +6,7 @@ using Sheas_Cealer.Consts;
namespace Sheas_Cealer.Convs;
internal class MainContentBoxForegroundConv : IMultiValueConverter
internal class MainSettingsBoxForegroundConv : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
@ -17,9 +17,9 @@ internal class MainContentBoxForegroundConv : IMultiValueConverter
switch (mode)
{
case MainConst.SettingsMode.BrowserPathMode when browserPath == MainConst.BrowserPathPlaceHolder:
case MainConst.SettingsMode.UpstreamUrlMode when upstreamUrl == MainConst.UpstreamUrlPlaceHolder:
case MainConst.SettingsMode.ExtraArgsMode when extraArgs == MainConst.ExtraArgsPlaceHolder:
case MainConst.SettingsMode.BrowserPathMode when browserPath == MainConst.SettingsBoxBrowserPathPlaceHolder:
case MainConst.SettingsMode.UpstreamUrlMode when upstreamUrl == MainConst.SettingsBoxUpstreamUrlPlaceHolder:
case MainConst.SettingsMode.ExtraArgsMode when extraArgs == MainConst.SettingsBoxExtraArgsPlaceHolder:
return new SolidColorBrush(Color.FromRgb(191, 205, 219));
}

View File

@ -5,7 +5,7 @@ using Sheas_Cealer.Consts;
namespace Sheas_Cealer.Convs;
internal class MainContentBoxTextConv : IMultiValueConverter
internal class MainSettingsBoxTextConv : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
@ -17,12 +17,12 @@ internal class MainContentBoxTextConv : IMultiValueConverter
return mode switch
{
MainConst.SettingsMode.BrowserPathMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(browserPath) ? MainConst.BrowserPathPlaceHolder :
isFocused.GetValueOrDefault() && browserPath == MainConst.BrowserPathPlaceHolder ? string.Empty : browserPath!,
MainConst.SettingsMode.UpstreamUrlMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(upstreamUrl) ? MainConst.UpstreamUrlPlaceHolder :
isFocused.GetValueOrDefault() && upstreamUrl == MainConst.UpstreamUrlPlaceHolder ? string.Empty : upstreamUrl!,
MainConst.SettingsMode.ExtraArgsMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(extraArgs) ? MainConst.ExtraArgsPlaceHolder :
isFocused.GetValueOrDefault() && extraArgs == MainConst.ExtraArgsPlaceHolder ? string.Empty : extraArgs!,
MainConst.SettingsMode.BrowserPathMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(browserPath) ? MainConst.SettingsBoxBrowserPathPlaceHolder :
isFocused.GetValueOrDefault() && browserPath == MainConst.SettingsBoxBrowserPathPlaceHolder ? string.Empty : browserPath!,
MainConst.SettingsMode.UpstreamUrlMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(upstreamUrl) ? MainConst.SettingsBoxUpstreamUrlPlaceHolder :
isFocused.GetValueOrDefault() && upstreamUrl == MainConst.SettingsBoxUpstreamUrlPlaceHolder ? string.Empty : upstreamUrl!,
MainConst.SettingsMode.ExtraArgsMode => !isFocused.GetValueOrDefault() && string.IsNullOrEmpty(extraArgs) ? MainConst.SettingsBoxExtraArgsPlaceHolder :
isFocused.GetValueOrDefault() && extraArgs == MainConst.SettingsBoxExtraArgsPlaceHolder ? string.Empty : extraArgs!,
_ => throw new UnreachableException(),
};
}

View File

@ -6,7 +6,7 @@ using Sheas_Cealer.Consts;
namespace Sheas_Cealer.Convs;
internal class MainFunctionButtonContentConv : IValueConverter
internal class MainSettingsFunctionButtonContentConv : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@ -14,9 +14,9 @@ internal class MainFunctionButtonContentConv : IValueConverter
return mode switch
{
MainConst.SettingsMode.BrowserPathMode => MainConst.FunctionButtonBrowserPathContent,
MainConst.SettingsMode.UpstreamUrlMode => MainConst.FunctionButtonUpstreamUrlContent,
MainConst.SettingsMode.ExtraArgsMode => MainConst.FunctionButtonExtraArgsContent,
MainConst.SettingsMode.BrowserPathMode => MainConst.SettingsFunctionButtonBrowserPathContent,
MainConst.SettingsMode.UpstreamUrlMode => MainConst.SettingsFunctionButtonUpstreamUrlContent,
MainConst.SettingsMode.ExtraArgsMode => MainConst.SettingsFunctionButtonExtraArgsContent,
_ => throw new UnreachableException()
};
}

View File

@ -5,7 +5,7 @@ using Sheas_Cealer.Consts;
namespace Sheas_Cealer.Convs;
internal class MainSwitchModeButtonContentConv : IValueConverter
internal class MainSettingsModeButtonContentConv : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
@ -13,9 +13,9 @@ internal class MainSwitchModeButtonContentConv : IValueConverter
return mode switch
{
MainConst.SettingsMode.BrowserPathMode => MainConst.SwitchModeButtonBrowserPathContent,
MainConst.SettingsMode.UpstreamUrlMode => MainConst.SwitchModeButtonUpstreamUrlContent,
MainConst.SettingsMode.ExtraArgsMode => MainConst.SwitchModeButtonExtraArgsContent,
MainConst.SettingsMode.BrowserPathMode => MainConst.SettingsModeButtonBrowserPathContent,
MainConst.SettingsMode.UpstreamUrlMode => MainConst.SettingsModeButtonUpstreamUrlContent,
MainConst.SettingsMode.ExtraArgsMode => MainConst.SettingsModeButtonExtraArgsContent,
_ => throw new NotImplementedException()
};
}

View File

@ -13,7 +13,7 @@ internal class MainStartCealButtonIsEnabledConv : IMultiValueConverter
string? browserPath = values[0] as string;
string? extraArgs = values[1] as string;
return File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && (MainConst.ExtraArgsRegex().IsMatch(extraArgs!) || extraArgs == MainConst.ExtraArgsPlaceHolder);
return File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && (MainConst.ExtraArgsRegex().IsMatch(extraArgs!) || extraArgs == MainConst.SettingsBoxExtraArgsPlaceHolder);
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();

View File

@ -2,6 +2,7 @@
using System.IO;
using CommunityToolkit.Mvvm.ComponentModel;
using Sheas_Cealer.Consts;
using Sheas_Cealer.Props;
using File = System.IO.File;
namespace Sheas_Cealer.Preses;
@ -15,20 +16,20 @@ internal partial class MainPres : ObservableObject
extraArgsIndex = Array.FindIndex(args, arg => arg == "e") + 1;
BrowserPath = browserPathIndex == 0 ?
(!string.IsNullOrWhiteSpace(Props.Settings.Default.BrowserPath) ? Props.Settings.Default.BrowserPath : string.Empty) :
(!string.IsNullOrWhiteSpace(Settings.Default.BrowserPath) ? Settings.Default.BrowserPath : string.Empty) :
args[browserPathIndex];
UpstreamUrl = upstreamUrlIndex == 0 ?
(!string.IsNullOrWhiteSpace(Props.Settings.Default.UpstreamUrl) ? Props.Settings.Default.UpstreamUrl : MainConst.DefaultUpstreamUrl) :
(!string.IsNullOrWhiteSpace(Settings.Default.UpstreamUrl) ? Settings.Default.UpstreamUrl : MainConst.DefaultUpstreamUrl) :
args[upstreamUrlIndex];
ExtraArgs = extraArgsIndex == 0 ?
(!string.IsNullOrWhiteSpace(Props.Settings.Default.ExtraArgs) ? Props.Settings.Default.ExtraArgs : string.Empty) :
(!string.IsNullOrWhiteSpace(Settings.Default.ExtraArgs) ? Settings.Default.ExtraArgs : string.Empty) :
args[extraArgsIndex];
}
[ObservableProperty]
private MainConst.SettingsMode mode = MainConst.SettingsMode.BrowserPathMode;
private MainConst.SettingsMode mode;
[ObservableProperty]
private string browserPath;
@ -36,8 +37,8 @@ internal partial class MainPres : ObservableObject
{
if (File.Exists(value) && Path.GetFileName(value).ToLower().EndsWith(".exe"))
{
Props.Settings.Default.BrowserPath = value;
Props.Settings.Default.Save();
Settings.Default.BrowserPath = value;
Settings.Default.Save();
}
}
@ -47,8 +48,8 @@ internal partial class MainPres : ObservableObject
{
if (MainConst.UpstreamUrlRegex().IsMatch(value))
{
Props.Settings.Default.UpstreamUrl = value;
Props.Settings.Default.Save();
Settings.Default.UpstreamUrl = value;
Settings.Default.Save();
}
}
@ -58,8 +59,8 @@ internal partial class MainPres : ObservableObject
{
if (MainConst.ExtraArgsRegex().IsMatch(value))
{
Props.Settings.Default.ExtraArgs = value;
Props.Settings.Default.Save();
Settings.Default.ExtraArgs = value;
Settings.Default.Save();
}
}
}

View File

@ -29,23 +29,23 @@
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Margin="5"
Click="SwitchModeButton_Click">
Click="SettingsModeButton_Click">
<Button.Content>
<Binding Path="Mode">
<Binding.Converter>
<convs:MainSwitchModeButtonContentConv />
<convs:MainSettingsModeButtonContentConv />
</Binding.Converter>
</Binding>
</Button.Content>
</Button>
<TextBox x:Name="ContentBox"
<TextBox x:Name="SettingsBox"
Grid.Column="1" Margin="5" VerticalContentAlignment="Center"
TextChanged="ContentBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
TextChanged="SettingsBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
<TextBox.Text>
<MultiBinding Mode="OneWay" UpdateSourceTrigger="PropertyChanged">
<MultiBinding.Converter>
<convs:MainContentBoxTextConv />
<convs:MainSettingsBoxTextConv />
</MultiBinding.Converter>
<Binding Path="Mode" />
@ -58,7 +58,7 @@
<TextBox.Foreground>
<MultiBinding Mode="OneWay">
<MultiBinding.Converter>
<convs:MainContentBoxForegroundConv />
<convs:MainSettingsBoxForegroundConv />
</MultiBinding.Converter>
<Binding Path="Mode" />
@ -69,11 +69,11 @@
</TextBox.Foreground>
</TextBox>
<Button Grid.Column="2" Margin="5"
Click="FunctionButton_Click">
Click="SettingsFunctionButton_Click">
<Button.Content>
<Binding Path="Mode">
<Binding.Converter>
<convs:MainFunctionButtonContentConv />
<convs:MainSettingsFunctionButtonContentConv />
</Binding.Converter>
</Binding>
</Button.Content>

View File

@ -28,11 +28,10 @@ public partial class MainWin : Window
{
InitializeComponent();
MainPres = new(args);
DataContext = MainPres;
DataContext = MainPres = new(args);
CealingHostWatcher.Changed += CealingHostWatcher_Changed;
}
private void MainWin_Loaded(object sender, RoutedEventArgs e) => ContentBox.Focus();
private void MainWin_Loaded(object sender, RoutedEventArgs e) => SettingsBox.Focus();
private void MainWin_Closing(object sender, CancelEventArgs e) => Environment.Exit(0);
private void MainWin_DragEnter(object sender, DragEventArgs e)
@ -46,37 +45,44 @@ public partial class MainWin : Window
MainPres!.BrowserPath = ((string[])e.Data.GetData(DataFormats.FileDrop))[0];
}
private void ContentBox_TextChanged(object sender, TextChangedEventArgs e)
private void SettingsBox_TextChanged(object sender, TextChangedEventArgs e)
{
TextBox? ContentBox = sender as TextBox;
TextBox? SettingsBox = sender as TextBox;
if (MainPres!.Mode == MainConst.SettingsMode.BrowserPathMode)
MainPres.BrowserPath = ContentBox!.Text;
else if (MainPres!.Mode == MainConst.SettingsMode.UpstreamUrlMode)
MainPres.UpstreamUrl = ContentBox!.Text;
else if (MainPres!.Mode == MainConst.SettingsMode.ExtraArgsMode)
MainPres.ExtraArgs = ContentBox!.Text;
else
throw new UnreachableException();
}
private void FunctionButton_Click(object sender, RoutedEventArgs e)
{
if (MainPres!.Mode == MainConst.SettingsMode.BrowserPathMode)
switch (MainPres!.Mode)
{
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
if (openFileDialog.ShowDialog() == true)
{
ContentBox.Focus();
MainPres!.BrowserPath = openFileDialog.FileName;
}
case MainConst.SettingsMode.BrowserPathMode:
MainPres!.BrowserPath = SettingsBox!.Text;
return;
case MainConst.SettingsMode.UpstreamUrlMode:
MainPres!.UpstreamUrl = SettingsBox!.Text;
return;
case MainConst.SettingsMode.ExtraArgsMode:
MainPres!.ExtraArgs = SettingsBox!.Text;
return;
default:
throw new UnreachableException();
}
else if (MainPres!.Mode == MainConst.SettingsMode.UpstreamUrlMode)
MainPres!.UpstreamUrl = MainConst.DefaultUpstreamUrl;
else if (MainPres!.Mode == MainConst.SettingsMode.ExtraArgsMode)
MainPres!.ExtraArgs = string.Empty;
}
private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
private void SettingsFunctionButton_Click(object sender, RoutedEventArgs e)
{
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
switch (MainPres!.Mode)
{
case MainConst.SettingsMode.BrowserPathMode when openFileDialog.ShowDialog().GetValueOrDefault():
SettingsBox.Focus();
MainPres!.BrowserPath = openFileDialog.FileName;
return;
case MainConst.SettingsMode.UpstreamUrlMode:
MainPres!.UpstreamUrl = MainConst.DefaultUpstreamUrl;
return;
case MainConst.SettingsMode.ExtraArgsMode:
MainPres!.ExtraArgs = string.Empty;
return;
}
}
private void SettingsModeButton_Click(object sender, RoutedEventArgs e)
{
MainPres!.Mode = MainPres!.Mode switch
{
@ -117,9 +123,8 @@ public partial class MainWin : Window
{
string hostUrl = MainPres!.UpstreamUrl;
string UpdateHostString = await Http.GetAsync<string>(hostUrl, MainClient);
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
using StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
string hostLocalString = hostLocalStreamReader.ReadToEnd();
hostLocalStreamReader.Close();
if (hostLocalString.Replace("\r", string.Empty) == UpdateHostString)
MessageBox.Show("本地伪造规则和上游一模一样");