diff --git a/App.axaml b/App.axaml new file mode 100644 index 0000000..b354f3e --- /dev/null +++ b/App.axaml @@ -0,0 +1,31 @@ + + + + + + + \ No newline at end of file diff --git a/App.axaml.cs b/App.axaml.cs new file mode 100644 index 0000000..14cc986 --- /dev/null +++ b/App.axaml.cs @@ -0,0 +1,82 @@ +using Avalonia; +using Avalonia.Controls; +using Avalonia.Controls.ApplicationLifetimes; +using Avalonia.Controls.Primitives; +using Avalonia.Data.Core.Plugins; +using Avalonia.Markup.Xaml; +using Avalonia.Markup.Xaml.MarkupExtensions; +using Avalonia.Media; +using Avalonia.Styling; +using Sheas_Cealer_Nix.Preses; +using Sheas_Cealer_Nix.Utils; +using Sheas_Cealer_Nix.Wins; +using System; +using System.Linq; + +namespace Sheas_Cealer_Nix; + +public partial class App : Application +{ + public override void Initialize() => AvaloniaXamlLoader.Load(this); + + public override void OnFrameworkInitializationCompleted() + { + if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop) + { + #region Upgrade Settings + //if (Settings.Default.IsUpgradeRequired) + //{ + // Settings.Default.Upgrade(); + // Settings.Default.IsUpgradeRequired = false; + // Settings.Default.Save(); + //} + #endregion Upgrade Settings + + #region Primary Color + //PaletteHelper paletteHelper = new(); + //Theme newTheme = paletteHelper.GetTheme(); + //Color newPrimaryColor = Color.FromRgb(Settings.Default.PrimaryColor.R, Settings.Default.PrimaryColor.G, Settings.Default.PrimaryColor.B); + + //newTheme.SetPrimaryColor(newPrimaryColor); + //paletteHelper.SetTheme(newTheme); + #endregion Primary Color + + #region Background Color + //if (Environment.OSVersion.Version.Build < 22000) + //{ + // Style newWindowStyle = new(typeof(Window), Current.Resources["CommonWindow"] as Style); + + // newWindowStyle.Setters.Add(new Setter(Window.BackgroundProperty, new DynamicResourceExtension("MaterialDesignBackground"))); + // Current.Resources["CommonWindow"] = newWindowStyle; + //} + #endregion Background Color + + #region Foreground Color + //Style newButtonStyle = new(typeof(Button), 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"))); + //Current.Resources[typeof(Button)] = newButtonStyle; + + //new SettingsPres().AccentForegroundColor = newAccentForegroundColor; + #endregion Foreground Color + + // Avoid duplicate validations from both Avalonia and the CommunityToolkit. + // More info: https://docs.avaloniaui.net/docs/guides/development-guides/data-validation#manage-validationplugins + DisableAvaloniaDataAnnotationValidation(); + desktop.MainWindow = new MainWin(); + } + + base.OnFrameworkInitializationCompleted(); + } + + private void DisableAvaloniaDataAnnotationValidation() + { + // Get an array of plugins to remove + var dataValidationPluginsToRemove = BindingPlugins.DataValidators.OfType().ToArray(); + + // remove each entry found + foreach (var plugin in dataValidationPluginsToRemove) + BindingPlugins.DataValidators.Remove(plugin); + } +} \ No newline at end of file diff --git a/App.xaml b/App.xaml deleted file mode 100644 index c91ade3..0000000 --- a/App.xaml +++ /dev/null @@ -1,28 +0,0 @@ - - - - - - - - - - - - - - \ No newline at end of file diff --git a/App.xaml.cs b/App.xaml.cs deleted file mode 100644 index e17ffd9..0000000 --- a/App.xaml.cs +++ /dev/null @@ -1,64 +0,0 @@ -using MaterialDesignThemes.Wpf; -using Sheas_Cealer.Preses; -using Sheas_Cealer.Props; -using Sheas_Cealer.Utils; -using Sheas_Cealer.Wins; -using System; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Media; -using System.Windows.Threading; - -namespace Sheas_Cealer; - -public partial class App : Application -{ - private void App_OnStartup(object sender, StartupEventArgs e) - { - #region Upgrade Settings - if (Settings.Default.IsUpgradeRequired) - { - Settings.Default.Upgrade(); - Settings.Default.IsUpgradeRequired = false; - Settings.Default.Save(); - } - #endregion Upgrade Settings - - #region Primary Color - PaletteHelper paletteHelper = new(); - Theme newTheme = paletteHelper.GetTheme(); - Color newPrimaryColor = Color.FromRgb(Settings.Default.PrimaryColor.R, Settings.Default.PrimaryColor.G, Settings.Default.PrimaryColor.B); - - newTheme.SetPrimaryColor(newPrimaryColor); - paletteHelper.SetTheme(newTheme); - #endregion Primary Color - - #region Background Color - if (Environment.OSVersion.Version.Build < 22000) - { - Style newWindowStyle = new(typeof(Window), Current.Resources["CommonWindow"] as Style); - - newWindowStyle.Setters.Add(new Setter(Window.BackgroundProperty, new DynamicResourceExtension("MaterialDesignBackground"))); - Current.Resources["CommonWindow"] = newWindowStyle; - } - #endregion Background Color - - #region Foreground Color - Style newButtonStyle = new(typeof(Button), 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"))); - Current.Resources[typeof(Button)] = newButtonStyle; - - new SettingsPres().AccentForegroundColor = newAccentForegroundColor; - #endregion Foreground Color - - new MainWin().Show(); - } - - private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e) - { - MessageBox.Show($"Error: {e.Exception.Message}"); - e.Handled = true; - } -} \ No newline at end of file diff --git a/Consts/AboutConst.cs b/Consts/AboutConst.cs index 00b0a49..6c49047 100644 --- a/Consts/AboutConst.cs +++ b/Consts/AboutConst.cs @@ -1,12 +1,12 @@ -using System.Reflection; -using System.Windows.Media; +using Avalonia.Media; +using System.Reflection; -namespace Sheas_Cealer.Consts; +namespace Sheas_Cealer_Nix.Consts; internal abstract class AboutConst : AboutMultilangConst { - public static Color AccentBlueColor => (Color)ColorConverter.ConvertFromString("#2196F3"); - public static Color AccentRedColor => (Color)ColorConverter.ConvertFromString("#F44336"); + public static Color AccentBlueColor => Color.Parse("#2196F3"); + public static Color AccentRedColor => Color.Parse("#F44336"); public static string DeveloperButtonUrl => "https://www.spacetimee.xyz"; public static string VersionButtonVersionContent => Assembly.GetExecutingAssembly().GetName().Version!.ToString()[..^2]; @@ -14,11 +14,11 @@ internal abstract class AboutConst : AboutMultilangConst public static string EmailButtonUrl => "Zeus6_6@163.com"; public static string DocumentationButtonUrl => "https://github.com/SpaceTimee/Sheas-Cealer/wiki/Sheas-Cealer-Documentation"; - public static string RepositoryButtonUrl => "https://github.com/SpaceTimee/Sheas-Cealer"; + public static string RepositoryButtonUrl => "https://github.com/Project-SheasCealerNix/Sheas-Cealer-Nix"; public static string PolicyButtonUrl => "https://thoughts.teambition.com/share/6264eda98adeb10041b92fda#title=Sheas_Cealer_隐私政策"; public static string AgreementButtonUrl => "https://thoughts.teambition.com/share/6264edd78adeb10041b92fdb#title=Sheas_Cealer_使用协议"; - internal static string ReleaseApiUrl => "https://api.github.com/repos/SpaceTimee/Sheas-Cealer/releases/latest"; + internal static string ReleaseApiUrl => "https://api.github.com/repos/Project-SheasCealerNix/Sheas-Cealer-Nix/releases/latest"; internal static string ReleaseApiUserAgent => "Sheas-Cealer"; } \ No newline at end of file diff --git a/Consts/AboutMultilangConst.Designer.cs b/Consts/AboutMultilangConst.Designer.cs index cf482d4..b9fa65f 100644 --- a/Consts/AboutMultilangConst.Designer.cs +++ b/Consts/AboutMultilangConst.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Sheas_Cealer.Consts { +namespace Sheas_Cealer_Nix.Consts { using System; @@ -39,7 +39,7 @@ namespace Sheas_Cealer.Consts { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer.Consts.AboutMultilangConst", typeof(AboutMultilangConst).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer_Nix.Consts.AboutMultilangConst", typeof(AboutMultilangConst).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Consts/MainConst.cs b/Consts/MainConst.cs index 0cfe21d..0257957 100644 --- a/Consts/MainConst.cs +++ b/Consts/MainConst.cs @@ -4,14 +4,14 @@ using System.IO; using System.Security.Principal; using System.Text.RegularExpressions; -namespace Sheas_Cealer.Consts; +namespace Sheas_Cealer_Nix.Consts; internal abstract partial class MainConst : MainMultilangConst { internal enum SettingsMode { BrowserPathMode, UpstreamUrlMode, ExtraArgsMode } - public static bool IsAdmin => new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator); + public static bool IsAdmin => OperatingSystem.IsWindows() ? new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator) : Environment.UserName == "root"; internal static string EdgeBrowserRegistryPath => @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe"; internal static string ChromeBrowserRegistryPath => @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe"; @@ -22,7 +22,7 @@ internal abstract partial class MainConst : MainMultilangConst internal static string LocalHostPath => Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host-L.json"); internal static string UpstreamHostPath => Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host-U.json"); - internal static string HostsConfPath => Path.Combine(Registry.LocalMachine.OpenSubKey(@"\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath")?.GetValue("DataBasePath", null)?.ToString() ?? @"C:\Windows\System32\drivers\etc", "hosts"); + internal static string HostsConfPath => OperatingSystem.IsWindows() ? Path.Combine(Registry.LocalMachine.OpenSubKey(@"\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath")?.GetValue("DataBasePath", null)?.ToString() ?? @"C:\Windows\System32\drivers\etc", "hosts") : "/etc/hosts"; internal static string HostsConfStartMarker => $"# Cealing Nginx Start{Environment.NewLine}"; internal static string HostsConfEndMarker => "# Cealing Nginx End"; @@ -42,7 +42,7 @@ internal abstract partial class MainConst : MainMultilangConst internal static string MihomoConfPath => Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "config.yaml"); internal static string[] MihomoNameServers => ["https://ns.net.kg/dns-query", "https://dnschina1.soraharu.com/dns-query", "https://0ms.dev/dns-query"]; - internal static string NotifyIconText => "Sheas Cealer"; + internal static string NotifyIconText => "Sheas Cealer Nix"; [GeneratedRegex("^Cealing-Host-")] internal static partial Regex CealHostPrefixRegex(); diff --git a/Consts/MainMultilangConst.Designer.cs b/Consts/MainMultilangConst.Designer.cs index e91b911..6fe0f7c 100644 --- a/Consts/MainMultilangConst.Designer.cs +++ b/Consts/MainMultilangConst.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Sheas_Cealer.Consts { +namespace Sheas_Cealer_Nix.Consts { using System; @@ -39,7 +39,7 @@ namespace Sheas_Cealer.Consts { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer.Consts.MainMultilangConst", typeof(MainMultilangConst).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer_Nix.Consts.MainMultilangConst", typeof(MainMultilangConst).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Consts/SettingsConst.cs b/Consts/SettingsConst.cs index c88c487..28f4179 100644 --- a/Consts/SettingsConst.cs +++ b/Consts/SettingsConst.cs @@ -1,3 +1,3 @@ -namespace Sheas_Cealer.Consts; +namespace Sheas_Cealer_Nix.Consts; internal abstract class SettingsConst : SettingsMultilangConst; \ No newline at end of file diff --git a/Consts/SettingsMultilangConst.Designer.cs b/Consts/SettingsMultilangConst.Designer.cs index 1b8d80c..51dd887 100644 --- a/Consts/SettingsMultilangConst.Designer.cs +++ b/Consts/SettingsMultilangConst.Designer.cs @@ -8,7 +8,7 @@ // //------------------------------------------------------------------------------ -namespace Sheas_Cealer.Consts { +namespace Sheas_Cealer_Nix.Consts { using System; @@ -39,7 +39,7 @@ namespace Sheas_Cealer.Consts { public static global::System.Resources.ResourceManager ResourceManager { get { if (object.ReferenceEquals(resourceMan, null)) { - global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer.Consts.SettingsMultilangConst", typeof(SettingsMultilangConst).Assembly); + global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("Sheas_Cealer_Nix.Consts.SettingsMultilangConst", typeof(SettingsMultilangConst).Assembly); resourceMan = temp; } return resourceMan; diff --git a/Convs/AboutAccentButtonForegroundConv.cs b/Convs/AboutAccentButtonForegroundConv.cs index 277c84b..bd583ed 100644 --- a/Convs/AboutAccentButtonForegroundConv.cs +++ b/Convs/AboutAccentButtonForegroundConv.cs @@ -1,18 +1,18 @@ -using System; +using Avalonia.Data.Converters; +using Avalonia.Media; +using System; using System.Globalization; -using System.Windows.Data; -using System.Windows.Media; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class AboutAccentButtonForegroundConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { Color accentForegroundColor = (Color)value; return new SolidColorBrush(accentForegroundColor); } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/AboutConv.cs b/Convs/AboutConv.cs index 28937f3..aef34af 100644 --- a/Convs/AboutConv.cs +++ b/Convs/AboutConv.cs @@ -1,4 +1,4 @@ -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal static class AboutConv { diff --git a/Convs/AboutVersionButtonContentConv.cs b/Convs/AboutVersionButtonContentConv.cs index 3cbdc15..1427c3c 100644 --- a/Convs/AboutVersionButtonContentConv.cs +++ b/Convs/AboutVersionButtonContentConv.cs @@ -1,12 +1,13 @@ -using System; +using Avalonia.Data.Converters; +using System; +using System.Collections.Generic; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class AboutVersionButtonContentConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { string versionButtonLabelContent = (string)values[0]; string versionButtonVersionContent = (string)values[1]; @@ -14,6 +15,4 @@ internal class AboutVersionButtonContentConv : IMultiValueConverter return $"{versionButtonLabelContent} {versionButtonVersionContent}" + (isSheasCealerUtd ? string.Empty : " *"); } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainAdminControlVisibilityConv.cs b/Convs/MainAdminControlVisibilityConv.cs index 7f2461d..2481f22 100644 --- a/Convs/MainAdminControlVisibilityConv.cs +++ b/Convs/MainAdminControlVisibilityConv.cs @@ -1,18 +1,17 @@ -using System; +using Avalonia.Data.Converters; +using System; using System.Globalization; -using System.Windows; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; 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) { bool isAdmin = (bool)value; - return isAdmin ? Visibility.Visible : Visibility.Collapsed; + return isAdmin ? true : false; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainBrowserButtonIsEnabledConv.cs b/Convs/MainBrowserButtonIsEnabledConv.cs index a83e24f..4417558 100644 --- a/Convs/MainBrowserButtonIsEnabledConv.cs +++ b/Convs/MainBrowserButtonIsEnabledConv.cs @@ -1,20 +1,19 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; +using System.Collections.Generic; using System.Globalization; using System.IO; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainBrowserButtonIsEnabledConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { string browserPath = (string)values[0]; string extraArgs = (string)values[1]; return File.Exists(browserPath) && Path.GetFileName(browserPath).ToLowerInvariant().EndsWith(".exe") && MainConst.ExtraArgsRegex().IsMatch(extraArgs); } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainConv.cs b/Convs/MainConv.cs index e337cc6..2a169c1 100644 --- a/Convs/MainConv.cs +++ b/Convs/MainConv.cs @@ -1,4 +1,4 @@ -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal static class MainConv { diff --git a/Convs/MainMihomoButtonContentConv.cs b/Convs/MainMihomoButtonContentConv.cs index eb95a20..8bd92a9 100644 --- a/Convs/MainMihomoButtonContentConv.cs +++ b/Convs/MainMihomoButtonContentConv.cs @@ -1,13 +1,14 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; +using System.Collections.Generic; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainMihomoButtonContentConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { bool isMihomoRunning = (bool)values[0]; bool isComihomoIniting = (bool)values[1]; @@ -15,11 +16,9 @@ internal class MainMihomoButtonContentConv : IMultiValueConverter bool isCoproxyIniting = (bool)values[3]; bool isCoproxyStopping = (bool)values[4]; - return isCoproxyIniting || isCoproxyStopping ? Binding.DoNothing : + return isCoproxyIniting || isCoproxyStopping ? MainConst.MihomoButtonIsInitingContent : isComihomoIniting ? MainConst.MihomoButtonIsStoppingContent : isMihomoIniting ? MainConst.MihomoButtonIsInitingContent : isMihomoRunning ? MainConst.MihomoButtonIsRunningContent : MainConst.MihomoButtonIsStoppedContent; } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainMihomoButtonIsEnabledConv.cs b/Convs/MainMihomoButtonIsEnabledConv.cs index baca53a..a58721a 100644 --- a/Convs/MainMihomoButtonIsEnabledConv.cs +++ b/Convs/MainMihomoButtonIsEnabledConv.cs @@ -1,12 +1,13 @@ -using System; +using Avalonia.Data.Converters; +using System; +using System.Collections.Generic; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainMihomoButtonIsEnabledConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { bool isCoMihomoExist = (bool)values[0]; bool isMihomoExist = (bool)values[1]; @@ -16,6 +17,4 @@ internal class MainMihomoButtonIsEnabledConv : IMultiValueConverter return !isCoproxyIniting && !isComihomoIniting && !isMihomoIniting && (isCoMihomoExist || isMihomoExist); } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainMihomoButtonToolTipConv.cs b/Convs/MainMihomoButtonToolTipConv.cs index e26c5dc..6fdeadc 100644 --- a/Convs/MainMihomoButtonToolTipConv.cs +++ b/Convs/MainMihomoButtonToolTipConv.cs @@ -1,18 +1,18 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainMihomoButtonToolTipConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool isMihomoRunning = (bool)value; return isMihomoRunning ? MainConst.MihomoButtonIsRunningToolTip : MainConst.MihomoButtonIsStoppedToolTip; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainNginxButtonContentConv.cs b/Convs/MainNginxButtonContentConv.cs index f1d6ff5..364845e 100644 --- a/Convs/MainNginxButtonContentConv.cs +++ b/Convs/MainNginxButtonContentConv.cs @@ -1,13 +1,14 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; +using System.Collections.Generic; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainNginxButtonContentConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { bool isConginxRunning = (bool)values[0]; bool isNginxRunning = (bool)values[1]; @@ -18,6 +19,4 @@ internal class MainNginxButtonContentConv : IMultiValueConverter isNginxIniting ? MainConst.NginxButtonIsInitingContent : isConginxRunning || isNginxRunning ? MainConst.NginxButtonIsRunningContent : MainConst.NginxButtonIsStoppedContent; } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainNginxButtonIsEnabledConv.cs b/Convs/MainNginxButtonIsEnabledConv.cs index d69336a..b4c4e8d 100644 --- a/Convs/MainNginxButtonIsEnabledConv.cs +++ b/Convs/MainNginxButtonIsEnabledConv.cs @@ -1,12 +1,13 @@ -using System; +using Avalonia.Data.Converters; +using System; +using System.Collections.Generic; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainNginxButtonIsEnabledConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { bool isConginxExist = (bool)values[0]; bool isNginxExist = (bool)values[1]; @@ -17,6 +18,4 @@ internal class MainNginxButtonIsEnabledConv : IMultiValueConverter return !isCoproxyIniting && !isNginxIniting && !isComihomoIniting && !isMihomoIniting && (isConginxExist || isNginxExist); } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainNginxButtonToolTipConv.cs b/Convs/MainNginxButtonToolTipConv.cs index 0a20b9f..5000f15 100644 --- a/Convs/MainNginxButtonToolTipConv.cs +++ b/Convs/MainNginxButtonToolTipConv.cs @@ -1,19 +1,18 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; +using System.Collections.Generic; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainNginxButtonToolTipConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { bool isConginxRunning = (bool)values[0]; bool isNginxRunning = (bool)values[1]; return isConginxRunning || isNginxRunning ? MainConst.NginxButtonIsRunningToolTip : MainConst.NginxButtonIsStoppedToolTip; } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainNoClickButtonContentConv.cs b/Convs/MainNoClickButtonContentConv.cs index 5ac8b0f..89d1de5 100644 --- a/Convs/MainNoClickButtonContentConv.cs +++ b/Convs/MainNoClickButtonContentConv.cs @@ -1,18 +1,18 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainNoClickButtonContentConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + 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(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainNoClickButtonToolTipConv.cs b/Convs/MainNoClickButtonToolTipConv.cs index 38dfc7f..d17da35 100644 --- a/Convs/MainNoClickButtonToolTipConv.cs +++ b/Convs/MainNoClickButtonToolTipConv.cs @@ -1,18 +1,18 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainNoClickButtonToolTipConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + 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(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainProxyColumnWidthConv.cs b/Convs/MainProxyColumnWidthConv.cs index 8be6321..1aae007 100644 --- a/Convs/MainProxyColumnWidthConv.cs +++ b/Convs/MainProxyColumnWidthConv.cs @@ -1,18 +1,18 @@ -using System; +using Avalonia.Controls; +using Avalonia.Data.Converters; +using System; using System.Globalization; -using System.Windows; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainProxyColumnWidthConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool isAdmin = (bool)value; return new GridLength(1, isAdmin ? GridUnitType.Star : GridUnitType.Auto); } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainSettingsBoxHintConv.cs b/Convs/MainSettingsBoxHintConv.cs index fac4536..92a139a 100644 --- a/Convs/MainSettingsBoxHintConv.cs +++ b/Convs/MainSettingsBoxHintConv.cs @@ -1,14 +1,14 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Diagnostics; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainSettingsBoxHintConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)value; @@ -21,5 +21,5 @@ internal class MainSettingsBoxHintConv : IValueConverter }; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainSettingsBoxTextConv.cs b/Convs/MainSettingsBoxTextConv.cs index d06af18..411b293 100644 --- a/Convs/MainSettingsBoxTextConv.cs +++ b/Convs/MainSettingsBoxTextConv.cs @@ -1,14 +1,15 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; +using System.Collections.Generic; using System.Diagnostics; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainSettingsBoxTextConv : IMultiValueConverter { - public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture) + public object Convert(IList values, Type targetType, object? parameter, CultureInfo culture) { MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)values[0]; string browserPath = (string)values[1]; @@ -23,6 +24,4 @@ internal class MainSettingsBoxTextConv : IMultiValueConverter _ => throw new UnreachableException() }; } - - public object[] ConvertBack(object value, Type[] targetTypes, object parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainSettingsBoxToolTipConv.cs b/Convs/MainSettingsBoxToolTipConv.cs index 27aca88..701a9f1 100644 --- a/Convs/MainSettingsBoxToolTipConv.cs +++ b/Convs/MainSettingsBoxToolTipConv.cs @@ -1,14 +1,14 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Diagnostics; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainSettingsBoxToolTipConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)value; @@ -21,5 +21,5 @@ internal class MainSettingsBoxToolTipConv : IValueConverter }; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainSettingsFunctionButtonContentConv.cs b/Convs/MainSettingsFunctionButtonContentConv.cs index 356be99..10eee5a 100644 --- a/Convs/MainSettingsFunctionButtonContentConv.cs +++ b/Convs/MainSettingsFunctionButtonContentConv.cs @@ -1,14 +1,14 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Diagnostics; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainSettingsFunctionButtonContentConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)value; @@ -21,5 +21,5 @@ internal class MainSettingsFunctionButtonContentConv : IValueConverter }; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainSettingsModeButtonContentConv.cs b/Convs/MainSettingsModeButtonContentConv.cs index bc2d542..20084c0 100644 --- a/Convs/MainSettingsModeButtonContentConv.cs +++ b/Convs/MainSettingsModeButtonContentConv.cs @@ -1,13 +1,13 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainSettingsModeButtonContentConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { MainConst.SettingsMode settingsMode = (MainConst.SettingsMode)value; @@ -20,5 +20,5 @@ internal class MainSettingsModeButtonContentConv : IValueConverter }; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainUpdateHostButtonContentConv.cs b/Convs/MainUpdateHostButtonContentConv.cs index dbf3083..71e4a2c 100644 --- a/Convs/MainUpdateHostButtonContentConv.cs +++ b/Convs/MainUpdateHostButtonContentConv.cs @@ -1,18 +1,18 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainUpdateHostButtonContentConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool isUpstreamHostUtd = (bool)value; return MainConst.UpdateUpstreamHostButtonContent + (isUpstreamHostUtd ? string.Empty : " *"); } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainUpdateHostButtonIsEnabledConv.cs b/Convs/MainUpdateHostButtonIsEnabledConv.cs index d1a0107..c304292 100644 --- a/Convs/MainUpdateHostButtonIsEnabledConv.cs +++ b/Convs/MainUpdateHostButtonIsEnabledConv.cs @@ -1,18 +1,18 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainUpdateHostButtonIsEnabledConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { string upstreamUrl = (string)value; return MainConst.UpstreamUrlRegex().IsMatch(upstreamUrl); } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/MainWinWidthConv.cs b/Convs/MainWinWidthConv.cs index 0d2542a..f9afc6d 100644 --- a/Convs/MainWinWidthConv.cs +++ b/Convs/MainWinWidthConv.cs @@ -1,17 +1,17 @@ -using System; +using Avalonia.Data.Converters; +using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class MainWinWidthConv : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool isAdmin = (bool)value; return isAdmin ? 708 : 500; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/SettingsConv.cs b/Convs/SettingsConv.cs index 3baee37..db9ba13 100644 --- a/Convs/SettingsConv.cs +++ b/Convs/SettingsConv.cs @@ -1,4 +1,4 @@ -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal static class SettingsConv { diff --git a/Convs/SettingsLangsButtonContentConv.cs b/Convs/SettingsLangsButtonContentConv.cs index 7fd9f98..d305edd 100644 --- a/Convs/SettingsLangsButtonContentConv.cs +++ b/Convs/SettingsLangsButtonContentConv.cs @@ -1,13 +1,13 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class SettingsLangsButtonContentConv : IValueConverter { - public object Convert(object? value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool? isEnglishLang = value as bool?; @@ -16,5 +16,5 @@ internal class SettingsLangsButtonContentConv : IValueConverter SettingsConst.LangsButtonInheritLangContent; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/SettingsThemesButtonContentConv.cs b/Convs/SettingsThemesButtonContentConv.cs index c2920ec..1db8b9c 100644 --- a/Convs/SettingsThemesButtonContentConv.cs +++ b/Convs/SettingsThemesButtonContentConv.cs @@ -1,13 +1,13 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class SettingsThemesButtonContentConv : IValueConverter { - public object Convert(object? value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool? isLightMode = value as bool?; @@ -16,5 +16,5 @@ internal class SettingsThemesButtonContentConv : IValueConverter SettingsConst.ThemesButtonInheritThemeContent; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Convs/SettingsWeightsButtonContentConv.cs b/Convs/SettingsWeightsButtonContentConv.cs index ad72365..f693ef1 100644 --- a/Convs/SettingsWeightsButtonContentConv.cs +++ b/Convs/SettingsWeightsButtonContentConv.cs @@ -1,13 +1,13 @@ -using Sheas_Cealer.Consts; +using Avalonia.Data.Converters; +using Sheas_Cealer_Nix.Consts; using System; using System.Globalization; -using System.Windows.Data; -namespace Sheas_Cealer.Convs; +namespace Sheas_Cealer_Nix.Convs; internal class SettingsWeightsButtonContentConv : IValueConverter { - public object Convert(object? value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { bool? isLightWeight = value as bool?; @@ -16,5 +16,5 @@ internal class SettingsWeightsButtonContentConv : IValueConverter SettingsConst.WeightsButtonRegularWeightContent; } - public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) => throw new NotImplementedException(); + public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture) => throw new NotImplementedException(); } \ No newline at end of file diff --git a/Preses/AboutPres.cs b/Preses/AboutPres.cs index 66d0325..2fbe37a 100644 --- a/Preses/AboutPres.cs +++ b/Preses/AboutPres.cs @@ -1,6 +1,6 @@ using CommunityToolkit.Mvvm.ComponentModel; -namespace Sheas_Cealer.Preses; +namespace Sheas_Cealer_Nix.Preses; internal partial class AboutPres : GlobalPres { diff --git a/Preses/GlobalPres.cs b/Preses/GlobalPres.cs index 2cd64cc..6c8bf49 100644 --- a/Preses/GlobalPres.cs +++ b/Preses/GlobalPres.cs @@ -1,42 +1,39 @@ -using CommunityToolkit.Mvvm.ComponentModel; -using MaterialDesignThemes.Wpf; -using Sheas_Cealer.Consts; -using Sheas_Cealer.Props; -using Sheas_Cealer.Utils; +using Avalonia.Media; +using CommunityToolkit.Mvvm.ComponentModel; +using Sheas_Cealer_Nix.Consts; +using Sheas_Cealer_Nix.Props; using System.Diagnostics; -using System.Windows; -using System.Windows.Media; -namespace Sheas_Cealer.Preses; +namespace Sheas_Cealer_Nix.Preses; internal partial class GlobalPres : ObservableObject { internal GlobalPres() { - IsLightTheme = Settings.Default.IsLightTheme switch - { - -1 => null, - 0 => false, - 1 => true, - _ => throw new UnreachableException() - }; + //IsLightTheme = Settings.Default.IsLightTheme switch + //{ + // -1 => null, + // 0 => false, + // 1 => true, + // _ => throw new UnreachableException() + //}; } [ObservableProperty] private static bool? isLightTheme = null; partial void OnIsLightThemeChanged(bool? value) { - PaletteHelper paletteHelper = new(); - Theme newTheme = paletteHelper.GetTheme(); + //PaletteHelper paletteHelper = new(); + //Theme newTheme = paletteHelper.GetTheme(); - newTheme.SetBaseTheme(value.HasValue ? value.Value ? BaseTheme.Light : BaseTheme.Dark : BaseTheme.Inherit); - paletteHelper.SetTheme(newTheme); + //newTheme.SetBaseTheme(value.HasValue ? value.Value ? BaseTheme.Light : BaseTheme.Dark : BaseTheme.Inherit); + //paletteHelper.SetTheme(newTheme); - foreach (Window currentWindow in Application.Current.Windows) - BorderThemeSetter.SetBorderTheme(currentWindow, value); + //foreach (Window currentWindow in Application.Current.Windows) + // BorderThemeSetter.SetBorderTheme(currentWindow, value); - Settings.Default.IsLightTheme = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1); - Settings.Default.Save(); + //Settings.Default.IsLightTheme = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1); + //Settings.Default.Save(); } [ObservableProperty] diff --git a/Preses/MainPres.cs b/Preses/MainPres.cs index a12c950..47c8821 100644 --- a/Preses/MainPres.cs +++ b/Preses/MainPres.cs @@ -1,38 +1,38 @@ using CommunityToolkit.Mvvm.ComponentModel; using Microsoft.Win32; -using Sheas_Cealer.Consts; -using Sheas_Cealer.Props; +using Sheas_Cealer_Nix.Consts; +using Sheas_Cealer_Nix.Props; using System; using System.Diagnostics; using System.IO; using File = System.IO.File; -namespace Sheas_Cealer.Preses; +namespace Sheas_Cealer_Nix.Preses; internal partial class MainPres : GlobalPres { internal MainPres() { - string[] args = Environment.GetCommandLineArgs(); + //string[] args = Environment.GetCommandLineArgs(); - int browserPathIndex = Array.FindIndex(args, arg => arg.Equals("-b", StringComparison.OrdinalIgnoreCase)) + 1; - int upstreamUrlIndex = Array.FindIndex(args, arg => arg.Equals("-u", StringComparison.OrdinalIgnoreCase)) + 1; - int extraArgsIndex = Array.FindIndex(args, arg => arg.Equals("-e", StringComparison.OrdinalIgnoreCase)) + 1; + //int browserPathIndex = Array.FindIndex(args, arg => arg.Equals("-b", StringComparison.OrdinalIgnoreCase)) + 1; + //int upstreamUrlIndex = Array.FindIndex(args, arg => arg.Equals("-u", StringComparison.OrdinalIgnoreCase)) + 1; + //int extraArgsIndex = Array.FindIndex(args, arg => arg.Equals("-e", StringComparison.OrdinalIgnoreCase)) + 1; - BrowserPath = browserPathIndex != 0 && browserPathIndex != args.Length ? args[browserPathIndex] : - !string.IsNullOrWhiteSpace(Settings.Default.BrowserPath) ? Settings.Default.BrowserPath : - (Registry.LocalMachine.OpenSubKey(MainConst.EdgeBrowserRegistryPath)?.GetValue(string.Empty, null) ?? - Registry.LocalMachine.OpenSubKey(MainConst.ChromeBrowserRegistryPath)?.GetValue(string.Empty, null) ?? - Registry.LocalMachine.OpenSubKey(MainConst.BraveBrowserRegistryPath)?.GetValue(string.Empty, null) ?? - string.Empty).ToString()!; + //BrowserPath = browserPathIndex != 0 && browserPathIndex != args.Length ? args[browserPathIndex] : + // !string.IsNullOrWhiteSpace(Settings.Default.BrowserPath) ? Settings.Default.BrowserPath : + // (Registry.LocalMachine.OpenSubKey(MainConst.EdgeBrowserRegistryPath)?.GetValue(string.Empty, null) ?? + // Registry.LocalMachine.OpenSubKey(MainConst.ChromeBrowserRegistryPath)?.GetValue(string.Empty, null) ?? + // Registry.LocalMachine.OpenSubKey(MainConst.BraveBrowserRegistryPath)?.GetValue(string.Empty, null) ?? + // string.Empty).ToString()!; - UpstreamUrl = upstreamUrlIndex == 0 || upstreamUrlIndex == args.Length ? - !string.IsNullOrWhiteSpace(Settings.Default.UpstreamUrl) ? Settings.Default.UpstreamUrl : MainConst.DefaultUpstreamUrl : - args[upstreamUrlIndex]; + //UpstreamUrl = upstreamUrlIndex == 0 || upstreamUrlIndex == args.Length ? + // !string.IsNullOrWhiteSpace(Settings.Default.UpstreamUrl) ? Settings.Default.UpstreamUrl : MainConst.DefaultUpstreamUrl : + // args[upstreamUrlIndex]; - ExtraArgs = extraArgsIndex == 0 || extraArgsIndex == args.Length ? - !string.IsNullOrWhiteSpace(Settings.Default.ExtraArgs) ? Settings.Default.ExtraArgs : string.Empty : - args[extraArgsIndex]; + //ExtraArgs = extraArgsIndex == 0 || extraArgsIndex == args.Length ? + // !string.IsNullOrWhiteSpace(Settings.Default.ExtraArgs) ? Settings.Default.ExtraArgs : string.Empty : + // args[extraArgsIndex]; } [ObservableProperty] @@ -42,33 +42,33 @@ internal partial class MainPres : GlobalPres private string browserPath; partial void OnBrowserPathChanged(string value) { - if (!File.Exists(value) || !Path.GetFileName(value).ToLowerInvariant().EndsWith(".exe")) - return; + //if (!File.Exists(value) || !Path.GetFileName(value).ToLowerInvariant().EndsWith(".exe")) + // return; - Settings.Default.BrowserPath = value; - Settings.Default.Save(); + //Settings.Default.BrowserPath = value; + //Settings.Default.Save(); } [ObservableProperty] private string upstreamUrl; partial void OnUpstreamUrlChanged(string value) { - if (!MainConst.UpstreamUrlRegex().IsMatch(value)) - return; + //if (!MainConst.UpstreamUrlRegex().IsMatch(value)) + // return; - Settings.Default.UpstreamUrl = value; - Settings.Default.Save(); + //Settings.Default.UpstreamUrl = value; + //Settings.Default.Save(); } [ObservableProperty] private string extraArgs; partial void OnExtraArgsChanged(string value) { - if (!MainConst.ExtraArgsRegex().IsMatch(value)) - return; + //if (!MainConst.ExtraArgsRegex().IsMatch(value)) + // return; - Settings.Default.ExtraArgs = value; - Settings.Default.Save(); + //Settings.Default.ExtraArgs = value; + //Settings.Default.Save(); } [ObservableProperty] @@ -90,10 +90,10 @@ internal partial class MainPres : GlobalPres private bool isNginxIniting = false; [ObservableProperty] - private bool isConginxRunning = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.ConginxPath)).Length != 0; + private bool isConginxRunning = Process.GetProcessesByName(OperatingSystem.IsWindows() ? Path.GetFileNameWithoutExtension(MainConst.ConginxPath) : Path.GetFileName(MainConst.ConginxPath)).Length != 0; [ObservableProperty] - private bool isNginxRunning = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.NginxPath)).Length != 0; + private bool isNginxRunning = Process.GetProcessesByName(OperatingSystem.IsWindows() ? Path.GetFileNameWithoutExtension(MainConst.NginxPath) : Path.GetFileName(MainConst.NginxPath)).Length != 0; [ObservableProperty] private bool isComihomoExist = File.Exists(MainConst.ComihomoPath); @@ -108,10 +108,10 @@ internal partial class MainPres : GlobalPres private bool isMihomoIniting = false; [ObservableProperty] - private bool isComihomoRunning = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.ComihomoPath)).Length != 0; + private bool isComihomoRunning = Process.GetProcessesByName(OperatingSystem.IsWindows() ? Path.GetFileNameWithoutExtension(MainConst.ComihomoPath) : Path.GetFileName(MainConst.ComihomoPath)).Length != 0; [ObservableProperty] - private bool isMihomoRunning = Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.MihomoPath)).Length != 0; + private bool isMihomoRunning = Process.GetProcessesByName(OperatingSystem.IsWindows() ? Path.GetFileNameWithoutExtension(MainConst.MihomoPath) : Path.GetFileName(MainConst.MihomoPath)).Length != 0; [ObservableProperty] private bool isFlashing = false; diff --git a/Preses/SettingsPres.cs b/Preses/SettingsPres.cs index b967549..d1776c3 100644 --- a/Preses/SettingsPres.cs +++ b/Preses/SettingsPres.cs @@ -1,66 +1,61 @@ using CommunityToolkit.Mvvm.ComponentModel; -using Sheas_Cealer.Props; +using Sheas_Cealer_Nix.Props; using System.Diagnostics; -using System.Globalization; -using System.Threading; -using System.Windows; -using System.Windows.Controls; -using System.Windows.Markup; -namespace Sheas_Cealer.Preses; +namespace Sheas_Cealer_Nix.Preses; internal partial class SettingsPres : GlobalPres { internal SettingsPres() { - IsEnglishLang = Settings.Default.IsEnglishLang switch - { - -1 => null, - 0 => false, - 1 => true, - _ => throw new UnreachableException() - }; + //IsEnglishLang = Settings.Default.IsEnglishLang switch + //{ + // -1 => null, + // 0 => false, + // 1 => true, + // _ => throw new UnreachableException() + //}; - IsLightWeight = Settings.Default.IsLightWeight switch - { - -1 => null, - 0 => false, - 1 => true, - _ => throw new UnreachableException() - }; + //IsLightWeight = Settings.Default.IsLightWeight switch + //{ + // -1 => null, + // 0 => false, + // 1 => true, + // _ => throw new UnreachableException() + //}; } [ObservableProperty] private static bool? isEnglishLang = null; partial void OnIsEnglishLangChanged(bool? value) { - CultureInfo newCulture = value.HasValue ? new(value.Value ? "en" : "zh") : CultureInfo.InstalledUICulture; + //CultureInfo newCulture = value.HasValue ? new(value.Value ? "en" : "zh") : CultureInfo.InstalledUICulture; - Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = newCulture; + //Thread.CurrentThread.CurrentCulture = Thread.CurrentThread.CurrentUICulture = newCulture; - foreach (Window currentWindow in Application.Current.Windows) - currentWindow.Language = XmlLanguage.GetLanguage(newCulture.IetfLanguageTag); + //foreach (Window currentWindow in Application.Current.Windows) + // currentWindow.Language = XmlLanguage.GetLanguage(newCulture.IetfLanguageTag); - Settings.Default.IsEnglishLang = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1); - Settings.Default.Save(); + //Settings.Default.IsEnglishLang = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1); + //Settings.Default.Save(); } [ObservableProperty] private static bool? isLightWeight = null; partial void OnIsLightWeightChanged(bool? value) { - FontWeight newWeight = value.HasValue ? value.Value ? FontWeights.Light : FontWeights.Bold : FontWeights.Regular; - Style newWindowStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style); + //FontWeight newWeight = value.HasValue ? value.Value ? FontWeights.Light : FontWeights.Bold : FontWeights.Regular; + //Style newWindowStyle = new(typeof(Window), Application.Current.Resources["CommonWindow"] as Style); - newWindowStyle.Setters.Add(new Setter(Window.FontWeightProperty, newWeight)); - Application.Current.Resources["CommonWindow"] = newWindowStyle; + //newWindowStyle.Setters.Add(new Setter(Window.FontWeightProperty, newWeight)); + //Application.Current.Resources["CommonWindow"] = newWindowStyle; - Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style); + //Style newButtonStyle = new(typeof(Button), Application.Current.Resources[typeof(Button)] as Style); - newButtonStyle.Setters.Add(new Setter(Button.FontWeightProperty, newWeight)); - Application.Current.Resources[typeof(Button)] = newButtonStyle; + //newButtonStyle.Setters.Add(new Setter(Button.FontWeightProperty, newWeight)); + //Application.Current.Resources[typeof(Button)] = newButtonStyle; - Settings.Default.IsLightWeight = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1); - Settings.Default.Save(); + //Settings.Default.IsLightWeight = (sbyte)(value.HasValue ? value.Value ? 1 : 0 : -1); + //Settings.Default.Save(); } } \ No newline at end of file diff --git a/Proces/BrowserProc.cs b/Proces/BrowserProc.cs index a340fe0..ced5fee 100644 --- a/Proces/BrowserProc.cs +++ b/Proces/BrowserProc.cs @@ -1,8 +1,7 @@ using Sheas_Core; using System; -using System.Windows; -namespace Sheas_Cealer.Proces; +namespace Sheas_Cealer_Nix.Proces; internal class BrowserProc : Proc { @@ -13,6 +12,6 @@ internal class BrowserProc : Proc protected sealed override void Process_Exited(object? sender, EventArgs e) { if (ShutDownAppOnProcessExit) - Application.Current.Dispatcher.InvokeShutdown(); + Environment.Exit(0); } } \ No newline at end of file diff --git a/Proces/ComihomoProc.cs b/Proces/ComihomoProc.cs index b2865ac..208e584 100644 --- a/Proces/ComihomoProc.cs +++ b/Proces/ComihomoProc.cs @@ -1,7 +1,7 @@ -using Sheas_Cealer.Consts; +using Sheas_Cealer_Nix.Consts; using Sheas_Core; -namespace Sheas_Cealer.Proces; +namespace Sheas_Cealer_Nix.Proces; internal class ComihomoProc : Proc { diff --git a/Proces/ConginxProc.cs b/Proces/ConginxProc.cs index 2d32816..da21838 100644 --- a/Proces/ConginxProc.cs +++ b/Proces/ConginxProc.cs @@ -1,9 +1,9 @@ -using Sheas_Cealer.Consts; -using Sheas_Cealer.Utils; +using Sheas_Cealer_Nix.Consts; +using Sheas_Cealer_Nix.Utils; using Sheas_Core; using System; -namespace Sheas_Cealer.Proces; +namespace Sheas_Cealer_Nix.Proces; internal class ConginxProc : Proc { diff --git a/Proces/MihomoProc.cs b/Proces/MihomoProc.cs index ce05700..ba2316d 100644 --- a/Proces/MihomoProc.cs +++ b/Proces/MihomoProc.cs @@ -1,7 +1,7 @@ -using Sheas_Cealer.Consts; +using Sheas_Cealer_Nix.Consts; using Sheas_Core; -namespace Sheas_Cealer.Proces; +namespace Sheas_Cealer_Nix.Proces; internal class MihomoProc : Proc { diff --git a/Proces/NginxProc.cs b/Proces/NginxProc.cs index 9c3d720..0b39a33 100644 --- a/Proces/NginxProc.cs +++ b/Proces/NginxProc.cs @@ -1,9 +1,9 @@ -using Sheas_Cealer.Consts; -using Sheas_Cealer.Utils; +using Sheas_Cealer_Nix.Consts; +using Sheas_Cealer_Nix.Utils; using Sheas_Core; using System; -namespace Sheas_Cealer.Proces; +namespace Sheas_Cealer_Nix.Proces; internal class NginxProc : Proc { diff --git a/Program.cs b/Program.cs new file mode 100644 index 0000000..d801d58 --- /dev/null +++ b/Program.cs @@ -0,0 +1,23 @@ +using Avalonia; +using MsBox.Avalonia; +using System; +using System.Threading.Tasks; + +namespace Sheas_Cealer_Nix; + +internal sealed class Program +{ + [STAThread] + public static async Task Main(string[] args) + { + try + { + AppBuilder.Configure() + .UsePlatformDetect() + .WithInterFont() + .StartWithClassicDesktopLifetime(args); + } + catch (Exception ex) { await MessageBoxManager.GetMessageBoxStandard(string.Empty, $"Error: {ex.Message}").ShowAsync(); } + } +} + diff --git a/Props/Settings.Designer.cs b/Props/Settings.Designer.cs index 7a03387..1c85f48 100644 --- a/Props/Settings.Designer.cs +++ b/Props/Settings.Designer.cs @@ -8,11 +8,11 @@ // //------------------------------------------------------------------------------ -namespace Sheas_Cealer.Props { +namespace Sheas_Cealer_Nix.Props { [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] - [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.13.0.0")] + [global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "17.14.0.0")] internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase { private static Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings()))); diff --git a/Props/Settings.settings b/Props/Settings.settings index 8c55cc3..61fb0e7 100644 --- a/Props/Settings.settings +++ b/Props/Settings.settings @@ -1,5 +1,5 @@  - + diff --git a/Props/launchSettings.json b/Props/launchSettings.json new file mode 100644 index 0000000..b56d691 --- /dev/null +++ b/Props/launchSettings.json @@ -0,0 +1,11 @@ +{ + "profiles": { + "Sheas-Cealer-Nix": { + "commandName": "Project" + }, + "WSL": { + "commandName": "WSL2", + "distributionName": "" + } + } +} \ No newline at end of file diff --git a/Sheas-Cealer-Nix.csproj b/Sheas-Cealer-Nix.csproj index 8a8c9ae..95f7b02 100644 --- a/Sheas-Cealer-Nix.csproj +++ b/Sheas-Cealer-Nix.csproj @@ -16,8 +16,8 @@ Sheas-Cealer-Logo.ico Sheas Cealer Logo.png README.md - https://github.com/SpaceTimee/Sheas-Cealer-Nix - https://github.com/SpaceTimee/Sheas-Cealer-Nix + https://github.com/Project-SheasCealerNix/Sheas-Cealer-Nix + https://github.com/Project-SheasCealerNix/Sheas-Cealer-Nix git Copyright © 2077 WinExe diff --git a/Utils/BorderThemeSetter.cs b/Utils/BorderThemeSetter.cs index 6133fbe..06b7713 100644 --- a/Utils/BorderThemeSetter.cs +++ b/Utils/BorderThemeSetter.cs @@ -1,31 +1,30 @@ using System.Runtime.InteropServices; using System.Windows; -using System.Windows.Interop; -namespace Sheas_Cealer.Utils; +namespace Sheas_Cealer_Nix.Utils; internal static partial class BorderThemeSetter { - private const int DwmwaUseImmersiveDarkModeOld = 19; - private const int DwmwaUseImmersiveDarkMode = 20; + //private const int DwmwaUseImmersiveDarkModeOld = 19; + //private const int DwmwaUseImmersiveDarkMode = 20; - [LibraryImport("dwmapi.dll")] - private static partial void DwmGetWindowAttribute(nint hwnd, uint attr, out nint attrValue, uint attrSize); - [LibraryImport("dwmapi.dll")] - private static partial void DwmSetWindowAttribute(nint hwnd, uint attr, ref nint attrValue, uint attrSize); + //[LibraryImport("dwmapi.dll")] + //private static partial void DwmGetWindowAttribute(nint hwnd, uint attr, out nint attrValue, uint attrSize); + //[LibraryImport("dwmapi.dll")] + //private static partial void DwmSetWindowAttribute(nint hwnd, uint attr, ref nint attrValue, uint attrSize); - internal static void SetBorderTheme(Window window, bool? isLightTheme) - { - nint isDarkTheme; - nint desktopHwnd = nint.Zero; - nint windowHwnd = new WindowInteropHelper(window).EnsureHandle(); + //internal static void SetBorderTheme(Window window, bool? isLightTheme) + //{ + // nint isDarkTheme; + // nint desktopHwnd = nint.Zero; + // nint windowHwnd = new WindowInteropHelper(window).EnsureHandle(); - if (isLightTheme.HasValue) - isDarkTheme = !isLightTheme.Value ? 1 : 0; - else - DwmGetWindowAttribute(desktopHwnd, DwmwaUseImmersiveDarkMode, out isDarkTheme, (uint)Marshal.SizeOf(typeof(nint))); + // if (isLightTheme.HasValue) + // isDarkTheme = !isLightTheme.Value ? 1 : 0; + // else + // DwmGetWindowAttribute(desktopHwnd, DwmwaUseImmersiveDarkMode, out isDarkTheme, (uint)Marshal.SizeOf(typeof(nint))); - DwmSetWindowAttribute(windowHwnd, DwmwaUseImmersiveDarkModeOld, ref isDarkTheme, (uint)Marshal.SizeOf(typeof(nint))); - DwmSetWindowAttribute(windowHwnd, DwmwaUseImmersiveDarkMode, ref isDarkTheme, (uint)Marshal.SizeOf(typeof(nint))); - } + // DwmSetWindowAttribute(windowHwnd, DwmwaUseImmersiveDarkModeOld, ref isDarkTheme, (uint)Marshal.SizeOf(typeof(nint))); + // DwmSetWindowAttribute(windowHwnd, DwmwaUseImmersiveDarkMode, ref isDarkTheme, (uint)Marshal.SizeOf(typeof(nint))); + //} } \ No newline at end of file diff --git a/Utils/DnsFlusher.cs b/Utils/DnsFlusher.cs index e6353bb..234ccb2 100644 --- a/Utils/DnsFlusher.cs +++ b/Utils/DnsFlusher.cs @@ -1,6 +1,6 @@ using System.Runtime.InteropServices; -namespace Sheas_Cealer.Utils; +namespace Sheas_Cealer_Nix.Utils; internal static partial class DnsFlusher { diff --git a/Utils/ForegroundGenerator.cs b/Utils/ForegroundGenerator.cs index 3638ee5..d8baedf 100644 --- a/Utils/ForegroundGenerator.cs +++ b/Utils/ForegroundGenerator.cs @@ -1,8 +1,8 @@ -using Sheas_Cealer.Consts; +using Avalonia.Media; +using Sheas_Cealer_Nix.Consts; using System; -using System.Windows.Media; -namespace Sheas_Cealer.Utils; +namespace Sheas_Cealer_Nix.Utils; internal static class ForegroundGenerator { diff --git a/Utils/IconRemover.cs b/Utils/IconRemover.cs index 023855a..998398f 100644 --- a/Utils/IconRemover.cs +++ b/Utils/IconRemover.cs @@ -1,38 +1,37 @@ using System.Runtime.InteropServices; using System.Windows; -using System.Windows.Interop; -namespace Sheas_Cealer.Utils; +namespace Sheas_Cealer_Nix.Utils; internal static partial class IconRemover { - private const int GwlExStyle = -20; - private const int WsExDlgModalFrame = 0x0001; - private const int SwpNoSize = 0x0001; - private const int SwpNoMove = 0x0002; - private const int SwpNoZOrder = 0x0004; - private const int SwpFrameChanged = 0x0020; - private const uint WmSetIcon = 0x0080; + //private const int GwlExStyle = -20; + //private const int WsExDlgModalFrame = 0x0001; + //private const int SwpNoSize = 0x0001; + //private const int SwpNoMove = 0x0002; + //private const int SwpNoZOrder = 0x0004; + //private const int SwpFrameChanged = 0x0020; + //private const uint WmSetIcon = 0x0080; - [LibraryImport("user32.dll", EntryPoint = "GetWindowLongW")] - private static partial int GetWindowLong(nint hwnd, int index); - [LibraryImport("user32.dll", EntryPoint = "SetWindowLongW")] - private static partial void SetWindowLong(nint hwnd, int index, nint newStyle); - [LibraryImport("user32.dll")] - [return: MarshalAs(UnmanagedType.Bool)] - private static partial void SetWindowPos(nint hwnd, nint hwndInsertAfter, int x, int y, int width, int height, uint flags); - [LibraryImport("user32.dll", EntryPoint = "SendMessageW")] - private static partial void SendMessage(nint hwnd, uint msg, nint wParam, nint lParam); + //[LibraryImport("user32.dll", EntryPoint = "GetWindowLongW")] + //private static partial int GetWindowLong(nint hwnd, int index); + //[LibraryImport("user32.dll", EntryPoint = "SetWindowLongW")] + //private static partial void SetWindowLong(nint hwnd, int index, nint newStyle); + //[LibraryImport("user32.dll")] + //[return: MarshalAs(UnmanagedType.Bool)] + //private static partial void SetWindowPos(nint hwnd, nint hwndInsertAfter, int x, int y, int width, int height, uint flags); + //[LibraryImport("user32.dll", EntryPoint = "SendMessageW")] + //private static partial void SendMessage(nint hwnd, uint msg, nint wParam, nint lParam); - internal static void RemoveIcon(Window window) - { - nint hwnd = new WindowInteropHelper(window).Handle; + //internal static void RemoveIcon(Window window) + //{ + // nint hwnd = new WindowInteropHelper(window).Handle; - SetWindowLong(hwnd, GwlExStyle, GetWindowLong(hwnd, GwlExStyle) | WsExDlgModalFrame); + // SetWindowLong(hwnd, GwlExStyle, GetWindowLong(hwnd, GwlExStyle) | WsExDlgModalFrame); - 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(1), nint.Zero); - SendMessage(hwnd, WmSetIcon, nint.Zero, nint.Zero); - } + // SendMessage(hwnd, WmSetIcon, new(1), nint.Zero); + // SendMessage(hwnd, WmSetIcon, nint.Zero, nint.Zero); + //} } \ No newline at end of file diff --git a/Utils/NginxCleaner.cs b/Utils/NginxCleaner.cs index 09ea2bc..3a15b20 100644 --- a/Utils/NginxCleaner.cs +++ b/Utils/NginxCleaner.cs @@ -1,10 +1,10 @@ -using Sheas_Cealer.Consts; +using Sheas_Cealer_Nix.Consts; using System; using System.IO; using System.Security.Cryptography.X509Certificates; using System.Threading.Tasks; -namespace Sheas_Cealer.Utils; +namespace Sheas_Cealer_Nix.Utils; internal static class NginxCleaner { diff --git a/Wins/AboutWin.xaml b/Wins/AboutWin.axaml similarity index 67% rename from Wins/AboutWin.xaml rename to Wins/AboutWin.axaml index 5d62740..d5e9730 100644 --- a/Wins/AboutWin.xaml +++ b/Wins/AboutWin.axaml @@ -1,16 +1,15 @@ - + WindowStartupLocation="CenterScreen" CanResize="False" SizeToContent="Height" Width="500" + Loaded="AboutWin_Loaded" KeyDown="AboutWin_KeyDown"> @@ -24,15 +23,14 @@