From 1682b47b44ef19e46a1289050184d111ab746012 Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Wed, 2 Oct 2024 05:21:13 +0300 Subject: [PATCH] Minor Changes --- src/Bundle/Sucrose.Bundle/Main.xaml.cs | 5 +-- src/Library/Sucrose.Memory/Readonly.cs | 14 ++++--- .../Sucrose.Resources/Styles/ScrollBar.xaml | 8 ++-- src/Portal/Sucrose.Portal/App.xaml | 4 +- .../Views/Pages/Store/FullStorePage.xaml.cs | 41 ++++++++++--------- .../Sucrose.Shared.Launcher/Helper/Radius.cs | 5 +-- .../Manager/TrayIconManager.cs | 40 +++++------------- .../Sucrose.Update/View/MainWindow.xaml.cs | 19 +++++++-- 8 files changed, 64 insertions(+), 72 deletions(-) diff --git a/src/Bundle/Sucrose.Bundle/Main.xaml.cs b/src/Bundle/Sucrose.Bundle/Main.xaml.cs index 756653949..c67036384 100644 --- a/src/Bundle/Sucrose.Bundle/Main.xaml.cs +++ b/src/Bundle/Sucrose.Bundle/Main.xaml.cs @@ -116,10 +116,7 @@ private void WindowCorner() SWNM.DwmSetWindowAttribute(SWHWI.Handle(this), Attribute, ref Preference, (uint)Marshal.SizeOf(typeof(uint))); } } - catch - { - // - } + catch { } } private static async Task ExtractArchive() diff --git a/src/Library/Sucrose.Memory/Readonly.cs b/src/Library/Sucrose.Memory/Readonly.cs index 2a357b26a..c161b67fa 100644 --- a/src/Library/Sucrose.Memory/Readonly.cs +++ b/src/Library/Sucrose.Memory/Readonly.cs @@ -138,10 +138,12 @@ public static class Readonly public static readonly string YouTubeContent = "YouTubeContent.html"; - public static readonly string WebViewLive = "Sucrose.Live.WebView.exe"; + public static readonly string GitHubWebsite = "https://api.github.com"; public static readonly string ValueSeparator = $"{ValueSeparatorChar}"; + public static readonly string WebViewLive = "Sucrose.Live.WebView.exe"; + public static readonly string Backgroundog = "Sucrose.Backgroundog.exe"; public static readonly string LogDescription = "SucroseWatchdog Thread"; @@ -164,7 +166,7 @@ public static class Readonly public static readonly string PortalMutex = "{Sucrose-Wallpaper-Engine-Portal}"; - public static readonly string SoferityWebsite = $"https://sucrose.soferity.com"; + public static readonly string SoferityWebsite = "https://sucrose.soferity.com"; public static readonly string UpdateMutex = "{Sucrose-Wallpaper-Engine-Update}"; @@ -176,11 +178,11 @@ public static class Readonly public static readonly string ReportdogMutex = "{Sucrose-Wallpaper-Engine-Reportdog}"; - public static readonly string UserAgent = "Sucrose/1.7 (Wallpaper Engine) SucroseWebKit"; - public static readonly string BrowseWebsite = $"https://github.com/{Owner}/{Repository}"; - public static readonly string KeyYouTube = $"https://www.youtube.com/watch?v=kRyML8axJxA"; + public static readonly string UserAgent = "Sucrose/1.7 (Wallpaper Engine) SucroseWebKit"; + + public static readonly string KeyYouTube = "https://www.youtube.com/watch?v=kRyML8axJxA"; public static readonly string SoferityRawWebsite = $"{SoferityWebsite}/{StoreRepository}"; @@ -206,7 +208,7 @@ public static class Readonly public static readonly string AppDataPath = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData); - public static readonly string DownloadStore = $"https://apps.microsoft.com/detail/XP8JGPBHTJGLCQ?launch=true&mode=full"; + public static readonly string DownloadStore = "https://apps.microsoft.com/detail/XP8JGPBHTJGLCQ?launch=true&mode=full"; public static readonly string GitHubRawWebsite = $"https://raw.githubusercontent.com/{Owner}/{StoreRepository}/{Branch}"; diff --git a/src/Library/Sucrose.Resources/Styles/ScrollBar.xaml b/src/Library/Sucrose.Resources/Styles/ScrollBar.xaml index 743b920b5..af82eb67d 100644 --- a/src/Library/Sucrose.Resources/Styles/ScrollBar.xaml +++ b/src/Library/Sucrose.Resources/Styles/ScrollBar.xaml @@ -1,11 +1,11 @@ + xmlns:system="clr-namespace:System;assembly=mscorlib"> - 16 - 8 - 4 + 16 + 8 + 4 diff --git a/src/Portal/Sucrose.Portal/App.xaml b/src/Portal/Sucrose.Portal/App.xaml index 902aae6a1..03c3b36c4 100644 --- a/src/Portal/Sucrose.Portal/App.xaml +++ b/src/Portal/Sucrose.Portal/App.xaml @@ -2,8 +2,8 @@ x:Class="Sucrose.Portal.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" - xmlns:cor="clr-namespace:System;assembly=mscorlib" xmlns:helpers="clr-namespace:Sucrose.Portal.Helpers" + xmlns:system="clr-namespace:System;assembly=mscorlib" xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml" xmlns:xf="clr-namespace:XamlFlair;assembly=XamlFlair.WPF"> @@ -18,7 +18,7 @@ - 1.05 + 1.05 Category in Root.Categories) + if (Root != null && Root.Categories != null && Root.Categories.Any()) { - if (Category.Value.Wallpapers.Any() && (SMMM.Adult || Category.Value.Wallpapers.Count(Wallpaper => Wallpaper.Value.Adult) != Category.Value.Wallpapers.Count())) + foreach (KeyValuePair Category in Root.Categories) { - SymbolRegular Symbol = SPMI.DefaultIcon; - - SymbolTip = new() + if (Category.Value.Wallpapers.Any() && (SMMM.Adult || Category.Value.Wallpapers.Count(Wallpaper => Wallpaper.Value.Adult) != Category.Value.Wallpapers.Count())) { - Content = SRER.GetValue("Portal", "Category", Category.Key.Replace(" ", "")) - }; + SymbolRegular Symbol = SPMI.DefaultIcon; - if (SPMI.CategoryIcons.TryGetValue(Category.Key, out SymbolRegular Icon)) - { - Symbol = Icon; - } + SymbolTip = new() + { + Content = SRER.GetValue("Portal", "Category", Category.Key.Replace(" ", "")) + }; - NavigationViewItem Menu = new(SRER.GetValue("Portal", "Category", Category.Key.Replace(" ", "")), Symbol, null) - { - Tag = Category.Key, - ToolTip = SymbolTip, - IsActive = SPMI.CategoryService.CategoryTag == Category.Key - }; + if (SPMI.CategoryIcons.TryGetValue(Category.Key, out SymbolRegular Icon)) + { + Symbol = Icon; + } - Menu.Click += (s, e) => CategoryClick(s); + NavigationViewItem Menu = new(SRER.GetValue("Portal", "Category", Category.Key.Replace(" ", "")), Symbol, null) + { + Tag = Category.Key, + ToolTip = SymbolTip, + IsActive = SPMI.CategoryService.CategoryTag == Category.Key + }; - Categories.Add(Menu); + Menu.Click += (s, e) => CategoryClick(s); + + Categories.Add(Menu); + } } } diff --git a/src/Shared/Sucrose.Shared.Launcher/Helper/Radius.cs b/src/Shared/Sucrose.Shared.Launcher/Helper/Radius.cs index cdbc2f5ca..f74ae5a05 100644 --- a/src/Shared/Sucrose.Shared.Launcher/Helper/Radius.cs +++ b/src/Shared/Sucrose.Shared.Launcher/Helper/Radius.cs @@ -14,10 +14,7 @@ public static void Corner(ContextMenuStrip ContextMenu) SWNM.DwmSetWindowAttribute(ContextMenu.Handle, Attribute, ref Preference, (uint)Marshal.SizeOf(typeof(uint))); } - catch - { - // - } + catch { } } } } \ No newline at end of file diff --git a/src/Shared/Sucrose.Shared.Launcher/Manager/TrayIconManager.cs b/src/Shared/Sucrose.Shared.Launcher/Manager/TrayIconManager.cs index 6fcc2571b..7e6323e62 100644 --- a/src/Shared/Sucrose.Shared.Launcher/Manager/TrayIconManager.cs +++ b/src/Shared/Sucrose.Shared.Launcher/Manager/TrayIconManager.cs @@ -17,6 +17,7 @@ using SSLCU = Sucrose.Shared.Launcher.Command.Update; using SSLHC = Sucrose.Shared.Launcher.Helper.Calculate; using SSLHR = Sucrose.Shared.Launcher.Helper.Radius; +using SSLMI = Sucrose.Shared.Launcher.Manage.Internal; using SSLPE = Sucrose.Shared.Launcher.Command.Property; using SSLRDR = Sucrose.Shared.Launcher.Renderer.DarkRenderer; using SSLRLR = Sucrose.Shared.Launcher.Renderer.LightRenderer; @@ -79,21 +80,10 @@ public void Initialize() ContextMenu.Renderer = new SSLRLR(); } - ToolStripItem Interface = new ToolStripMenuItem(); - - if (SSSHP.Work(SSSMI.Portal)) - { - Interface = new ToolStripMenuItem(SRER.GetValue("Launcher", "OpenText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "OpenIcon")))) - { - Enabled = false - }; - } - else + ContextMenu.Items.Add(new ToolStripMenuItem(SRER.GetValue("Launcher", "OpenText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "OpenIcon"))), CommandInterface) { - Interface = new ToolStripMenuItem(SRER.GetValue("Launcher", "OpenText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "OpenIcon"))), CommandInterface); - } - - ContextMenu.Items.Add(Interface); + Enabled = !SSSHP.Work(SSSMI.Portal) + }); SSLSSS Separator1 = new(SSDMM.ThemeType); @@ -212,23 +202,15 @@ public void Initialize() SSLSSS Separator2 = new(SSDMM.ThemeType); ContextMenu.Items.Add(Separator2.Strip); - ToolStripItem Setting = new ToolStripMenuItem(); - - if (SSSHP.Work(SSSMI.Portal)) + ContextMenu.Items.Add(new ToolStripMenuItem(SRER.GetValue("Launcher", "SettingText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "SettingIcon"))), CommandSetting) { - Setting = new ToolStripMenuItem(SRER.GetValue("Launcher", "SettingText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "SettingIcon")))) - { - Enabled = false - }; - } - else - { - Setting = new ToolStripMenuItem(SRER.GetValue("Launcher", "SettingText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "SettingIcon"))), CommandSetting); - } - - ContextMenu.Items.Add(Setting); + Enabled = !SSSHP.Work(SSSMI.Portal) + }); - ContextMenu.Items.Add(SRER.GetValue("Launcher", "ReportText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "ReportIcon"))), CommandReport); + ContextMenu.Items.Add(new ToolStripMenuItem(SRER.GetValue("Launcher", "ReportText"), Image.FromFile(SSSHA.Get(SRER.GetValue("Launcher", "ReportIcon"))), CommandReport) + { + Enabled = SSLMI.ReportBox + }); ToolStripItem Update = new ToolStripMenuItem(); diff --git a/src/Update/Sucrose.Update/View/MainWindow.xaml.cs b/src/Update/Sucrose.Update/View/MainWindow.xaml.cs index c6d254f02..f0f607194 100644 --- a/src/Update/Sucrose.Update/View/MainWindow.xaml.cs +++ b/src/Update/Sucrose.Update/View/MainWindow.xaml.cs @@ -29,6 +29,8 @@ using SSCMM = Sucrose.Shared.Core.Manage.Manager; using SSDECDT = Sucrose.Shared.Dependency.Enum.CommandType; using SSDECYT = Sucrose.Shared.Dependency.Enum.CompatibilityType; +using SSDEUST = Sucrose.Shared.Dependency.Enum.UpdateServerType; +using SSDMM = Sucrose.Shared.Dependency.Manage.Manager; using SSESSE = Skylark.Standard.Extension.Storage.StorageExtension; using SSHG = Skylark.Standard.Helper.GitHub; using SSIIA = Skylark.Standard.Interface.IAssets; @@ -117,10 +119,7 @@ private void WindowCorner() SWNM.DwmSetWindowAttribute(SWHWI.Handle(this), Attribute, ref Preference, (uint)Marshal.SizeOf(typeof(uint))); } } - catch - { - // - } + catch { } } private async Task Start() @@ -335,6 +334,18 @@ private bool StepReleases() { Message.Text = SRER.GetValue("Update", "MessageText", "Listing"); + switch (SSDMM.UpdateServerType) + { + case SSDEUST.GitHub: + SSHG.SetUri(SMR.GitHubWebsite); + break; + case SSDEUST.Soferity: + SSHG.SetUri(SMR.SoferityWebsite); + break; + default: + break; + } + Releases = SSHG.ReleasesList(SMR.Owner, SMR.Repository, SMMM.UserAgent, SMMM.Key); if (Releases.Any())