1.1.1 -> 1.1.2 第19次更新

This commit is contained in:
Space Time 2024-10-03 18:23:00 +08:00
parent 105e6ce908
commit ee1aa2be3e
8 changed files with 277 additions and 27 deletions

View File

@ -70,7 +70,7 @@ namespace Sheas_Cealer.Consts {
} }
/// <summary> /// <summary>
/// 查找类似 The config cannot be recognized, check if the config contain syntax errors 的本地化字符串。 /// 查找类似 The config cannot be recognized. Check if the config contain syntax errors 的本地化字符串。
/// </summary> /// </summary>
public static string _ConfErrorHint { public static string _ConfErrorHint {
get { get {
@ -79,7 +79,70 @@ namespace Sheas_Cealer.Consts {
} }
/// <summary> /// <summary>
/// 查找类似 The args cannot be recognized, check if the hosts contain syntax errors 的本地化字符串。 /// 查找类似 I know you would do it, but nothing will actually happen. Whee. 的本地化字符串。
/// </summary>
public static string _GameClickOnceMsg {
get {
return ResourceManager.GetString("_GameClickOnceMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 Ugh, what are you doing. Please stop, I don&apos;t want to hurt anyone. Stop please, this is your last chance. Ugh, I can&apos;t control it anymore. 的本地化字符串。
/// </summary>
public static string _GameClickThreeMsg {
get {
return ResourceManager.GetString("_GameClickThreeMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 No no no, don&apos;t click me. Sorry, I shouldn&apos;t have lied to you, I am a cursed button, and continuing to click me will bring disaster to the entire Sheas Cealer. Please believe me, this is not a game, and there are no new features here. Listen to me and use the normal functions, okay? 的本地化字符串。
/// </summary>
public static string _GameClickTwiceMsg {
get {
return ResourceManager.GetString("_GameClickTwiceMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 You defeated the evil button and saved Sheas Cealer, you are hero 的本地化字符串。
/// </summary>
public static string _GameEndingMsg {
get {
return ResourceManager.GetString("_GameEndingMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 Button Remaining HP. 的本地化字符串。
/// </summary>
public static string _GameGradeMsg {
get {
return ResourceManager.GetString("_GameGradeMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 It&apos;s dead, and you&apos;re the hero of Sheas Cealer 的本地化字符串。
/// </summary>
public static string _GameReviewEndingMsg {
get {
return ResourceManager.GetString("_GameReviewEndingMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 No, please kill me, I...can&apos;t control myself... 的本地化字符串。
/// </summary>
public static string _GameStartMsg {
get {
return ResourceManager.GetString("_GameStartMsg", resourceCulture);
}
}
/// <summary>
/// 查找类似 The args cannot be recognized. Check if the hosts contain syntax errors 的本地化字符串。
/// </summary> /// </summary>
public static string _HostErrorHint { public static string _HostErrorHint {
get { get {
@ -88,7 +151,7 @@ namespace Sheas_Cealer.Consts {
} }
/// <summary> /// <summary>
/// 查找类似 All processes of the selected browser will be closed before launching, do you want to continue? 的本地化字符串。 /// 查找类似 All processes of the selected browser will be closed before launching. Do you want to continue? 的本地化字符串。
/// </summary> /// </summary>
public static string _KillBrowserProcessPrompt { public static string _KillBrowserProcessPrompt {
get { get {
@ -303,21 +366,39 @@ namespace Sheas_Cealer.Consts {
} }
} }
/// <summary>
/// 查找类似 Click Now 的本地化字符串。
/// </summary>
public static string NoClickButtonIsFlashingContent {
get {
return ResourceManager.GetString("NoClickButtonIsFlashingContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click the button now 的本地化字符串。
/// </summary>
public static string NoClickButtonIsFlashingToolTip {
get {
return ResourceManager.GetString("NoClickButtonIsFlashingToolTip", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 No Clicking 的本地化字符串。 /// 查找类似 No Clicking 的本地化字符串。
/// </summary> /// </summary>
public static string NoClickButtonContent { public static string NoClickButtonIsStoppedContent {
get { get {
return ResourceManager.GetString("NoClickButtonContent", resourceCulture); return ResourceManager.GetString("NoClickButtonIsStoppedContent", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Donot click the button 的本地化字符串。 /// 查找类似 Donot click the button 的本地化字符串。
/// </summary> /// </summary>
public static string NoClickButtonToolTip { public static string NoClickButtonIsStoppedToolTip {
get { get {
return ResourceManager.GetString("NoClickButtonToolTip", resourceCulture); return ResourceManager.GetString("NoClickButtonIsStoppedToolTip", resourceCulture);
} }
} }

View File

@ -165,12 +165,6 @@
<data name="MihomoButtonIsStoppedToolTip" xml:space="preserve"> <data name="MihomoButtonIsStoppedToolTip" xml:space="preserve">
<value>Click to launch a local Mihomo</value> <value>Click to launch a local Mihomo</value>
</data> </data>
<data name="NoClickButtonContent" xml:space="preserve">
<value>No Clicking</value>
</data>
<data name="NoClickButtonToolTip" xml:space="preserve">
<value>Donot click the button</value>
</data>
<data name="NginxButtonIsRunningContent" xml:space="preserve"> <data name="NginxButtonIsRunningContent" xml:space="preserve">
<value>Stop Nginx</value> <value>Stop Nginx</value>
</data> </data>
@ -183,6 +177,18 @@
<data name="NginxButtonIsStoppedToolTip" xml:space="preserve"> <data name="NginxButtonIsStoppedToolTip" xml:space="preserve">
<value>Click to launch a local Nginx</value> <value>Click to launch a local Nginx</value>
</data> </data>
<data name="NoClickButtonIsFlashingContent" xml:space="preserve">
<value>Click Now</value>
</data>
<data name="NoClickButtonIsFlashingToolTip" xml:space="preserve">
<value>Click the button now</value>
</data>
<data name="NoClickButtonIsStoppedContent" xml:space="preserve">
<value>No Clicking</value>
</data>
<data name="NoClickButtonIsStoppedToolTip" xml:space="preserve">
<value>Donot click the button</value>
</data>
<data name="SettingsBoxBrowserPathToolTip" xml:space="preserve"> <data name="SettingsBoxBrowserPathToolTip" xml:space="preserve">
<value>Fill in a Chromium-based browser path</value> <value>Fill in a Chromium-based browser path</value>
</data> </data>
@ -238,13 +244,34 @@
<value>Browser</value> <value>Browser</value>
</data> </data>
<data name="_ConfErrorHint" xml:space="preserve"> <data name="_ConfErrorHint" xml:space="preserve">
<value>The config cannot be recognized, check if the config contain syntax errors</value> <value>The config cannot be recognized. Check if the config contain syntax errors</value>
</data>
<data name="_GameClickOnceMsg" xml:space="preserve">
<value>I know you would do it, but nothing will actually happen. Whee.</value>
</data>
<data name="_GameClickThreeMsg" xml:space="preserve">
<value>Ugh, what are you doing. Please stop, I don't want to hurt anyone. Stop please, this is your last chance. Ugh, I can't control it anymore.</value>
</data>
<data name="_GameClickTwiceMsg" xml:space="preserve">
<value>No no no, don't click me. Sorry, I shouldn't have lied to you, I am a cursed button, and continuing to click me will bring disaster to the entire Sheas Cealer. Please believe me, this is not a game, and there are no new features here. Listen to me and use the normal functions, okay?</value>
</data>
<data name="_GameEndingMsg" xml:space="preserve">
<value>You defeated the evil button and saved Sheas Cealer, you are hero</value>
</data>
<data name="_GameGradeMsg" xml:space="preserve">
<value>Button Remaining HP.</value>
</data>
<data name="_GameReviewEndingMsg" xml:space="preserve">
<value>It's dead, and you're the hero of Sheas Cealer</value>
</data>
<data name="_GameStartMsg" xml:space="preserve">
<value>No, please kill me, I...can't control myself...</value>
</data> </data>
<data name="_HostErrorHint" xml:space="preserve"> <data name="_HostErrorHint" xml:space="preserve">
<value>The args cannot be recognized, check if the hosts contain syntax errors</value> <value>The args cannot be recognized. Check if the hosts contain syntax errors</value>
</data> </data>
<data name="_KillBrowserProcessPrompt" xml:space="preserve"> <data name="_KillBrowserProcessPrompt" xml:space="preserve">
<value>All processes of the selected browser will be closed before launching, do you want to continue?</value> <value>All processes of the selected browser will be closed before launching. Do you want to continue?</value>
</data> </data>
<data name="_OverrideUpstreamHostPrompt" xml:space="preserve"> <data name="_OverrideUpstreamHostPrompt" xml:space="preserve">
<value>There is an update available. Do you want to update upstream host? If No it will only open the upstream host page for you</value> <value>There is an update available. Do you want to update upstream host? If No it will only open the upstream host page for you</value>

View File

@ -165,12 +165,6 @@
<data name="MihomoButtonIsStoppedToolTip" xml:space="preserve"> <data name="MihomoButtonIsStoppedToolTip" xml:space="preserve">
<value>点击启动本地 Mihomo</value> <value>点击启动本地 Mihomo</value>
</data> </data>
<data name="NoClickButtonContent" xml:space="preserve">
<value>不要点击</value>
</data>
<data name="NoClickButtonToolTip" xml:space="preserve">
<value>不要点击这个按钮</value>
</data>
<data name="NginxButtonIsRunningContent" xml:space="preserve"> <data name="NginxButtonIsRunningContent" xml:space="preserve">
<value>停止 Nginx</value> <value>停止 Nginx</value>
</data> </data>
@ -183,6 +177,18 @@
<data name="NginxButtonIsStoppedToolTip" xml:space="preserve"> <data name="NginxButtonIsStoppedToolTip" xml:space="preserve">
<value>点击启动本地 Nginx</value> <value>点击启动本地 Nginx</value>
</data> </data>
<data name="NoClickButtonIsFlashingContent" xml:space="preserve">
<value>赶紧点我</value>
</data>
<data name="NoClickButtonIsFlashingToolTip" xml:space="preserve">
<value>赶紧点击这个按钮</value>
</data>
<data name="NoClickButtonIsStoppedContent" xml:space="preserve">
<value>不要点我</value>
</data>
<data name="NoClickButtonIsStoppedToolTip" xml:space="preserve">
<value>不要点击这个按钮</value>
</data>
<data name="SettingsBoxBrowserPathToolTip" xml:space="preserve"> <data name="SettingsBoxBrowserPathToolTip" xml:space="preserve">
<value>填入任意以 Chromium 为内核的浏览器路径</value> <value>填入任意以 Chromium 为内核的浏览器路径</value>
</data> </data>
@ -240,6 +246,27 @@
<data name="_ConfErrorHint" xml:space="preserve"> <data name="_ConfErrorHint" xml:space="preserve">
<value>配置无法识别,请检查配置文件中是否含有语法错误</value> <value>配置无法识别,请检查配置文件中是否含有语法错误</value>
</data> </data>
<data name="_GameClickOnceMsg" xml:space="preserve">
<value>就知道你会点,但其实什么事情都不会发生的。嘻嘻</value>
</data>
<data name="_GameClickThreeMsg" xml:space="preserve">
<value>呜,你在做什么。求求你不要再继续点了,我不想伤害大家。快停下,这是最后一次机会。呃,我快要控制不住了</value>
</data>
<data name="_GameClickTwiceMsg" xml:space="preserve">
<value>不不不,不要点我。对不起,我不该骗你的,我是一个受诅咒的按钮,继续点我会给整个 Sheas Cealer 带来灾难的。请相信我,这不是游戏,这里也没有新功能。听我的,去用正常的功能好吗</value>
</data>
<data name="_GameEndingMsg" xml:space="preserve">
<value>你击败了邪恶的按钮,拯救了 Sheas Cealer你是英雄</value>
</data>
<data name="_GameGradeMsg" xml:space="preserve">
<value>按钮剩余血量:</value>
</data>
<data name="_GameReviewEndingMsg" xml:space="preserve">
<value>它死了,你是 Sheas Cealer 的英雄</value>
</data>
<data name="_GameStartMsg" xml:space="preserve">
<value>不,求你杀了我,我...控制不住自己了...</value>
</data>
<data name="_HostErrorHint" xml:space="preserve"> <data name="_HostErrorHint" xml:space="preserve">
<value>规则无法识别,请检查伪造规则中是否含有语法错误</value> <value>规则无法识别,请检查伪造规则中是否含有语法错误</value>
</data> </data>

View File

@ -0,0 +1,18 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Sheas_Cealer.Consts;
namespace Sheas_Cealer.Convs;
internal class MainNoClickButtonContentConv : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isFlashing = (bool)value;
return isFlashing ? MainConst.NoClickButtonIsFlashingContent : MainConst.NoClickButtonIsStoppedContent;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}

View File

@ -0,0 +1,18 @@
using System;
using System.Globalization;
using System.Windows.Data;
using Sheas_Cealer.Consts;
namespace Sheas_Cealer.Convs;
internal class MainNoClickButtonToolTipConv : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
bool isFlashing = (bool)value;
return isFlashing ? MainConst.NoClickButtonIsFlashingToolTip : MainConst.NoClickButtonIsStoppedToolTip;
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException();
}

View File

@ -92,4 +92,7 @@ internal partial class MainPres : ObservableObject
[ObservableProperty] [ObservableProperty]
private bool isMihomoRunning = Process.GetProcessesByName("Cealing-Mihomo").Length != 0; private bool isMihomoRunning = Process.GetProcessesByName("Cealing-Mihomo").Length != 0;
[ObservableProperty]
private bool isFlashing = false;
} }

View File

@ -234,8 +234,24 @@
Click="EditConfButton_Click" /> Click="EditConfButton_Click" />
<Button Grid.Column="1" Margin="5" Content="{Binding Source={x:Static consts:MainConst.EditMihomoConfButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.EditMihomoConfButtonToolTip}}" <Button Grid.Column="1" Margin="5" Content="{Binding Source={x:Static consts:MainConst.EditMihomoConfButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.EditMihomoConfButtonToolTip}}"
Click="EditConfButton_Click" /> Click="EditConfButton_Click" />
<Button Grid.Column="2" Margin="5" Content="{Binding Source={x:Static consts:MainConst.NoClickButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.NoClickButtonToolTip}}" <Button Focusable="False"
Click="NoClickButton_Click" /> Grid.Column="2" Margin="5" d:Content="# # # #"
Click="NoClickButton_Click" Cursor="Hand">
<Button.Content>
<Binding Path="IsFlashing">
<Binding.Converter>
<convs:MainNoClickButtonContentConv />
</Binding.Converter>
</Binding>
</Button.Content>
<Button.ToolTip>
<Binding Path="IsFlashing">
<Binding.Converter>
<convs:MainNoClickButtonToolTipConv />
</Binding.Converter>
</Binding>
</Button.ToolTip>
</Button>
</Grid> </Grid>
</Grid> </Grid>
</Window> </Window>

View File

@ -5,11 +5,14 @@ using System.Diagnostics;
using System.IO; using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Text.Json; using System.Text.Json;
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 System.Windows.Threading;
using IWshRuntimeLibrary; using IWshRuntimeLibrary;
using MaterialDesignThemes.Wpf;
using Microsoft.Win32; using Microsoft.Win32;
using OnaCore; using OnaCore;
using Sheas_Cealer.Consts; using Sheas_Cealer.Consts;
@ -29,6 +32,8 @@ public partial class MainWin : Window
private static readonly FileSystemWatcher HostWatcher = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host-*.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite }; private static readonly FileSystemWatcher HostWatcher = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host-*.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
private static readonly Dictionary<string, (string hostRulesFragments, string hostResolverRulesFragments)> CealArgsFragments = []; private static readonly Dictionary<string, (string hostRulesFragments, string hostResolverRulesFragments)> CealArgsFragments = [];
private static string CealArgs = string.Empty; private static string CealArgs = string.Empty;
private static int GameClickTime = 0;
private static int GameFlashInterval = 1000;
internal MainWin(string[] args) internal MainWin(string[] args)
{ {
@ -105,7 +110,7 @@ public partial class MainWin : Window
private void StartButton_Click(object sender, RoutedEventArgs e) private void StartButton_Click(object sender, RoutedEventArgs e)
{ {
if (HoldButtonTimer!.IsEnabled) if (HoldButtonTimer == null || HoldButtonTimer.IsEnabled)
StartButtonHoldTimer_Tick(null, null!); StartButtonHoldTimer_Tick(null, null!);
} }
private void StartButton_PreviewMouseDown(object sender, MouseButtonEventArgs e) private void StartButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
@ -116,7 +121,7 @@ public partial class MainWin : Window
} }
private void StartButtonHoldTimer_Tick(object? sender, EventArgs e) private void StartButtonHoldTimer_Tick(object? sender, EventArgs e)
{ {
HoldButtonTimer!.Stop(); HoldButtonTimer?.Stop();
if (string.IsNullOrWhiteSpace(CealArgs)) if (string.IsNullOrWhiteSpace(CealArgs))
throw new Exception(MainConst._HostErrorHint); throw new Exception(MainConst._HostErrorHint);
@ -254,9 +259,64 @@ public partial class MainWin : Window
ProcessStartInfo processStartInfo = new(confPath) { UseShellExecute = true }; ProcessStartInfo processStartInfo = new(confPath) { UseShellExecute = true };
Process.Start(processStartInfo); Process.Start(processStartInfo);
} }
private void NoClickButton_Click(object sender, RoutedEventArgs e) private async void NoClickButton_Click(object sender, RoutedEventArgs e)
{ {
if (GameFlashInterval <= 10)
{
MessageBox.Show(MainConst._GameReviewEndingMsg);
return;
}
++GameClickTime;
switch (GameClickTime)
{
case 1:
MessageBox.Show(MainConst._GameClickOnceMsg);
return;
case 2:
MessageBox.Show(MainConst._GameClickTwiceMsg);
return;
case 3:
MessageBox.Show(MainConst._GameClickThreeMsg);
return;
}
if (!MainPres!.IsFlashing)
{
MessageBox.Show(MainConst._GameStartMsg);
MainPres.IsFlashing = true;
Random random = new();
while (GameFlashInterval > 10)
{
Left = random.Next(0, (int)((int)SystemParameters.PrimaryScreenWidth - ActualWidth));
Top = random.Next(0, (int)(SystemParameters.PrimaryScreenHeight - ActualHeight));
PaletteHelper paletteHelper = new();
Theme newTheme = paletteHelper.GetTheme();
newTheme.SetPrimaryColor(Color.FromRgb((byte)random.Next(256), (byte)random.Next(256), (byte)random.Next(256)));
newTheme.SetBaseTheme(random.Next(2) == 0 ? BaseTheme.Light : BaseTheme.Dark);
paletteHelper.SetTheme(newTheme);
await Task.Delay(GameFlashInterval);
}
MainPres.IsFlashing = false;
MessageBox.Show(MainConst._GameEndingMsg);
}
else
{
if (GameFlashInterval > 100)
GameFlashInterval -= 150;
else if (GameFlashInterval > 10)
GameFlashInterval -= 30;
if (GameFlashInterval > 10)
MessageBox.Show($"{MainConst._GameGradeMsg} {GameFlashInterval}");
}
} }
private void ProxyTimer_Tick(object? sender, EventArgs e) private void ProxyTimer_Tick(object? sender, EventArgs e)