1.1.3 -> 1.1.4 第85次更新

This commit is contained in:
Space Time 2024-12-20 13:15:28 +08:00
parent af28d96bf9
commit 13d8663a6e
7 changed files with 37 additions and 37 deletions

View File

@ -9,7 +9,7 @@ namespace Sheas_Cealer.Consts;
internal abstract partial class MainConst : MainMultilangConst
{
internal enum SettingsMode
{ BrowserPathMode, UpstreamUrlMode, ExtraArgsMode };
{ BrowserPathMode, UpstreamUrlMode, ExtraArgsMode }
public static bool IsAdmin => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);

View File

@ -1,13 +1,14 @@
using Sheas_Cealer.Consts;
using System;
using System.Diagnostics;
using System.Globalization;
using System.Windows.Data;
namespace Sheas_Cealer.Convs;
internal class MainSettingsBoxTextConv : IMultiValueConverter
{
public object Convert(object[] values, Type targetType, object parameter, System.Globalization.CultureInfo culture)
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)values[0];
string browserPath = (string)values[1];
@ -19,9 +20,9 @@ internal class MainSettingsBoxTextConv : IMultiValueConverter
MainConst.SettingsMode.BrowserPathMode => browserPath,
MainConst.SettingsMode.UpstreamUrlMode => upstreamUrl,
MainConst.SettingsMode.ExtraArgsMode => extraArgs,
_ => throw new UnreachableException(),
_ => throw new UnreachableException()
};
}
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, System.Globalization.CultureInfo culture) => throw new NotImplementedException();
public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException();
}

View File

@ -32,7 +32,7 @@ internal static partial class IconRemover
SetWindowPos(hwnd, nint.Zero, 0, 0, 0, 0, SwpNoMove | SwpNoSize | SwpNoZOrder | SwpFrameChanged);
SendMessage(hwnd, WmSetIcon, new nint(1), nint.Zero);
SendMessage(hwnd, WmSetIcon, new(1), nint.Zero);
SendMessage(hwnd, WmSetIcon, nint.Zero, nint.Zero);
}
}

View File

@ -5,10 +5,10 @@ using System.Security.Cryptography.X509Certificates;
using System.Threading;
using System.Threading.Tasks;
namespace Sheas_Cealer.Utils
namespace Sheas_Cealer.Utils;
internal static class NginxCleaner
{
internal static class NginxCleaner
{
private static readonly SemaphoreSlim IsCleaningSemaphore = new(1);
internal static async Task Clean()
@ -42,5 +42,4 @@ namespace Sheas_Cealer.Utils
}
finally { IsCleaningSemaphore.Release(); }
}
}
}

View File

@ -16,7 +16,7 @@ namespace Sheas_Cealer.Wins;
public partial class AboutWin : Window
{
private readonly AboutPres AboutPres;
private readonly HttpClient AboutClient = new(new HttpClientHandler() { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator });
private readonly HttpClient AboutClient = new(new HttpClientHandler { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator });
internal AboutWin()
{

View File

@ -34,7 +34,7 @@ namespace Sheas_Cealer.Wins;
public partial class MainWin : Window
{
private readonly MainPres MainPres;
private readonly HttpClient MainClient = new(new HttpClientHandler() { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator });
private readonly HttpClient MainClient = new(new HttpClientHandler { ServerCertificateCustomValidationCallback = HttpClientHandler.DangerousAcceptAnyServerCertificateValidator });
private DispatcherTimer? HoldButtonTimer;
private readonly DispatcherTimer ProxyTimer = new() { Interval = TimeSpan.FromSeconds(0.1) };
private readonly FileSystemWatcher CealHostWatcher = new(Path.GetDirectoryName(MainConst.CealHostPath)!, Path.GetFileName(MainConst.CealHostPath)) { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
@ -346,7 +346,7 @@ public partial class MainWin : Window
if (!MainPres.IsMihomoRunning)
{
if (string.IsNullOrWhiteSpace(MihomoConfs))
throw new Exception(MainConst._MihomoConfErrorMsg);
throw new(MainConst._MihomoConfErrorMsg);
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
@ -532,7 +532,7 @@ public partial class MainWin : Window
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
(Color? newForegroundColor, Color newAccentForegroundColor) = ForegroundGenerator.GetForeground(newPrimaryColor.R, newPrimaryColor.G, newPrimaryColor.B);
newButtonStyle.Setters.Add(new Setter(Button.ForegroundProperty, newForegroundColor.HasValue ? new SolidColorBrush(newForegroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
newButtonStyle.Setters.Add(new Setter(ForegroundProperty, newForegroundColor.HasValue ? new SolidColorBrush(newForegroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
Application.Current.Resources[typeof(Button)] = newButtonStyle;
MainPres.AccentForegroundColor = newAccentForegroundColor;

View File

@ -47,7 +47,7 @@ public partial class SettingsWin : Window
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
(Color? newForegroundColor, Color newAccentForegroundColor) = ForegroundGenerator.GetForeground(newPrimaryColor.R, newPrimaryColor.G, newPrimaryColor.B);
newButtonStyle.Setters.Add(new Setter(Button.ForegroundProperty, newForegroundColor.HasValue ? new SolidColorBrush(newForegroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
newButtonStyle.Setters.Add(new Setter(ForegroundProperty, newForegroundColor.HasValue ? new SolidColorBrush(newForegroundColor.Value) : new DynamicResourceExtension("MaterialDesignBackground")));
Application.Current.Resources[typeof(Button)] = newButtonStyle;
SettingsPres.AccentForegroundColor = newAccentForegroundColor;