mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 21:02:08 +08:00
1.1.0 -> 1.1.1 第2次更新
This commit is contained in:
parent
45d5e7076b
commit
a834b7589e
@ -1,11 +1,12 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
|
using Sheas_Cealer.Wins;
|
||||||
|
|
||||||
namespace Sheas_Cealer
|
namespace Sheas_Cealer
|
||||||
{
|
{
|
||||||
public partial class App : Application
|
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)
|
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
|
16
Consts/AboutConst.cs
Normal file
16
Consts/AboutConst.cs
Normal file
@ -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_使用协议";
|
||||||
|
}
|
||||||
|
}
|
126
Consts/AboutMultilangConst.Designer.cs
generated
Normal file
126
Consts/AboutMultilangConst.Designer.cs
generated
Normal file
@ -0,0 +1,126 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Consts {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||||
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
public static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 ToS. 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string AgreementButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AgreementButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Dev. Space Time 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string DeveloperButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("DeveloperButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Email 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string EmailButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("EmailButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Docs 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string InstructionButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("InstructionButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Repo 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string OpenSourceButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("OpenSourceButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 PP. 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string PrivacyButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("PrivacyButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Ver. 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string VersionButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("VersionButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
141
Consts/AboutMultilangConst.resx
Normal file
141
Consts/AboutMultilangConst.resx
Normal file
@ -0,0 +1,141 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
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.
|
||||||
|
|
||||||
|
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" 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">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="AgreementButtonContent" xml:space="preserve">
|
||||||
|
<value>ToS.</value>
|
||||||
|
</data>
|
||||||
|
<data name="DeveloperButtonContent" xml:space="preserve">
|
||||||
|
<value>Dev. Space Time</value>
|
||||||
|
</data>
|
||||||
|
<data name="EmailButtonContent" xml:space="preserve">
|
||||||
|
<value>Email</value>
|
||||||
|
</data>
|
||||||
|
<data name="InstructionButtonContent" xml:space="preserve">
|
||||||
|
<value>Docs</value>
|
||||||
|
</data>
|
||||||
|
<data name="OpenSourceButtonContent" xml:space="preserve">
|
||||||
|
<value>Repo</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrivacyButtonContent" xml:space="preserve">
|
||||||
|
<value>PP.</value>
|
||||||
|
</data>
|
||||||
|
<data name="VersionButtonContent" xml:space="preserve">
|
||||||
|
<value>Ver. </value>
|
||||||
|
</data>
|
||||||
|
</root>
|
121
Consts/AboutMultilangConst.zh.resx
Normal file
121
Consts/AboutMultilangConst.zh.resx
Normal file
@ -0,0 +1,121 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
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 TypeConverter 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 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.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.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:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<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="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>1.3</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.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>
|
||||||
|
</resheader>
|
||||||
|
<data name="AgreementButtonContent" xml:space="preserve">
|
||||||
|
<value>使用协议</value>
|
||||||
|
</data>
|
||||||
|
<data name="DeveloperButtonContent" xml:space="preserve">
|
||||||
|
<value>开发者: Space Time</value>
|
||||||
|
</data>
|
||||||
|
<data name="EmailButtonContent" xml:space="preserve">
|
||||||
|
<value>联系邮箱</value>
|
||||||
|
</data>
|
||||||
|
<data name="InstructionButtonContent" xml:space="preserve">
|
||||||
|
<value>使用文档</value>
|
||||||
|
</data>
|
||||||
|
<data name="OpenSourceButtonContent" xml:space="preserve">
|
||||||
|
<value>开源地址</value>
|
||||||
|
</data>
|
||||||
|
<data name="PrivacyButtonContent" xml:space="preserve">
|
||||||
|
<value>隐私政策</value>
|
||||||
|
</data>
|
||||||
|
<data name="VersionButtonContent" xml:space="preserve">
|
||||||
|
<value>版本号: </value>
|
||||||
|
</data>
|
||||||
|
</root>
|
21
Consts/MainConst.cs
Normal file
21
Consts/MainConst.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
144
Consts/MainMultilangConst.Designer.cs
generated
Normal file
144
Consts/MainMultilangConst.Designer.cs
generated
Normal file
@ -0,0 +1,144 @@
|
|||||||
|
//------------------------------------------------------------------------------
|
||||||
|
// <auto-generated>
|
||||||
|
// 此代码由工具生成。
|
||||||
|
// 运行时版本:4.0.30319.42000
|
||||||
|
//
|
||||||
|
// 对此文件的更改可能会导致不正确的行为,并且如果
|
||||||
|
// 重新生成代码,这些更改将会丢失。
|
||||||
|
// </auto-generated>
|
||||||
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Consts {
|
||||||
|
using System;
|
||||||
|
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 一个强类型的资源类,用于查找本地化的字符串等。
|
||||||
|
/// </summary>
|
||||||
|
// 此类是由 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() {
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 返回此类使用的缓存的 ResourceManager 实例。
|
||||||
|
/// </summary>
|
||||||
|
[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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 重写当前线程的 CurrentUICulture 属性,对
|
||||||
|
/// 使用此强类型资源类的所有资源查找执行重写。
|
||||||
|
/// </summary>
|
||||||
|
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||||
|
public static global::System.Globalization.CultureInfo Culture {
|
||||||
|
get {
|
||||||
|
return resourceCulture;
|
||||||
|
}
|
||||||
|
set {
|
||||||
|
resourceCulture = value;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 About Me 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string AboutButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("AboutButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Browse 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string BrowseButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("BrowseButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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>
|
||||||
|
public static string EditHostButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("EditHostButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 (fill in extra Chromium startup arguments) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string ExtraArgsPlaceHolder {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("ExtraArgsPlaceHolder", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Start Cealing 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string StartCealButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("StartCealButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Switch 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string SwitchModeButtonContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SwitchModeButtonContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Update Host 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string UpdateHostButtonContent {
|
||||||
|
get {
|
||||||
|
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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
127
Consts/MainMultilangConst.resx
Normal file
127
Consts/MainMultilangConst.resx
Normal file
@ -0,0 +1,127 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
Microsoft ResX Schema
|
||||||
|
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||||
|
<xsd:element name="root" msdata:IsDataSet="true">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:choice maxOccurs="unbounded">
|
||||||
|
<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="type" type="xsd:string" msdata:Ordinal="3" />
|
||||||
|
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
<xsd:element name="resheader">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>1.3</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.3500.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>
|
||||||
|
</resheader>
|
||||||
|
<data name="AboutButtonContent" xml:space="preserve">
|
||||||
|
<value>About Me</value>
|
||||||
|
</data>
|
||||||
|
<data name="BrowseButtonContent" xml:space="preserve">
|
||||||
|
<value>Browse</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>
|
||||||
|
<data name="SwitchModeButtonContent" xml:space="preserve">
|
||||||
|
<value>Switch</value>
|
||||||
|
</data>
|
||||||
|
<data name="StartCealButtonContent" xml:space="preserve">
|
||||||
|
<value>Start Cealing</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>
|
147
Consts/MainMultilangConst.zh.resx
Normal file
147
Consts/MainMultilangConst.zh.resx
Normal file
@ -0,0 +1,147 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<root>
|
||||||
|
<!--
|
||||||
|
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 TypeConv 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 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.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.
|
||||||
|
|
||||||
|
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.
|
||||||
|
-->
|
||||||
|
<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" 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">
|
||||||
|
<xsd:complexType>
|
||||||
|
<xsd:sequence>
|
||||||
|
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||||
|
</xsd:sequence>
|
||||||
|
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:choice>
|
||||||
|
</xsd:complexType>
|
||||||
|
</xsd:element>
|
||||||
|
</xsd:schema>
|
||||||
|
<resheader name="resmimetype">
|
||||||
|
<value>text/microsoft-resx</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="version">
|
||||||
|
<value>2.0</value>
|
||||||
|
</resheader>
|
||||||
|
<resheader name="reader">
|
||||||
|
<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=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||||
|
</resheader>
|
||||||
|
<data name="AboutButtonContent" xml:space="preserve">
|
||||||
|
<value>关于项目</value>
|
||||||
|
</data>
|
||||||
|
<data name="BrowseButtonContent" 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">
|
||||||
|
<value>(填入任意额外的 Chromium 启动参数)</value>
|
||||||
|
</data>
|
||||||
|
<data name="SwitchModeButtonContent" xml:space="preserve">
|
||||||
|
<value>切换</value>
|
||||||
|
</data>
|
||||||
|
<data name="StartCealButtonContent" xml:space="preserve">
|
||||||
|
<value>启动伪造</value>
|
||||||
|
</data>
|
||||||
|
<data name="UpdateHostButtonContent" xml:space="preserve">
|
||||||
|
<value>更新规则</value>
|
||||||
|
</data>
|
||||||
|
<data name="UpstreamUrlPlaceHolder" xml:space="preserve">
|
||||||
|
<value>(填入任意上游伪造规则的链接)</value>
|
||||||
|
</data>
|
||||||
|
</root>
|
22
Convs/AboutVersionButtonContentConv.cs
Normal file
22
Convs/AboutVersionButtonContentConv.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
48
Convs/MainContentBoxForegroundConv.cs
Normal file
48
Convs/MainContentBoxForegroundConv.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
57
Convs/MainContentBoxTextConv.cs
Normal file
57
Convs/MainContentBoxTextConv.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
65
Preses/MainPres.cs
Normal file
65
Preses/MainPres.cs
Normal file
@ -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();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -8,11 +8,11 @@
|
|||||||
// </auto-generated>
|
// </auto-generated>
|
||||||
//------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------
|
||||||
|
|
||||||
namespace Sheas_Cealer.Properties {
|
namespace Sheas_Cealer.Props {
|
||||||
|
|
||||||
|
|
||||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
[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 {
|
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||||
|
|
||||||
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||||
@ -34,5 +34,29 @@ namespace Sheas_Cealer.Properties {
|
|||||||
this["BrowserPath"] = value;
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,9 +1,15 @@
|
|||||||
<?xml version='1.0' encoding='utf-8'?>
|
<?xml version='1.0' encoding='utf-8'?>
|
||||||
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Sheas_Cealer.Properties" GeneratedClassName="Settings">
|
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)" GeneratedClassNamespace="Sheas_Cealer.Props" GeneratedClassName="Settings">
|
||||||
<Profiles />
|
<Profiles />
|
||||||
<Settings>
|
<Settings>
|
||||||
<Setting Name="BrowserPath" Type="System.String" Scope="User">
|
<Setting Name="BrowserPath" Type="System.String" Scope="User">
|
||||||
<Value Profile="(Default)" />
|
<Value Profile="(Default)" />
|
||||||
</Setting>
|
</Setting>
|
||||||
|
<Setting Name="UpstreamUrl" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
|
<Setting Name="ExtraArgs" Type="System.String" Scope="User">
|
||||||
|
<Value Profile="(Default)" />
|
||||||
|
</Setting>
|
||||||
</Settings>
|
</Settings>
|
||||||
</SettingsFile>
|
</SettingsFile>
|
@ -21,7 +21,7 @@
|
|||||||
<RepositoryType>git</RepositoryType>
|
<RepositoryType>git</RepositoryType>
|
||||||
<Copyright>Copyright © 2077</Copyright>
|
<Copyright>Copyright © 2077</Copyright>
|
||||||
<OutputType>WinExe</OutputType>
|
<OutputType>WinExe</OutputType>
|
||||||
<TargetFramework>net8.0-windows10.0.22000.0</TargetFramework>
|
<TargetFramework>net8.0-windows10.0.22621.0</TargetFramework>
|
||||||
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>10.0.17763.0</SupportedOSPlatformVersion>
|
||||||
<RootNamespace>Sheas_Cealer</RootNamespace>
|
<RootNamespace>Sheas_Cealer</RootNamespace>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
@ -31,6 +31,7 @@
|
|||||||
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
|
||||||
<ErrorReport>none</ErrorReport>
|
<ErrorReport>none</ErrorReport>
|
||||||
<NoWin32Manifest>true</NoWin32Manifest>
|
<NoWin32Manifest>true</NoWin32Manifest>
|
||||||
|
<AppDesignerFolder>Props</AppDesignerFolder>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
|
||||||
@ -72,6 +73,7 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="5.0.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="5.0.0" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
@ -86,15 +88,36 @@
|
|||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Compile Update="Properties\Settings.Designer.cs">
|
<Compile Update="Consts\AboutMultilangConst.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>AboutMultilangConst.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
|
<Compile Update="Props\Settings.Designer.cs">
|
||||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DependentUpon>Settings.settings</DependentUpon>
|
<DependentUpon>Settings.settings</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Update="Consts\MainMultilangConst.Designer.cs">
|
||||||
|
<DesignTime>True</DesignTime>
|
||||||
|
<AutoGen>True</AutoGen>
|
||||||
|
<DependentUpon>MainMultilangConst.resx</DependentUpon>
|
||||||
|
</Compile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<None Update="Properties\Settings.settings">
|
<EmbeddedResource Update="Consts\AboutMultilangConst.resx">
|
||||||
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>AboutMultilangConst.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
<EmbeddedResource Update="Consts\MainMultilangConst.resx">
|
||||||
|
<Generator>PublicResXFileCodeGenerator</Generator>
|
||||||
|
<LastGenOutput>MainMultilangConst.Designer.cs</LastGenOutput>
|
||||||
|
</EmbeddedResource>
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Update="Props\Settings.settings">
|
||||||
<Generator>SettingsSingleFileGenerator</Generator>
|
<Generator>SettingsSingleFileGenerator</Generator>
|
||||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||||
</None>
|
</None>
|
||||||
|
@ -32,6 +32,12 @@ Global
|
|||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||||
|
RESX_DuplicateKeyHandling = Fail
|
||||||
|
RESX_AutoCreateNewLanguageFiles = True
|
||||||
|
RESX_ConfirmAddLanguageFile = True
|
||||||
|
RESX_NeutralResourcesLanguage = en-US
|
||||||
SolutionGuid = {33005A8D-2D3D-4101-AFF0-F68B29FE9B28}
|
SolutionGuid = {33005A8D-2D3D-4101-AFF0-F68B29FE9B28}
|
||||||
|
RESX_SortFileContentOnSave = True
|
||||||
|
RESX_Rules = {"EnabledRules":["StringFormat","WhiteSpaceLead","WhiteSpaceTail","PunctuationLead"]}
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
EndGlobal
|
EndGlobal
|
||||||
|
@ -2,7 +2,7 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using SheasCore;
|
using SheasCore;
|
||||||
|
|
||||||
namespace Sheas_Cealer
|
namespace Sheas_Cealer.Utils
|
||||||
{
|
{
|
||||||
internal class Command : Proc
|
internal class Command : Proc
|
||||||
{
|
{
|
66
Utils/FocusExtension.cs
Normal file
66
Utils/FocusExtension.cs
Normal file
@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -2,10 +2,11 @@
|
|||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
|
using Sheas_Cealer.Utils;
|
||||||
|
|
||||||
namespace Sheas_Cealer
|
namespace Sheas_Cealer.Utils
|
||||||
{
|
{
|
||||||
//定义IconRemover
|
// 定义IconRemover
|
||||||
internal static partial class IconRemover
|
internal static partial class IconRemover
|
||||||
{
|
{
|
||||||
private const int GWL_EXSTYLE = -20;
|
private const int GWL_EXSTYLE = -20;
|
||||||
@ -28,27 +29,30 @@ namespace Sheas_Cealer
|
|||||||
|
|
||||||
internal static void RemoveIcon(Window window)
|
internal static void RemoveIcon(Window window)
|
||||||
{
|
{
|
||||||
//获取该窗口句柄
|
// 获取该窗口句柄
|
||||||
IntPtr hwnd = new WindowInteropHelper(window).Handle;
|
IntPtr hwnd = new WindowInteropHelper(window).Handle;
|
||||||
|
|
||||||
//将窗口更改为不显示窗口图标
|
// 将窗口更改为不显示窗口图标
|
||||||
_ = SetWindowLong(hwnd, GWL_EXSTYLE, GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_DLGMODALFRAME);
|
_ = 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);
|
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, new IntPtr(1), IntPtr.Zero);
|
||||||
SendMessage(hwnd, WM_SETICON, IntPtr.Zero, IntPtr.Zero);
|
SendMessage(hwnd, WM_SETICON, IntPtr.Zero, IntPtr.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//使用IconRemover
|
namespace Sheas_Cealer.Wins
|
||||||
public partial class MainWindow
|
{
|
||||||
|
// 使用IconRemover
|
||||||
|
public partial class MainWin
|
||||||
{
|
{
|
||||||
protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this);
|
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);
|
protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this);
|
||||||
}
|
}
|
@ -1,31 +0,0 @@
|
|||||||
<Window x:Class="Sheas_Cealer.AboutWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Style="{DynamicResource CommonWindow}"
|
|
||||||
WindowStartupLocation="CenterScreen" Height="120" Width="500" MinWidth="500" ResizeMode="NoResize" Loaded="AboutWin_Loaded" KeyDown="AboutWin_KeyDown">
|
|
||||||
<Grid Margin="5">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="1.1*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
|
|
||||||
<Button x:Name="DeveloperButton" Content="开发者: Space Time" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Foreground="#FF2196F3" ToolTip="https://www.spacetimee.xyz" Click="AboutButton_Click" />
|
|
||||||
<Button x:Name="UpdateButton" Content="版本号: ?.?.?" Grid.Row="1" Grid.Column="0" Margin="5" Foreground="#FF2196F3" ToolTip="https://spacetime.lanzouu.com/b017hp0lc" Click="AboutButton_Click" />
|
|
||||||
<Button x:Name="EmailButton" Content="联系邮箱" Grid.Row="1" Grid.Column="1" Margin="5" ToolTip="Zeus6_6@163.com" />
|
|
||||||
|
|
||||||
<Button x:Name="HomePageButton" Content="使用文档" Grid.Row="0" Grid.Column="2" Margin="5" ToolTip="https://github.com/SpaceTimee/Sheas-Cealer/wiki/Sheas-Cealer-Instruction" Click="AboutButton_Click" />
|
|
||||||
<Button x:Name="OpenSourceButton" Content="开源地址" Grid.Row="1" Grid.Column="2" Margin="5" ToolTip="https://github.com/SpaceTimee/Sheas-Cealer" Click="AboutButton_Click" />
|
|
||||||
|
|
||||||
<Button x:Name="PrivacyButton" Content="隐私政策" Grid.Row="0" Grid.Column="3" Margin="5" ToolTip="https://thoughts.teambition.com/share/6264eda98adeb10041b92fda#title=Sheas_Cealer_隐私政策" Click="AboutButton_Click" />
|
|
||||||
<Button x:Name="AgreementButton" Content="使用协议" Grid.Row="1" Grid.Column="3" Margin="5" ToolTip="https://thoughts.teambition.com/share/6264edd78adeb10041b92fdb#title=Sheas_Cealer_使用协议" Click="AboutButton_Click" />
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
@ -1,38 +0,0 @@
|
|||||||
<Window x:Class="Sheas_Cealer.MainWindow"
|
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
mc:Ignorable="d"
|
|
||||||
Style="{DynamicResource CommonWindow}"
|
|
||||||
WindowStartupLocation="CenterScreen" SizeToContent="Height" ResizeMode="CanMinimize" Width="500" MinWidth="500" AllowDrop="True" Loaded="MainWin_Loaded" Closing="MainWin_Closing" KeyDown="MainWin_KeyDown" DragEnter="MainWin_DragEnter" Drop="MainWin_Drop">
|
|
||||||
<Grid Margin="5">
|
|
||||||
<Grid.RowDefinitions>
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
<RowDefinition Height="*" />
|
|
||||||
</Grid.RowDefinitions>
|
|
||||||
|
|
||||||
<Grid Grid.Row="0" Margin="5">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<TextBox x:Name="PathBox" Text="(填入任意以 Chromium 为内核的浏览器的路径)" Foreground="#FFBFCDDB" Grid.Column="0" Margin="0,0,10,0" VerticalContentAlignment="Center" GotFocus="PathBox_GotFocus" LostFocus="PathBox_LostFocus" TextChanged="PathBox_TextChanged" PreviewDragOver="MainWin_DragEnter" />
|
|
||||||
<Button x:Name="BrowseButton" Grid.Column="2" Content="浏览" Click="BrowseButton_Click" />
|
|
||||||
</Grid>
|
|
||||||
|
|
||||||
<Button x:Name="StartButton" Content="启动伪造" Grid.Row="1" Margin="5" IsDefault="True" IsEnabled="False" Click="StartButton_Click" />
|
|
||||||
|
|
||||||
<Grid Grid.Row="2" Margin="0,5">
|
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<Button x:Name="HostEditButton" Content="编辑规则" Grid.Column="0" Margin="5,0" Click="HostEditButton_Click" />
|
|
||||||
<Button x:Name="HostUpdateButton" Content="更新规则" Grid.Column="1" Margin="5,0" Click="HostUpdateButton_Click" />
|
|
||||||
<Button x:Name="AboutButton" Content="关于项目" Grid.Column="2" Margin="5,0" Click="AboutButton_Click" />
|
|
||||||
</Grid>
|
|
||||||
</Grid>
|
|
||||||
</Window>
|
|
63
Wins/AboutWin.xaml
Normal file
63
Wins/AboutWin.xaml
Normal file
@ -0,0 +1,63 @@
|
|||||||
|
<Window x:Class="Sheas_Cealer.Wins.AboutWin"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:convs="clr-namespace:Sheas_Cealer.Convs"
|
||||||
|
xmlns:consts="clr-namespace:Sheas_Cealer.Consts"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
Style="{DynamicResource CommonWindow}" WindowStartupLocation="CenterScreen" ResizeMode="NoResize" SizeToContent="Height" Width="500" MinWidth="500"
|
||||||
|
KeyDown="AboutWin_KeyDown">
|
||||||
|
<Window.Resources>
|
||||||
|
<consts:AboutConst x:Key="AboutConst" />
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="1.1*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button x:Name="DeveloperButton"
|
||||||
|
Content="{Binding DeveloperButtonContent, Source={StaticResource AboutConst}}" Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" Foreground="#FF2196F3" ToolTip="{Binding DeveloperButtonUrl, Source={StaticResource AboutConst}}"
|
||||||
|
Click="AboutButton_Click" />
|
||||||
|
<Button x:Name="VersionButton"
|
||||||
|
Grid.Row="1" Grid.Column="0" Margin="5" Foreground="#FF2196F3" ToolTip="{Binding VersionButtonUrl, Source={StaticResource AboutConst}}"
|
||||||
|
Click="AboutButton_Click">
|
||||||
|
<Button.Content>
|
||||||
|
<MultiBinding Mode="OneTime">
|
||||||
|
<MultiBinding.Converter>
|
||||||
|
<convs:AboutVersionButtonContentConv />
|
||||||
|
</MultiBinding.Converter>
|
||||||
|
|
||||||
|
<Binding Path="VersionButtonContent" Source="{StaticResource AboutConst}" />
|
||||||
|
<Binding Path="Version" Source="{StaticResource AboutConst}" />
|
||||||
|
|
||||||
|
</MultiBinding>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
<Button x:Name="EmailButton"
|
||||||
|
Content="{Binding EmailButtonContent, Source={StaticResource AboutConst}}" Grid.Row="1" Grid.Column="1" Margin="5" ToolTip="{Binding EmailButtonUrl, Source={StaticResource AboutConst}}" />
|
||||||
|
|
||||||
|
<Button x:Name="InstructionButton"
|
||||||
|
Content="{Binding InstructionButtonContent, Source={StaticResource AboutConst}}" Grid.Row="0" Grid.Column="2" Margin="5" ToolTip="{Binding InstructionButtonUrl, Source={StaticResource AboutConst}}"
|
||||||
|
Click="AboutButton_Click" />
|
||||||
|
<Button x:Name="OpenSourceButton"
|
||||||
|
Content="{Binding OpenSourceButtonContent, Source={StaticResource AboutConst}}" Grid.Row="1" Grid.Column="2" Margin="5" ToolTip="{Binding OpenSourceButtonUrl, Source={StaticResource AboutConst}}"
|
||||||
|
Click="AboutButton_Click" />
|
||||||
|
|
||||||
|
<Button x:Name="PrivacyButton"
|
||||||
|
Content="{Binding PrivacyButtonContent, Source={StaticResource AboutConst}}" Grid.Row="0" Grid.Column="3" Margin="5" ToolTip="{Binding PrivacyButtonUrl, Source={StaticResource AboutConst}}"
|
||||||
|
Click="AboutButton_Click" />
|
||||||
|
<Button x:Name="AgreementButton"
|
||||||
|
Content="{Binding AgreementButtonContent, Source={StaticResource AboutConst}}" Grid.Row="1" Grid.Column="3" Margin="5" ToolTip="{Binding AgreementButtonUrl, Source={StaticResource AboutConst}}"
|
||||||
|
Click="AboutButton_Click" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
@ -1,25 +1,23 @@
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Reflection;
|
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
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();
|
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)
|
private void AboutButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender == UpdateButton)
|
if (sender == VersionButton)
|
||||||
MessageBox.Show("密码: 3wnj");
|
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);
|
Process.Start(processStartInfo);
|
||||||
}
|
}
|
||||||
|
|
94
Wins/MainWin.xaml
Normal file
94
Wins/MainWin.xaml
Normal file
@ -0,0 +1,94 @@
|
|||||||
|
<Window x:Class="Sheas_Cealer.Wins.MainWin"
|
||||||
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:preses="clr-namespace:Sheas_Cealer.Preses"
|
||||||
|
xmlns:convs="clr-namespace:Sheas_Cealer.Convs"
|
||||||
|
xmlns:consts="clr-namespace:Sheas_Cealer.Consts"
|
||||||
|
xmlns:utils="clr-namespace:Sheas_Cealer.Utils"
|
||||||
|
mc:Ignorable="d"
|
||||||
|
d:DataContext="{d:DesignInstance preses:MainPres}" AllowDrop="True"
|
||||||
|
Style="{DynamicResource CommonWindow}" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize" SizeToContent="Height" Width="500" MinWidth="500"
|
||||||
|
Loaded="MainWin_Loaded" Closing="MainWin_Closing" DragEnter="MainWin_DragEnter" Drop="MainWin_Drop" KeyDown="MainWin_KeyDown">
|
||||||
|
<Window.Resources>
|
||||||
|
<consts:MainConst x:Key="MainConst" />
|
||||||
|
</Window.Resources>
|
||||||
|
|
||||||
|
<Grid Margin="5">
|
||||||
|
<Grid.RowDefinitions>
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
<RowDefinition Height="*" />
|
||||||
|
</Grid.RowDefinitions>
|
||||||
|
|
||||||
|
<Grid Grid.Row="0">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<TextBox utils:FocusExtension.IsFocused="{Binding IsContentBoxFocused}"
|
||||||
|
Grid.Column="0" Margin="5" VerticalContentAlignment="Center"
|
||||||
|
TextChanged="ContentBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
|
||||||
|
<TextBox.Text>
|
||||||
|
<MultiBinding Mode="OneWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
|
<MultiBinding.Converter>
|
||||||
|
<convs:MainContentBoxTextConv />
|
||||||
|
</MultiBinding.Converter>
|
||||||
|
|
||||||
|
<Binding Path="Mode" />
|
||||||
|
<Binding Path="IsFocused" RelativeSource="{RelativeSource Self}" />
|
||||||
|
<Binding Path="BrowserPath" />
|
||||||
|
<Binding Path="UpstreamUrl" />
|
||||||
|
<Binding Path="ExtraArgs" />
|
||||||
|
|
||||||
|
</MultiBinding>
|
||||||
|
</TextBox.Text>
|
||||||
|
<TextBox.Foreground>
|
||||||
|
<MultiBinding Mode="OneWay">
|
||||||
|
<MultiBinding.Converter>
|
||||||
|
<convs:MainContentBoxForegroundConv />
|
||||||
|
</MultiBinding.Converter>
|
||||||
|
|
||||||
|
<Binding Path="Mode" />
|
||||||
|
<Binding Path="IsFocused" RelativeSource="{RelativeSource Self}" />
|
||||||
|
<Binding Path="BrowserPath" />
|
||||||
|
<Binding Path="UpstreamUrl" />
|
||||||
|
<Binding Path="ExtraArgs" />
|
||||||
|
|
||||||
|
</MultiBinding>
|
||||||
|
</TextBox.Foreground>
|
||||||
|
</TextBox>
|
||||||
|
<Button Grid.Column="1" Margin="5" Content="{Binding BrowseButtonContent, Source={StaticResource MainConst}}"
|
||||||
|
Click="BrowseButton_Click" />
|
||||||
|
<Button Grid.Column="2" Margin="5" Content="{Binding SwitchModeButtonContent, Source={StaticResource MainConst}}"
|
||||||
|
Click="SwitchModeButton_Click" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
|
||||||
|
<Button IsDefault="True"
|
||||||
|
Grid.Row="1" Margin="5" Content="{Binding StartCealButtonContent, Source={StaticResource MainConst}}"
|
||||||
|
Click="StartCealButton_Click" />
|
||||||
|
|
||||||
|
<Grid Grid.Row="2">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button x:Name="EditHostButton"
|
||||||
|
Grid.Column="0" Margin="5" Content="{Binding EditHostButtonContent, Source={StaticResource MainConst}}"
|
||||||
|
Click="EditHostButton_Click" />
|
||||||
|
<Button x:Name="UpdateHostButton"
|
||||||
|
Grid.Column="1" Margin="5" Content="{Binding UpdateHostButtonContent, Source={StaticResource MainConst}}"
|
||||||
|
Click="UpdateHostButton_Click" />
|
||||||
|
<Button x:Name="AboutButton"
|
||||||
|
Grid.Column="2" Margin="5" Content="{Binding AboutButtonContent, Source={StaticResource MainConst}}"
|
||||||
|
Click="AboutButton_Click" />
|
||||||
|
|
||||||
|
</Grid>
|
||||||
|
</Grid>
|
||||||
|
</Window>
|
@ -3,79 +3,45 @@ using System.ComponentModel;
|
|||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using System.Text.RegularExpressions;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Controls;
|
using System.Windows.Controls;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
using System.Windows.Media;
|
|
||||||
using System.Windows.Threading;
|
|
||||||
using IWshRuntimeLibrary;
|
using IWshRuntimeLibrary;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using OnaCore;
|
using OnaCore;
|
||||||
|
using Sheas_Cealer.Consts;
|
||||||
|
using Sheas_Cealer.Preses;
|
||||||
|
using Sheas_Cealer.Utils;
|
||||||
using File = System.IO.File;
|
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 string CealArgs = string.Empty;
|
||||||
private static readonly FileSystemWatcher CEALING_HOST_WATCHER = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
|
private static readonly HttpClient MainClient = new();
|
||||||
[GeneratedRegex(@"\r")] private static partial Regex HOST_REGEX();
|
private static readonly FileSystemWatcher CealingHostWatcher = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
|
||||||
private static string? CEALING_ARGUMENT;
|
private static MainPres? MainPres;
|
||||||
|
private static readonly MainConst MainConst = new();
|
||||||
|
|
||||||
internal MainWindow(string[] args)
|
internal MainWin(string[] args)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
|
||||||
|
MainPres = new(args);
|
||||||
|
DataContext = MainPres;
|
||||||
|
|
||||||
Task.Run(() =>
|
Task.Run(() =>
|
||||||
{
|
{
|
||||||
if (args.Length > 0)
|
CealingHostWatcher.Changed += CealingHostWatcher_Changed;
|
||||||
Dispatcher.Invoke(() => PathBox.Text = args[0]);
|
CealingHostWatcher_Changed(null!, null!);
|
||||||
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!);
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
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 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)
|
private void MainWin_DragEnter(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
||||||
@ -88,73 +54,101 @@ namespace Sheas_Cealer
|
|||||||
private void MainWin_Drop(object sender, DragEventArgs e)
|
private void MainWin_Drop(object sender, DragEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.Data.GetDataPresent(DataFormats.FileDrop))
|
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)
|
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
|
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == true)
|
if (openFileDialog.ShowDialog() == true)
|
||||||
{
|
{
|
||||||
PathBox.Focus();
|
MainPres!.IsContentBoxFocused = true;
|
||||||
PathBox.Text = openFileDialog.FileName;
|
MainPres!.BrowserPath = openFileDialog.FileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
|
||||||
private void StartButton_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("规则无法识别,请检查伪造规则是否含有语法错误");
|
throw new Exception("规则无法识别,请检查伪造规则是否含有语法错误");
|
||||||
if (MessageBox.Show("启动前将关闭所选浏览器的所有进程,是否继续?", string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
if (MessageBox.Show("启动前将关闭所选浏览器的所有进程,是否继续?", string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
IWshShortcut uncealedBrowserShortcut = (IWshShortcut)new WshShell().CreateShortcut(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Uncealed-Browser.lnk"));
|
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.Description = "Created By Sheas Cealer";
|
||||||
uncealedBrowserShortcut.Save();
|
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.Kill();
|
||||||
browserProcess.WaitForExit();
|
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 };
|
ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json")) { UseShellExecute = true };
|
||||||
Process.Start(processStartInfo);
|
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<string>(hostUrl, MAIN_CLIENT);
|
string UpdateHostString = await Http.GetAsync<string>(hostUrl, MainClient);
|
||||||
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
|
StreamReader hostLocalStreamReader = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"));
|
||||||
string hostLocalString = hostLocalStreamReader.ReadToEnd();
|
string hostLocalString = hostLocalStreamReader.ReadToEnd();
|
||||||
hostLocalStreamReader.Close();
|
hostLocalStreamReader.Close();
|
||||||
|
|
||||||
if (HOST_REGEX().Replace(hostLocalString, string.Empty) == hostUpdateString)
|
if (MainConst.HostRegex().Replace(hostLocalString, string.Empty) == UpdateHostString)
|
||||||
MessageBox.Show("本地伪造规则和上游一模一样");
|
MessageBox.Show("本地伪造规则和上游一模一样");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
MessageBoxResult overrideResult = MessageBox.Show("本地伪造规则和上游略有不同,需要覆盖本地吗? 否则只为你打开上游规则的网页", "", MessageBoxButton.YesNoCancel);
|
MessageBoxResult overrideResult = MessageBox.Show("本地伪造规则和上游略有不同,需要覆盖本地吗? 否则只为你打开上游规则的网页", string.Empty, MessageBoxButton.YesNoCancel);
|
||||||
if (overrideResult == MessageBoxResult.Yes)
|
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("更新已完成");
|
MessageBox.Show("更新已完成");
|
||||||
}
|
}
|
||||||
else if (overrideResult == MessageBoxResult.No)
|
else if (overrideResult == MessageBoxResult.No)
|
||||||
Process.Start(new ProcessStartInfo(hostUrl) { UseShellExecute = true });
|
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 CealingHostWatcher_Changed(object sender, FileSystemEventArgs e)
|
||||||
|
|
||||||
private void CEALING_HOST_WATCHER_Changed(object sender, FileSystemEventArgs e)
|
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@ -168,18 +162,21 @@ namespace Sheas_Cealer
|
|||||||
if (string.IsNullOrWhiteSpace(hostJToken[1]!.ToString()))
|
if (string.IsNullOrWhiteSpace(hostJToken[1]!.ToString()))
|
||||||
hostJToken[1] = "c" + ruleIndex;
|
hostJToken[1] = "c" + ruleIndex;
|
||||||
|
|
||||||
hostResolverRules += "MAP " + hostJToken[1]!.ToString() + " " + hostJToken[2]!.ToString() + ",";
|
|
||||||
foreach (var hostName in hostJToken[0]!)
|
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;
|
++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)
|
private void MainWin_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.W)
|
if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.W)
|
Loading…
Reference in New Issue
Block a user