mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 21:02:08 +08:00
1.1.3 -> 1.1.4 第85次更新
This commit is contained in:
parent
af28d96bf9
commit
13d8663a6e
@ -9,7 +9,7 @@ namespace Sheas_Cealer.Consts;
|
|||||||
internal abstract partial class MainConst : MainMultilangConst
|
internal abstract partial class MainConst : MainMultilangConst
|
||||||
{
|
{
|
||||||
internal enum SettingsMode
|
internal enum SettingsMode
|
||||||
{ BrowserPathMode, UpstreamUrlMode, ExtraArgsMode };
|
{ BrowserPathMode, UpstreamUrlMode, ExtraArgsMode }
|
||||||
|
|
||||||
public static bool IsAdmin => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
|
public static bool IsAdmin => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
|
||||||
|
|
||||||
|
@ -1,13 +1,14 @@
|
|||||||
using Sheas_Cealer.Consts;
|
using Sheas_Cealer.Consts;
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using System.Globalization;
|
||||||
using System.Windows.Data;
|
using System.Windows.Data;
|
||||||
|
|
||||||
namespace Sheas_Cealer.Convs;
|
namespace Sheas_Cealer.Convs;
|
||||||
|
|
||||||
internal class MainSettingsBoxTextConv : IMultiValueConverter
|
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];
|
MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)values[0];
|
||||||
string browserPath = (string)values[1];
|
string browserPath = (string)values[1];
|
||||||
@ -19,9 +20,9 @@ internal class MainSettingsBoxTextConv : IMultiValueConverter
|
|||||||
MainConst.SettingsMode.BrowserPathMode => browserPath,
|
MainConst.SettingsMode.BrowserPathMode => browserPath,
|
||||||
MainConst.SettingsMode.UpstreamUrlMode => upstreamUrl,
|
MainConst.SettingsMode.UpstreamUrlMode => upstreamUrl,
|
||||||
MainConst.SettingsMode.ExtraArgsMode => extraArgs,
|
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();
|
||||||
}
|
}
|
@ -32,7 +32,7 @@ internal static partial class IconRemover
|
|||||||
|
|
||||||
SetWindowPos(hwnd, nint.Zero, 0, 0, 0, 0, SwpNoMove | SwpNoSize | SwpNoZOrder | SwpFrameChanged);
|
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);
|
SendMessage(hwnd, WmSetIcon, nint.Zero, nint.Zero);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -5,10 +5,10 @@ using System.Security.Cryptography.X509Certificates;
|
|||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
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);
|
private static readonly SemaphoreSlim IsCleaningSemaphore = new(1);
|
||||||
|
|
||||||
internal static async Task Clean()
|
internal static async Task Clean()
|
||||||
@ -42,5 +42,4 @@ namespace Sheas_Cealer.Utils
|
|||||||
}
|
}
|
||||||
finally { IsCleaningSemaphore.Release(); }
|
finally { IsCleaningSemaphore.Release(); }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
}
|
}
|
@ -16,7 +16,7 @@ namespace Sheas_Cealer.Wins;
|
|||||||
public partial class AboutWin : Window
|
public partial class AboutWin : Window
|
||||||
{
|
{
|
||||||
private readonly AboutPres AboutPres;
|
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()
|
internal AboutWin()
|
||||||
{
|
{
|
||||||
|
@ -34,7 +34,7 @@ namespace Sheas_Cealer.Wins;
|
|||||||
public partial class MainWin : Window
|
public partial class MainWin : Window
|
||||||
{
|
{
|
||||||
private readonly MainPres MainPres;
|
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 DispatcherTimer? HoldButtonTimer;
|
||||||
private readonly DispatcherTimer ProxyTimer = new() { Interval = TimeSpan.FromSeconds(0.1) };
|
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 };
|
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 (!MainPres.IsMihomoRunning)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrWhiteSpace(MihomoConfs))
|
if (string.IsNullOrWhiteSpace(MihomoConfs))
|
||||||
throw new Exception(MainConst._MihomoConfErrorMsg);
|
throw new(MainConst._MihomoConfErrorMsg);
|
||||||
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
if (MessageBox.Show(MainConst._LaunchProxyPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
@ -532,7 +532,7 @@ public partial class MainWin : Window
|
|||||||
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
|
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
|
||||||
(Color? newForegroundColor, Color newAccentForegroundColor) = ForegroundGenerator.GetForeground(newPrimaryColor.R, newPrimaryColor.G, newPrimaryColor.B);
|
(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;
|
Application.Current.Resources[typeof(Button)] = newButtonStyle;
|
||||||
|
|
||||||
MainPres.AccentForegroundColor = newAccentForegroundColor;
|
MainPres.AccentForegroundColor = newAccentForegroundColor;
|
||||||
|
@ -47,7 +47,7 @@ public partial class SettingsWin : Window
|
|||||||
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
|
Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style);
|
||||||
(Color? newForegroundColor, Color newAccentForegroundColor) = ForegroundGenerator.GetForeground(newPrimaryColor.R, newPrimaryColor.G, newPrimaryColor.B);
|
(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;
|
Application.Current.Resources[typeof(Button)] = newButtonStyle;
|
||||||
|
|
||||||
SettingsPres.AccentForegroundColor = newAccentForegroundColor;
|
SettingsPres.AccentForegroundColor = newAccentForegroundColor;
|
||||||
|
Loading…
Reference in New Issue
Block a user