1.1.1 -> 1.1.2 第17次更新

This commit is contained in:
Space Time 2024-10-02 23:48:47 +08:00
parent 53384ee2ad
commit db19a759ff
6 changed files with 138 additions and 9 deletions

View File

@ -72,9 +72,9 @@ 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 _ConfigErrorHint { public static string _ConfErrorHint {
get { get {
return ResourceManager.GetString("_ConfigErrorHint", resourceCulture); return ResourceManager.GetString("_ConfErrorHint", resourceCulture);
} }
} }
@ -168,6 +168,42 @@ namespace Sheas_Cealer.Consts {
} }
} }
/// <summary>
/// 查找类似 Edit Mihomo Conf 的本地化字符串。
/// </summary>
public static string EditMihomoConfButtonContent {
get {
return ResourceManager.GetString("EditMihomoConfButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click to edit mihomo conf 的本地化字符串。
/// </summary>
public static string EditMihomoConfButtonToolTip {
get {
return ResourceManager.GetString("EditMihomoConfButtonToolTip", resourceCulture);
}
}
/// <summary>
/// 查找类似 Edit Nginx Conf 的本地化字符串。
/// </summary>
public static string EditNginxConfButtonContent {
get {
return ResourceManager.GetString("EditNginxConfButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click to edit nginx conf 的本地化字符串。
/// </summary>
public static string EditNginxConfButtonToolTip {
get {
return ResourceManager.GetString("EditNginxConfButtonToolTip", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Edit Upstream Host 的本地化字符串。 /// 查找类似 Edit Upstream Host 的本地化字符串。
/// </summary> /// </summary>
@ -231,6 +267,24 @@ namespace Sheas_Cealer.Consts {
} }
} }
/// <summary>
/// 查找类似 Mysterious Button 的本地化字符串。
/// </summary>
public static string MysteriousButtonContent {
get {
return ResourceManager.GetString("MysteriousButtonContent", resourceCulture);
}
}
/// <summary>
/// 查找类似 Click for SURPRISE 的本地化字符串。
/// </summary>
public static string MysteriousButtonToolTip {
get {
return ResourceManager.GetString("MysteriousButtonToolTip", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Stop Nginx 的本地化字符串。 /// 查找类似 Stop Nginx 的本地化字符串。
/// </summary> /// </summary>

View File

@ -132,6 +132,18 @@
<data name="EditLocalHostButtonToolTip" xml:space="preserve"> <data name="EditLocalHostButtonToolTip" xml:space="preserve">
<value>Click to edit local host</value> <value>Click to edit local host</value>
</data> </data>
<data name="EditMihomoConfButtonContent" xml:space="preserve">
<value>Edit Mihomo Conf</value>
</data>
<data name="EditMihomoConfButtonToolTip" xml:space="preserve">
<value>Click to edit mihomo conf</value>
</data>
<data name="EditNginxConfButtonContent" xml:space="preserve">
<value>Edit Nginx Conf</value>
</data>
<data name="EditNginxConfButtonToolTip" xml:space="preserve">
<value>Click to edit nginx conf</value>
</data>
<data name="EditUpstreamHostButtonContent" xml:space="preserve"> <data name="EditUpstreamHostButtonContent" xml:space="preserve">
<value>Edit Upstream Host</value> <value>Edit Upstream Host</value>
</data> </data>
@ -153,6 +165,12 @@
<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="MysteriousButtonContent" xml:space="preserve">
<value>Mysterious Button</value>
</data>
<data name="MysteriousButtonToolTip" xml:space="preserve">
<value>Click for SURPRISE</value>
</data>
<data name="NginxButtonIsRunningContent" xml:space="preserve"> <data name="NginxButtonIsRunningContent" xml:space="preserve">
<value>Stop Nginx</value> <value>Stop Nginx</value>
</data> </data>
@ -219,7 +237,7 @@
<data name="_BrowserPathDialogFilterFileType" xml:space="preserve"> <data name="_BrowserPathDialogFilterFileType" xml:space="preserve">
<value>Browser</value> <value>Browser</value>
</data> </data>
<data name="_ConfigErrorHint" 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>
<data name="_HostErrorHint" xml:space="preserve"> <data name="_HostErrorHint" xml:space="preserve">

View File

@ -132,6 +132,18 @@
<data name="EditLocalHostButtonToolTip" xml:space="preserve"> <data name="EditLocalHostButtonToolTip" xml:space="preserve">
<value>点击编辑本地规则</value> <value>点击编辑本地规则</value>
</data> </data>
<data name="EditMihomoConfButtonContent" xml:space="preserve">
<value>编辑 Mihomo 配置</value>
</data>
<data name="EditMihomoConfButtonToolTip" xml:space="preserve">
<value>点击编辑 Mihomo 配置</value>
</data>
<data name="EditNginxConfButtonContent" xml:space="preserve">
<value>编辑 Nginx 配置</value>
</data>
<data name="EditNginxConfButtonToolTip" xml:space="preserve">
<value>点击编辑 Nginx 配置</value>
</data>
<data name="EditUpstreamHostButtonContent" xml:space="preserve"> <data name="EditUpstreamHostButtonContent" xml:space="preserve">
<value>编辑上游规则</value> <value>编辑上游规则</value>
</data> </data>
@ -153,6 +165,12 @@
<data name="MihomoButtonIsStoppedToolTip" xml:space="preserve"> <data name="MihomoButtonIsStoppedToolTip" xml:space="preserve">
<value>点击启动本地 Mihomo</value> <value>点击启动本地 Mihomo</value>
</data> </data>
<data name="MysteriousButtonContent" xml:space="preserve">
<value>神秘按钮</value>
</data>
<data name="MysteriousButtonToolTip" 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>
@ -219,7 +237,7 @@
<data name="_BrowserPathDialogFilterFileType" xml:space="preserve"> <data name="_BrowserPathDialogFilterFileType" xml:space="preserve">
<value>浏览器</value> <value>浏览器</value>
</data> </data>
<data name="_ConfigErrorHint" xml:space="preserve"> <data name="_ConfErrorHint" xml:space="preserve">
<value>配置无法识别,请检查配置文件中是否含有语法错误</value> <value>配置无法识别,请检查配置文件中是否含有语法错误</value>
</data> </data>
<data name="_HostErrorHint" xml:space="preserve"> <data name="_HostErrorHint" xml:space="preserve">

View File

@ -5,7 +5,7 @@ using System.Windows.Data;
namespace Sheas_Cealer.Convs; namespace Sheas_Cealer.Convs;
internal class MainProxyButtonVisibilityConv : IValueConverter internal class MainAdminControlVisibilityConv : IValueConverter
{ {
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {

View File

@ -16,6 +16,7 @@
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" /> <RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<Grid Grid.Row="0"> <Grid Grid.Row="0">
@ -125,7 +126,7 @@
<Button.Visibility> <Button.Visibility>
<Binding Source="{x:Static consts:MainConst.IsAdmin}" Mode="OneTime"> <Binding Source="{x:Static consts:MainConst.IsAdmin}" Mode="OneTime">
<Binding.Converter> <Binding.Converter>
<convs:MainProxyButtonVisibilityConv /> <convs:MainAdminControlVisibilityConv />
</Binding.Converter> </Binding.Converter>
</Binding> </Binding>
</Button.Visibility> </Button.Visibility>
@ -156,7 +157,7 @@
<Button.Visibility> <Button.Visibility>
<Binding Source="{x:Static consts:MainConst.IsAdmin}" Mode="OneTime"> <Binding Source="{x:Static consts:MainConst.IsAdmin}" Mode="OneTime">
<Binding.Converter> <Binding.Converter>
<convs:MainProxyButtonVisibilityConv /> <convs:MainAdminControlVisibilityConv />
</Binding.Converter> </Binding.Converter>
</Binding> </Binding>
</Button.Visibility> </Button.Visibility>
@ -176,7 +177,6 @@
</Button.ToolTip> </Button.ToolTip>
</Button> </Button>
</Grid> </Grid>
<Grid Grid.Row="2"> <Grid Grid.Row="2">
<Grid.ColumnDefinitions> <Grid.ColumnDefinitions>
<ColumnDefinition Width="1.3*" /> <ColumnDefinition Width="1.3*" />
@ -215,5 +215,27 @@
Grid.Column="4" 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" /> Click="AboutButton_Click" />
</Grid> </Grid>
<Grid Grid.Row="3">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="1.5*" />
</Grid.ColumnDefinitions>
<Grid.Visibility>
<Binding Source="{x:Static consts:MainConst.IsAdmin}" Mode="OneTime">
<Binding.Converter>
<convs:MainAdminControlVisibilityConv />
</Binding.Converter>
</Binding>
</Grid.Visibility>
<Button x:Name="EditNginxConfButton"
Grid.Column="0" Margin="5" Content="{Binding Source={x:Static consts:MainConst.EditNginxConfButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.EditNginxConfButtonToolTip}}"
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}}"
Click="EditConfButton_Click" />
<Button Grid.Column="2" Margin="5" Content="{Binding Source={x:Static consts:MainConst.MysteriousButtonContent}}" ToolTip="{Binding Source={x:Static consts:MainConst.MysteriousButtonToolTip}}"
Click="MysteriousButton_Click" />
</Grid>
</Grid> </Grid>
</Window> </Window>

View File

@ -179,7 +179,7 @@ public partial class MainWin : Window
configStream.Load(File.OpenText(configPath)); configStream.Load(File.OpenText(configPath));
try { configMapNode = (YamlMappingNode)configStream.Documents[0].RootNode; } try { configMapNode = (YamlMappingNode)configStream.Documents[0].RootNode; }
catch { throw new Exception(MainConst._ConfigErrorHint); } catch { throw new Exception(MainConst._ConfErrorHint); }
if (!configMapNode.Children.TryGetValue("mixed-port", out mihomoPortNode!) && !configMapNode.Children.TryGetValue("port", out mihomoPortNode!)) if (!configMapNode.Children.TryGetValue("mixed-port", out mihomoPortNode!) && !configMapNode.Children.TryGetValue("port", out mihomoPortNode!))
mihomoPortNode = "7890"; mihomoPortNode = "7890";
@ -242,6 +242,23 @@ public partial class MainWin : Window
private void ThemesButton_Click(object sender, RoutedEventArgs e) => MainPres!.IsLightTheme = MainPres.IsLightTheme.HasValue ? MainPres.IsLightTheme.Value ? null : true : false; private void ThemesButton_Click(object sender, RoutedEventArgs e) => MainPres!.IsLightTheme = MainPres.IsLightTheme.HasValue ? MainPres.IsLightTheme.Value ? null : true : false;
private void AboutButton_Click(object sender, RoutedEventArgs e) => new AboutWin().ShowDialog(); private void AboutButton_Click(object sender, RoutedEventArgs e) => new AboutWin().ShowDialog();
private void EditConfButton_Click(object sender, RoutedEventArgs e)
{
Button? senderButton = sender as Button;
string confPath = Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, senderButton == EditNginxConfButton ? "nginx.conf" : "config.json");
if (!File.Exists(confPath))
File.Create(confPath).Dispose();
ProcessStartInfo processStartInfo = new(confPath) { UseShellExecute = true };
Process.Start(processStartInfo);
}
private void MysteriousButton_Click(object sender, RoutedEventArgs e)
{
}
private void ProxyTimer_Tick(object? sender, EventArgs e) private void ProxyTimer_Tick(object? sender, EventArgs e)
{ {
MainPres!.IsNginxExist = File.Exists(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Nginx.exe")); MainPres!.IsNginxExist = File.Exists(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Nginx.exe"));