mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-09-14 13:56:56 +08:00
1.1.0 -> 1.1.1 第4次更新
This commit is contained in:
parent
987a97802b
commit
455ade0b2d
60
Consts/MainMultilangConst.Designer.cs
generated
60
Consts/MainMultilangConst.Designer.cs
generated
@ -69,15 +69,6 @@ namespace Sheas_Cealer.Consts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 查找类似 Browse 的本地化字符串。
|
|
||||||
/// </summary>
|
|
||||||
public static string BrowseButtonContent {
|
|
||||||
get {
|
|
||||||
return ResourceManager.GetString("BrowseButtonContent", resourceCulture);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 (Fill in the path of a Chromium-based browser) 的本地化字符串。
|
/// 查找类似 (Fill in the path of a Chromium-based browser) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -105,6 +96,33 @@ namespace Sheas_Cealer.Consts {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Browse 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string FunctionButtonBrowserPathContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("FunctionButtonBrowserPathContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Clear 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string FunctionButtonExtraArgsContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("FunctionButtonExtraArgsContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Reset 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string FunctionButtonUpstreamUrlContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("FunctionButtonUpstreamUrlContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Start Cealing 的本地化字符串。
|
/// 查找类似 Start Cealing 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -115,11 +133,29 @@ namespace Sheas_Cealer.Consts {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Switch 的本地化字符串。
|
/// 查找类似 Browser Path > 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string SwitchModeButtonContent {
|
public static string SwitchModeButtonBrowserPathContent {
|
||||||
get {
|
get {
|
||||||
return ResourceManager.GetString("SwitchModeButtonContent", resourceCulture);
|
return ResourceManager.GetString("SwitchModeButtonBrowserPathContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Additional Args > 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string SwitchModeButtonExtraArgsContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SwitchModeButtonExtraArgsContent", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Upstream Url > 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string SwitchModeButtonUpstreamUrlContent {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("SwitchModeButtonUpstreamUrlContent", resourceCulture);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,9 +100,6 @@
|
|||||||
<data name="AboutButtonContent" xml:space="preserve">
|
<data name="AboutButtonContent" xml:space="preserve">
|
||||||
<value>About Me</value>
|
<value>About Me</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="BrowseButtonContent" xml:space="preserve">
|
|
||||||
<value>Browse</value>
|
|
||||||
</data>
|
|
||||||
<data name="BrowserPathPlaceHolder" xml:space="preserve">
|
<data name="BrowserPathPlaceHolder" xml:space="preserve">
|
||||||
<value>(Fill in the path of a Chromium-based browser)</value>
|
<value>(Fill in the path of a Chromium-based browser)</value>
|
||||||
</data>
|
</data>
|
||||||
@ -112,12 +109,27 @@
|
|||||||
<data name="ExtraArgsPlaceHolder" xml:space="preserve">
|
<data name="ExtraArgsPlaceHolder" xml:space="preserve">
|
||||||
<value>(fill in extra Chromium startup arguments)</value>
|
<value>(fill in extra Chromium startup arguments)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SwitchModeButtonContent" xml:space="preserve">
|
<data name="FunctionButtonBrowserPathContent" xml:space="preserve">
|
||||||
<value>Switch</value>
|
<value>Browse</value>
|
||||||
|
</data>
|
||||||
|
<data name="FunctionButtonExtraArgsContent" xml:space="preserve">
|
||||||
|
<value>Clear</value>
|
||||||
|
</data>
|
||||||
|
<data name="FunctionButtonUpstreamUrlContent" xml:space="preserve">
|
||||||
|
<value>Reset</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StartCealButtonContent" xml:space="preserve">
|
<data name="StartCealButtonContent" xml:space="preserve">
|
||||||
<value>Start Cealing</value>
|
<value>Start Cealing</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SwitchModeButtonBrowserPathContent" xml:space="preserve">
|
||||||
|
<value>Browser Path ></value>
|
||||||
|
</data>
|
||||||
|
<data name="SwitchModeButtonExtraArgsContent" xml:space="preserve">
|
||||||
|
<value>Additional Args ></value>
|
||||||
|
</data>
|
||||||
|
<data name="SwitchModeButtonUpstreamUrlContent" xml:space="preserve">
|
||||||
|
<value>Upstream Url ></value>
|
||||||
|
</data>
|
||||||
<data name="UpdateHostButtonContent" xml:space="preserve">
|
<data name="UpdateHostButtonContent" xml:space="preserve">
|
||||||
<value>Update Host</value>
|
<value>Update Host</value>
|
||||||
</data>
|
</data>
|
||||||
|
@ -120,9 +120,6 @@
|
|||||||
<data name="AboutButtonContent" xml:space="preserve">
|
<data name="AboutButtonContent" xml:space="preserve">
|
||||||
<value>关于项目</value>
|
<value>关于项目</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="BrowseButtonContent" xml:space="preserve">
|
|
||||||
<value>浏览</value>
|
|
||||||
</data>
|
|
||||||
<data name="BrowserPathPlaceHolder" xml:space="preserve">
|
<data name="BrowserPathPlaceHolder" xml:space="preserve">
|
||||||
<value>(填入任意以 Chromium 为内核的浏览器的路径)</value>
|
<value>(填入任意以 Chromium 为内核的浏览器的路径)</value>
|
||||||
</data>
|
</data>
|
||||||
@ -132,12 +129,27 @@
|
|||||||
<data name="ExtraArgsPlaceHolder" xml:space="preserve">
|
<data name="ExtraArgsPlaceHolder" xml:space="preserve">
|
||||||
<value>(填入任意额外的 Chromium 启动参数)</value>
|
<value>(填入任意额外的 Chromium 启动参数)</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="SwitchModeButtonContent" xml:space="preserve">
|
<data name="FunctionButtonBrowserPathContent" xml:space="preserve">
|
||||||
<value>切换</value>
|
<value>浏览</value>
|
||||||
|
</data>
|
||||||
|
<data name="FunctionButtonExtraArgsContent" xml:space="preserve">
|
||||||
|
<value>清除</value>
|
||||||
|
</data>
|
||||||
|
<data name="FunctionButtonUpstreamUrlContent" xml:space="preserve">
|
||||||
|
<value>重置</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="StartCealButtonContent" xml:space="preserve">
|
<data name="StartCealButtonContent" xml:space="preserve">
|
||||||
<value>启动伪造</value>
|
<value>启动伪造</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="SwitchModeButtonBrowserPathContent" xml:space="preserve">
|
||||||
|
<value>文件路径 ></value>
|
||||||
|
</data>
|
||||||
|
<data name="SwitchModeButtonExtraArgsContent" xml:space="preserve">
|
||||||
|
<value>额外参数 ></value>
|
||||||
|
</data>
|
||||||
|
<data name="SwitchModeButtonUpstreamUrlContent" xml:space="preserve">
|
||||||
|
<value>上游链接 ></value>
|
||||||
|
</data>
|
||||||
<data name="UpdateHostButtonContent" xml:space="preserve">
|
<data name="UpdateHostButtonContent" xml:space="preserve">
|
||||||
<value>更新规则</value>
|
<value>更新规则</value>
|
||||||
</data>
|
</data>
|
||||||
|
30
Convs/MainFunctionButtonContentConv.cs
Normal file
30
Convs/MainFunctionButtonContentConv.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Sheas_Cealer.Consts;
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Convs
|
||||||
|
{
|
||||||
|
internal class MainFunctionButtonContentConv : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
MainConst.Mode? mode = value as MainConst.Mode?;
|
||||||
|
|
||||||
|
if (mode == MainConst.Mode.browserPathMode)
|
||||||
|
return MainConst.FunctionButtonBrowserPathContent;
|
||||||
|
else if (mode == MainConst.Mode.upstreamUrlMode)
|
||||||
|
return MainConst.FunctionButtonUpstreamUrlContent;
|
||||||
|
else if (mode == MainConst.Mode.extraArgsMode)
|
||||||
|
return MainConst.FunctionButtonExtraArgsContent;
|
||||||
|
|
||||||
|
throw new UnreachableException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -11,10 +11,9 @@ namespace Sheas_Cealer.Convs
|
|||||||
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
string? browserPath = values[0] as string;
|
string? browserPath = values[0] as string;
|
||||||
string? upstreamUrl = values[1] as string;
|
string? extraArgs = values[1] as string;
|
||||||
string? extraArgs = values[2] as string;
|
|
||||||
|
|
||||||
if (File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && MainConst.UrlRegex().IsMatch(upstreamUrl!) && MainConst.ArgsRegex().IsMatch(extraArgs!))
|
if (File.Exists(browserPath) && Path.GetFileName(browserPath).ToLower().EndsWith(".exe") && (MainConst.ArgsRegex().IsMatch(extraArgs!) || extraArgs == MainConst.ExtraArgsPlaceHolder))
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
30
Convs/MainSwitchModeButtonContentConv.cs
Normal file
30
Convs/MainSwitchModeButtonContentConv.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
using System;
|
||||||
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Sheas_Cealer.Consts;
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Convs
|
||||||
|
{
|
||||||
|
internal class MainSwitchModeButtonContentConv : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
MainConst.Mode? mode = value as MainConst.Mode?;
|
||||||
|
|
||||||
|
if (mode == MainConst.Mode.browserPathMode)
|
||||||
|
return MainConst.SwitchModeButtonBrowserPathContent;
|
||||||
|
else if (mode == MainConst.Mode.upstreamUrlMode)
|
||||||
|
return MainConst.SwitchModeButtonUpstreamUrlContent;
|
||||||
|
else if (mode == MainConst.Mode.extraArgsMode)
|
||||||
|
return MainConst.SwitchModeButtonExtraArgsContent;
|
||||||
|
|
||||||
|
throw new UnreachableException();
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
25
Convs/MainUpdateHostButtonIsEnabledConv.cs
Normal file
25
Convs/MainUpdateHostButtonIsEnabledConv.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
using System;
|
||||||
|
using System.Globalization;
|
||||||
|
using System.Windows.Data;
|
||||||
|
using Sheas_Cealer.Consts;
|
||||||
|
|
||||||
|
namespace Sheas_Cealer.Convs
|
||||||
|
{
|
||||||
|
internal class MainUpdateHostButtonIsEnabledConv : IValueConverter
|
||||||
|
{
|
||||||
|
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
string? upstreamUrl = value as string;
|
||||||
|
|
||||||
|
if (MainConst.UrlRegex().IsMatch(upstreamUrl!))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -24,13 +24,24 @@
|
|||||||
|
|
||||||
<Grid Grid.Row="0">
|
<Grid Grid.Row="0">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="*" />
|
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition Width="*" />
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
|
||||||
|
<Button Grid.Column="0" Margin="5"
|
||||||
|
Click="SwitchModeButton_Click">
|
||||||
|
<Button.Content>
|
||||||
|
<Binding Path="Mode">
|
||||||
|
<Binding.Converter>
|
||||||
|
<convs:MainSwitchModeButtonContentConv />
|
||||||
|
</Binding.Converter>
|
||||||
|
</Binding>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
<TextBox x:Name="ContentText" utils:FocusExtension.IsFocused="{Binding IsContentBoxFocused}"
|
<TextBox x:Name="ContentText" utils:FocusExtension.IsFocused="{Binding IsContentBoxFocused}"
|
||||||
Grid.Column="0" Margin="5" VerticalContentAlignment="Center"
|
Grid.Column="1" Margin="5" VerticalContentAlignment="Center"
|
||||||
TextChanged="ContentBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
|
TextChanged="ContentBox_TextChanged" PreviewDragOver="MainWin_DragEnter">
|
||||||
<TextBox.Text>
|
<TextBox.Text>
|
||||||
<MultiBinding Mode="OneWay" UpdateSourceTrigger="PropertyChanged">
|
<MultiBinding Mode="OneWay" UpdateSourceTrigger="PropertyChanged">
|
||||||
@ -61,10 +72,16 @@
|
|||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</TextBox.Foreground>
|
</TextBox.Foreground>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
<Button Grid.Column="1" Margin="5" Content="{Binding BrowseButtonContent, Source={StaticResource MainConst}}"
|
<Button Grid.Column="2" Margin="5"
|
||||||
Click="BrowseButton_Click" />
|
Click="FunctionButton_Click">
|
||||||
<Button Grid.Column="2" Margin="5" Content="{Binding SwitchModeButtonContent, Source={StaticResource MainConst}}"
|
<Button.Content>
|
||||||
Click="SwitchModeButton_Click" />
|
<Binding Path="Mode">
|
||||||
|
<Binding.Converter>
|
||||||
|
<convs:MainFunctionButtonContentConv />
|
||||||
|
</Binding.Converter>
|
||||||
|
</Binding>
|
||||||
|
</Button.Content>
|
||||||
|
</Button>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
@ -79,7 +96,6 @@
|
|||||||
</MultiBinding.Converter>
|
</MultiBinding.Converter>
|
||||||
|
|
||||||
<Binding Path="BrowserPath" />
|
<Binding Path="BrowserPath" />
|
||||||
<Binding Path="UpstreamUrl" />
|
|
||||||
<Binding Path="ExtraArgs" />
|
<Binding Path="ExtraArgs" />
|
||||||
|
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
@ -98,7 +114,15 @@
|
|||||||
Click="EditHostButton_Click" />
|
Click="EditHostButton_Click" />
|
||||||
<Button x:Name="UpdateHostButton"
|
<Button x:Name="UpdateHostButton"
|
||||||
Grid.Column="1" Margin="5" Content="{Binding UpdateHostButtonContent, Source={StaticResource MainConst}}"
|
Grid.Column="1" Margin="5" Content="{Binding UpdateHostButtonContent, Source={StaticResource MainConst}}"
|
||||||
Click="UpdateHostButton_Click" />
|
Click="UpdateHostButton_Click">
|
||||||
|
<Button.IsEnabled>
|
||||||
|
<Binding Path="UpstreamUrl">
|
||||||
|
<Binding.Converter>
|
||||||
|
<convs:MainUpdateHostButtonIsEnabledConv />
|
||||||
|
</Binding.Converter>
|
||||||
|
</Binding>
|
||||||
|
</Button.IsEnabled>
|
||||||
|
</Button>
|
||||||
<Button x:Name="AboutButton"
|
<Button x:Name="AboutButton"
|
||||||
Grid.Column="2" Margin="5" Content="{Binding AboutButtonContent, Source={StaticResource MainConst}}"
|
Grid.Column="2" Margin="5" Content="{Binding AboutButtonContent, Source={StaticResource MainConst}}"
|
||||||
Click="AboutButton_Click" />
|
Click="AboutButton_Click" />
|
||||||
|
@ -70,15 +70,22 @@ namespace Sheas_Cealer.Wins
|
|||||||
else
|
else
|
||||||
throw new UnreachableException();
|
throw new UnreachableException();
|
||||||
}
|
}
|
||||||
private void BrowseButton_Click(object sender, RoutedEventArgs e)
|
private void FunctionButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
|
if (MainPres!.Mode == MainConst.Mode.browserPathMode)
|
||||||
|
|
||||||
if (openFileDialog.ShowDialog() == true)
|
|
||||||
{
|
{
|
||||||
MainPres!.IsContentBoxFocused = true;
|
OpenFileDialog openFileDialog = new() { Filter = "浏览器 (*.exe)|*.exe" };
|
||||||
MainPres!.BrowserPath = openFileDialog.FileName;
|
|
||||||
|
if (openFileDialog.ShowDialog() == true)
|
||||||
|
{
|
||||||
|
MainPres!.IsContentBoxFocused = true;
|
||||||
|
MainPres!.BrowserPath = openFileDialog.FileName;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
else if (MainPres!.Mode == MainConst.Mode.upstreamUrlMode)
|
||||||
|
MainPres!.UpstreamUrl = MainConst.DefaultUpstreamUrl;
|
||||||
|
else if (MainPres!.Mode == MainConst.Mode.extraArgsMode)
|
||||||
|
MainPres!.ExtraArgs = string.Empty;
|
||||||
}
|
}
|
||||||
private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
|
private void SwitchModeButton_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user