1.1.1 -> 1.1.2 第9次更新

This commit is contained in:
Space Time 2024-10-01 20:44:06 +08:00
parent ea201387dd
commit 66c40aa3f4
5 changed files with 111 additions and 74 deletions

View File

@ -70,7 +70,7 @@ namespace Sheas_Cealer.Consts {
}
/// <summary>
/// 查找类似 The args cannot be recognized, check if the host contains syntax errors 的本地化字符串。
/// 查找类似 The args cannot be recognized, check if the hosts contain syntax errors 的本地化字符串。
/// </summary>
public static string _HostErrorHint {
get {
@ -78,39 +78,39 @@ namespace Sheas_Cealer.Consts {
}
}
/// <summary>
/// 查找类似 Local host is exactly the same as upstream 的本地化字符串。
/// </summary>
public static string _HostUtdHint {
get {
return ResourceManager.GetString("_HostUtdHint", resourceCulture);
}
}
/// <summary>
/// 查找类似 All processes of the selected browser will be closed before launching, do you want to continue? 的本地化字符串。
/// </summary>
public static string _KillBrowserProcessesPrompt {
public static string _KillBrowserProcessPrompt {
get {
return ResourceManager.GetString("_KillBrowserProcessesPrompt", resourceCulture);
return ResourceManager.GetString("_KillBrowserProcessPrompt", resourceCulture);
}
}
/// <summary>
/// 查找类似 Do you need to override local host that are slightly different from upstream? If not it will only open a page with the upstream host for you 的本地化字符串。
/// 查找类似 There is an update available. Do you want to update upstream host? If No it will only open the upstream host page for you 的本地化字符串。
/// </summary>
public static string _OverrideLocalHostPrompt {
public static string _OverrideUpstreamHostPrompt {
get {
return ResourceManager.GetString("_OverrideLocalHostPrompt", resourceCulture);
return ResourceManager.GetString("_OverrideUpstreamHostPrompt", resourceCulture);
}
}
/// <summary>
/// 查找类似 Update successfully 的本地化字符串。
/// </summary>
public static string _UpdateHostSuccessHint {
public static string _UpdateUpstreamHostSuccessHint {
get {
return ResourceManager.GetString("_UpdateHostSuccessHint", resourceCulture);
return ResourceManager.GetString("_UpdateUpstreamHostSuccessHint", resourceCulture);
}
}
/// <summary>
/// 查找类似 Upstream host has been updated to the latest 的本地化字符串。
/// </summary>
public static string _UpstreamHostUtdHint {
get {
return ResourceManager.GetString("_UpstreamHostUtdHint", resourceCulture);
}
}
@ -142,20 +142,38 @@ namespace Sheas_Cealer.Consts {
}
/// <summary>
/// 查找类似 Edit Host 的本地化字符串。
/// 查找类似 Edit Local Host 的本地化字符串。
/// </summary>
public static string EditHostButtonContent {
public static string EditLocalHostButtonContent {
get {
return ResourceManager.GetString("EditHostButtonContent", resourceCulture);
return ResourceManager.GetString("EditLocalHostButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click to edit host 的本地化字符串。
/// 查找类似 Click to edit local host 的本地化字符串。
/// </summary>
public static string EditHostButtonToolTip {
public static string EditLocalHostButtonToolTip {
get {
return ResourceManager.GetString("EditHostButtonToolTip", resourceCulture);
return ResourceManager.GetString("EditLocalHostButtonToolTip", resourceCulture);
}
}
/// <summary>
/// 查找类似 Edit Upstream Host 的本地化字符串。
/// </summary>
public static string EditUpstreamHostButtonContent {
get {
return ResourceManager.GetString("EditUpstreamHostButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click to edit upstream host 的本地化字符串。
/// </summary>
public static string EditUpstreamHostButtonToolTip {
get {
return ResourceManager.GetString("EditUpstreamHostButtonToolTip", resourceCulture);
}
}
@ -295,20 +313,20 @@ namespace Sheas_Cealer.Consts {
}
/// <summary>
/// 查找类似 Update Host 的本地化字符串。
/// 查找类似 Update Upstream Host 的本地化字符串。
/// </summary>
public static string UpdateHostButtonContent {
public static string UpdateUpstreamHostButtonContent {
get {
return ResourceManager.GetString("UpdateHostButtonContent", resourceCulture);
return ResourceManager.GetString("UpdateUpstreamHostButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click to update host 的本地化字符串。
/// 查找类似 Click to update upstream host 的本地化字符串。
/// </summary>
public static string UpdateHostButtonToolTip {
public static string UpdateUpstreamHostButtonToolTip {
get {
return ResourceManager.GetString("UpdateHostButtonToolTip", resourceCulture);
return ResourceManager.GetString("UpdateUpstreamHostButtonToolTip", resourceCulture);
}
}

View File

@ -126,11 +126,17 @@
<data name="BrowserPathSettingsModeName" xml:space="preserve">
<value>Browser Path</value>
</data>
<data name="EditHostButtonContent" xml:space="preserve">
<value>Edit Host</value>
<data name="EditLocalHostButtonContent" xml:space="preserve">
<value>Edit Local Host</value>
</data>
<data name="EditHostButtonToolTip" xml:space="preserve">
<value>Click to edit host</value>
<data name="EditLocalHostButtonToolTip" xml:space="preserve">
<value>Click to edit local host</value>
</data>
<data name="EditUpstreamHostButtonContent" xml:space="preserve">
<value>Edit Upstream Host</value>
</data>
<data name="EditUpstreamHostButtonToolTip" xml:space="preserve">
<value>Click to edit upstream host</value>
</data>
<data name="ExtraArgsSettingsModeName" xml:space="preserve">
<value>Extra Args</value>
@ -177,11 +183,11 @@
<data name="ThemesButtonToolTip" xml:space="preserve">
<value>Click to switch themes</value>
</data>
<data name="UpdateHostButtonContent" xml:space="preserve">
<value>Update Host</value>
<data name="UpdateUpstreamHostButtonContent" xml:space="preserve">
<value>Update Upstream Host</value>
</data>
<data name="UpdateHostButtonToolTip" xml:space="preserve">
<value>Click to update host</value>
<data name="UpdateUpstreamHostButtonToolTip" xml:space="preserve">
<value>Click to update upstream host</value>
</data>
<data name="UpstreamUrlSettingsModeName" xml:space="preserve">
<value>Upstream URL</value>
@ -190,18 +196,18 @@
<value>Browser</value>
</data>
<data name="_HostErrorHint" xml:space="preserve">
<value>The args cannot be recognized, check if the host contains syntax errors</value>
<value>The args cannot be recognized, check if the hosts contain syntax errors</value>
</data>
<data name="_HostUtdHint" xml:space="preserve">
<value>Local host is exactly the same as upstream</value>
<data name="_UpstreamHostUtdHint" xml:space="preserve">
<value>Upstream host has been updated to the latest</value>
</data>
<data name="_KillBrowserProcessesPrompt" 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>
</data>
<data name="_OverrideLocalHostPrompt" xml:space="preserve">
<value>Do you need to override local host that are slightly different from upstream? If not it will only open a page with the upstream host for you</value>
<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>
</data>
<data name="_UpdateHostSuccessHint" xml:space="preserve">
<data name="_UpdateUpstreamHostSuccessHint" xml:space="preserve">
<value>Update successfully</value>
</data>
</root>

View File

@ -126,11 +126,17 @@
<data name="BrowserPathSettingsModeName" xml:space="preserve">
<value>文件路径</value>
</data>
<data name="EditHostButtonContent" xml:space="preserve">
<value>编辑规则</value>
<data name="EditLocalHostButtonContent" xml:space="preserve">
<value>编辑本地规则</value>
</data>
<data name="EditHostButtonToolTip" xml:space="preserve">
<value>点击编辑伪造规则</value>
<data name="EditLocalHostButtonToolTip" xml:space="preserve">
<value>点击编辑本地规则</value>
</data>
<data name="EditUpstreamHostButtonContent" xml:space="preserve">
<value>编辑上游规则</value>
</data>
<data name="EditUpstreamHostButtonToolTip" xml:space="preserve">
<value>点击编辑上游规则</value>
</data>
<data name="ExtraArgsSettingsModeName" xml:space="preserve">
<value>额外参数</value>
@ -142,7 +148,7 @@
<value>填入任意额外的 Chromium 启动参数</value>
</data>
<data name="SettingsBoxUpstreamUrlToolTip" xml:space="preserve">
<value>填入任意上游伪造规则链接</value>
<value>填入任意上游规则链接</value>
</data>
<data name="SettingsFunctionButtonBrowserPathContent" xml:space="preserve">
<value>浏览路径</value>
@ -177,11 +183,11 @@
<data name="ThemesButtonToolTip" xml:space="preserve">
<value>点击切换显示主题</value>
</data>
<data name="UpdateHostButtonContent" xml:space="preserve">
<value>更新规则</value>
<data name="UpdateUpstreamHostButtonContent" xml:space="preserve">
<value>更新上游规则</value>
</data>
<data name="UpdateHostButtonToolTip" xml:space="preserve">
<value>点击更新伪造规则</value>
<data name="UpdateUpstreamHostButtonToolTip" xml:space="preserve">
<value>点击更新上游规则</value>
</data>
<data name="UpstreamUrlSettingsModeName" xml:space="preserve">
<value>上游链接</value>
@ -190,18 +196,18 @@
<value>浏览器</value>
</data>
<data name="_HostErrorHint" xml:space="preserve">
<value>规则无法识别,请检查伪造规则是否含有语法错误</value>
<value>规则无法识别,请检查伪造规则是否含有语法错误</value>
</data>
<data name="_HostUtdHint" xml:space="preserve">
<value>本地伪造规则和上游一模一样</value>
<data name="_UpstreamHostUtdHint" xml:space="preserve">
<value>上游规则已经更到最新了</value>
</data>
<data name="_KillBrowserProcessesPrompt" xml:space="preserve">
<data name="_KillBrowserProcessPrompt" xml:space="preserve">
<value>启动前将关闭所选浏览器的所有进程,是否继续?</value>
</data>
<data name="_OverrideLocalHostPrompt" xml:space="preserve">
<value>本地伪造规则和上游略有不同,需要覆盖本地吗?否则只为你打开上游规则的网页</value>
<data name="_OverrideUpstreamHostPrompt" xml:space="preserve">
<value>上游规则有更新可用,需要更新吗?否则只为你打开上游规则网页</value>
</data>
<data name="_UpdateHostSuccessHint" xml:space="preserve">
<data name="_UpdateUpstreamHostSuccessHint" xml:space="preserve">
<value>更新已完成</value>
</data>
</root>

View File

@ -92,16 +92,19 @@
</Button>
<Grid Grid.Row="2">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.3*" />
<ColumnDefinition Width="1.3*" />
<ColumnDefinition Width="1.3*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Button Grid.Column="0" Margin="5" Content="{Binding Source={x:Static consts:MainConst.EditHostButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.EditHostButtonToolTip}}"
Click="EditHostButton_Click" />
<Button Grid.Column="1" Margin="5" Content="{Binding Source={x:Static consts:MainConst.UpdateHostButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.UpdateHostButtonToolTip}}"
Click="UpdateHostButton_Click">
<Button Grid.Column="0" Margin="5" Content="{Binding Source={x:Static consts:MainConst.EditLocalHostButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.EditLocalHostButtonToolTip}}"
Click="EditLocalHostButton_Click" />
<Button Grid.Column="1" Margin="5" Content="{Binding Source={x:Static consts:MainConst.EditUpstreamHostButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.EditUpstreamHostButtonToolTip}}"
Click="EditUpstreamHostButton_Click" />
<Button Grid.Column="2" Margin="5" Content="{Binding Source={x:Static consts:MainConst.UpdateUpstreamHostButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.UpdateUpstreamHostButtonToolTip}}"
Click="UpdateUpstreamHostButton_Click">
<Button.IsEnabled>
<Binding Path="UpstreamUrl">
<Binding.Converter>
@ -110,7 +113,7 @@
</Binding>
</Button.IsEnabled>
</Button>
<Button Grid.Column="2" Margin="5" d:Content="# # # #" ToolTip="{Binding Source={x:Static consts:MainConst.ThemesButtonToolTip}}"
<Button Grid.Column="3" Margin="5" d:Content="# # # #" ToolTip="{Binding Source={x:Static consts:MainConst.ThemesButtonToolTip}}"
Click="ThemesButton_Click">
<Button.Content>
<Binding Path="IsLightTheme">
@ -121,7 +124,7 @@
</Button.Content>
</Button>
<Button x:Name="AboutButton"
Grid.Column="3" Margin="5" Content="{Binding Source={x:Static consts:MainConst.AboutButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.AboutButtonToolTip}}"
Grid.Column="4" Margin="5" Content="{Binding Source={x:Static consts:MainConst.AboutButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.AboutButtonToolTip}}"
Click="AboutButton_Click" />
</Grid>
</Grid>

View File

@ -111,7 +111,7 @@ public partial class MainWin : Window
if (string.IsNullOrWhiteSpace(CealArgs))
throw new Exception(MainConst._HostErrorHint);
if (MessageBox.Show(MainConst._KillBrowserProcessesPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
if (MessageBox.Show(MainConst._KillBrowserProcessPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
IWshShortcut uncealedBrowserShortcut = (IWshShortcut)new WshShell().CreateShortcut(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Uncealed-Browser.lnk"));
@ -128,7 +128,7 @@ public partial class MainWin : Window
new CommandProc(sender == null).ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, ($"{CealArgs} {MainPres!.ExtraArgs}").Trim());
}
private void EditHostButton_Click(object sender, RoutedEventArgs e)
private void EditLocalHostButton_Click(object sender, RoutedEventArgs e)
{
string cealingHostPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json");
@ -138,7 +138,11 @@ public partial class MainWin : Window
ProcessStartInfo processStartInfo = new(cealingHostPath) { UseShellExecute = true };
Process.Start(processStartInfo);
}
private async void UpdateHostButton_Click(object sender, RoutedEventArgs e)
private void EditUpstreamHostButton_Click(object sender, RoutedEventArgs e)
{
}
private async void UpdateUpstreamHostButton_Click(object sender, RoutedEventArgs e)
{
string upstreamHostUrl = (MainPres!.UpstreamUrl.StartsWith("http://") || MainPres!.UpstreamUrl.StartsWith("https://") ? string.Empty : "https://") + MainPres!.UpstreamUrl;
string upstreamHostString = await Http.GetAsync<string>(upstreamHostUrl, MainClient);
@ -152,14 +156,14 @@ public partial class MainWin : Window
localHostString = localHostStreamReader.ReadToEnd();
if (localHostString.Replace("\r", string.Empty) == upstreamHostString)
MessageBox.Show(MainConst._HostUtdHint);
MessageBox.Show(MainConst._UpstreamHostUtdHint);
else
{
MessageBoxResult overrideOptionResult = MessageBox.Show(MainConst._OverrideLocalHostPrompt, string.Empty, MessageBoxButton.YesNoCancel);
MessageBoxResult overrideOptionResult = MessageBox.Show(MainConst._OverrideUpstreamHostPrompt, string.Empty, MessageBoxButton.YesNoCancel);
if (overrideOptionResult == MessageBoxResult.Yes)
{
File.WriteAllText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json"), upstreamHostString);
MessageBox.Show(MainConst._UpdateHostSuccessHint);
MessageBox.Show(MainConst._UpdateUpstreamHostSuccessHint);
}
else if (overrideOptionResult == MessageBoxResult.No)
Process.Start(new ProcessStartInfo(upstreamHostUrl) { UseShellExecute = true });