From d6da1f7c6c632d508632bf3537deed28e9ecdd57 Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Mon, 23 Oct 2023 00:59:54 +0300 Subject: [PATCH] Preparing Watchdog --- src/Library/Sucrose.Memory/Readonly.cs | 4 ++-- src/Portal/Sucrose.Portal/Manage/Internal.cs | 6 +++--- .../Sucrose.Portal/Services/LibraryService.cs | 2 ++ .../ViewModels/Windows/MainWindowViewModel.cs | 20 +++++++++++++++++++ .../Views/Controls/ThemeCreate.xaml.cs | 14 ++++++------- .../Sucrose.Commandog/Helper/Arguments.cs | 8 ++------ src/Project/Sucrose.Watchdog/App.xaml.cs | 4 +++- .../View/DarkErrorMessageBox.xaml | 8 ++++---- .../View/LightErrorMessageBox.xaml | 8 ++++---- .../ThemeCreate/Portal.ThemeCreate.TR.xaml | 12 ++++++++--- .../Sucrose.Shared.Space/Helper/Watchdog.cs | 15 ++++++++++++-- 11 files changed, 68 insertions(+), 33 deletions(-) diff --git a/src/Library/Sucrose.Memory/Readonly.cs b/src/Library/Sucrose.Memory/Readonly.cs index 2a8f57a2a..94df2962b 100644 --- a/src/Library/Sucrose.Memory/Readonly.cs +++ b/src/Library/Sucrose.Memory/Readonly.cs @@ -28,7 +28,7 @@ public static class Readonly public static readonly string Content = "Content"; - public static readonly char StartCommandChar = '-'; + public static readonly char StartCommandChar = '✔'; public static readonly string CacheFolder = "Cache"; @@ -38,7 +38,7 @@ public static class Readonly public static readonly string Repository = "Sucrose"; - public static readonly char ValueSeparatorChar = '|'; + public static readonly char ValueSeparatorChar = '✖'; public static readonly string Temporary = "Temporary"; diff --git a/src/Portal/Sucrose.Portal/Manage/Internal.cs b/src/Portal/Sucrose.Portal/Manage/Internal.cs index f408dfc50..14864dc71 100644 --- a/src/Portal/Sucrose.Portal/Manage/Internal.cs +++ b/src/Portal/Sucrose.Portal/Manage/Internal.cs @@ -3,10 +3,10 @@ using Wpf.Ui; using Wpf.Ui.Controls; using SPSBS = Sucrose.Portal.Services.BackdropService; -using SPSLS = Sucrose.Portal.Services.LibraryService; using SPSCES = Sucrose.Portal.Services.CultureService; using SPSCYS = Sucrose.Portal.Services.CategoryService; using SPSDS = Sucrose.Portal.Services.DonateService; +using SPSLS = Sucrose.Portal.Services.LibraryService; using SPSSS = Sucrose.Portal.Services.SearchService; namespace Sucrose.Portal.Manage @@ -17,10 +17,10 @@ internal static class Internal public static SPSDS DonateService = new(); - public static SPSLS LibraryService = new(); - public static SPSSS SearchService = new(); + public static SPSLS LibraryService = new(); + public static SPSBS BackdropService = new(); public static SPSCES CultureService = new(); diff --git a/src/Portal/Sucrose.Portal/Services/LibraryService.cs b/src/Portal/Sucrose.Portal/Services/LibraryService.cs index f79d6d06c..cdebd28c4 100644 --- a/src/Portal/Sucrose.Portal/Services/LibraryService.cs +++ b/src/Portal/Sucrose.Portal/Services/LibraryService.cs @@ -2,6 +2,8 @@ { internal class LibraryService : IDisposable { + public string Theme = string.Empty; + public event EventHandler CreatedWallpaper; public void CreateWallpaper() diff --git a/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs b/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs index 36b01185c..e64850097 100644 --- a/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs +++ b/src/Portal/Sucrose.Portal/ViewModels/Windows/MainWindowViewModel.cs @@ -24,7 +24,12 @@ using SSCHM = Sucrose.Shared.Core.Helper.Memory; using SSCHOS = Sucrose.Shared.Core.Helper.OperatingSystem; using SSCHV = Sucrose.Shared.Core.Helper.Version; +using SSLHK = Sucrose.Shared.Live.Helper.Kill; +using SSLHR = Sucrose.Shared.Live.Helper.Run; using SSRER = Sucrose.Shared.Resources.Extension.Resources; +using SSSHL = Sucrose.Shared.Space.Helper.Live; +using SSSHP = Sucrose.Shared.Space.Helper.Processor; +using SSSMI = Sucrose.Shared.Space.Manage.Internal; using WUAAT = Wpf.Ui.Appearance.ApplicationTheme; using WUAT = Wpf.Ui.Appearance.ApplicationThemeManager; @@ -249,6 +254,21 @@ private async Task OnCreateWallpaper() if (Result == ContentDialogResult.Primary) { + if ((!SMMM.ClosePerformance && !SMMM.PausePerformance) || !SSSHP.Work(SSSMI.Backgroundog)) + { + if (SMMM.LibraryStart) + { + SMMI.LibrarySettingManager.SetSetting(SMC.LibrarySelected, SPMI.LibraryService.Theme); + + if (SSSHL.Run()) + { + SSLHK.Stop(); + } + + SSLHR.Start(); + } + } + SPMI.LibraryService.CreateWallpaper(); } diff --git a/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs b/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs index 16d8840ed..c9aca1385 100644 --- a/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs +++ b/src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs @@ -3,7 +3,6 @@ using System.Windows; using System.Windows.Input; using System.Windows.Media; -using System.Windows.Media.Media3D; using Wpf.Ui.Controls; using XamlAnimatedGif; using OpenFileDialog = Microsoft.Win32.OpenFileDialog; @@ -132,10 +131,10 @@ private void GifPreview_Click(object sender, RoutedEventArgs e) OpenFileDialog FileDialog = new() { - Filter = "Gif Dosyaları (*.gif)|*.gif", + Filter = SSRER.GetValue("Portal", "ThemeCreate", "ThemePreview", "Filter"), FilterIndex = 1, - Title = "Önizleme Dosyası Seç", + Title = SSRER.GetValue("Portal", "ThemeCreate", "ThemePreview", "Title"), InitialDirectory = Startup }; @@ -159,10 +158,10 @@ private void GifThumbnail_Click(object sender, RoutedEventArgs e) OpenFileDialog FileDialog = new() { - Filter = "Resim Dosyaları (*.png;*.jpg;*.jpeg;*.tiff;*.webp)|*.png;*.jpg;*.jpeg;*.tiff;*.webp", + Filter = SSRER.GetValue("Portal", "ThemeCreate", "ThemeThumbnail", "Filter"), FilterIndex = 1, - Title = "Kapak Resmi Seç", + Title = SSRER.GetValue("Portal", "ThemeCreate", "ThemeThumbnail", "Title"), InitialDirectory = Startup }; @@ -266,14 +265,13 @@ protected override async void OnButtonClick(ContentDialogButton Button) { string Name; string Theme; - string Folder; string Preview = "Preview.gif"; string Thumbnail = "Thumbnail.jpg"; do { - Folder = SHG.GenerateString(SMMM.Chars, 25, SMR.Randomise); - Theme = Path.Combine(SMMM.LibraryLocation, Folder); + SPMI.LibraryService.Theme = SHG.GenerateString(SMMM.Chars, 25, SMR.Randomise); + Theme = Path.Combine(SMMM.LibraryLocation, SPMI.LibraryService.Theme); } while (File.Exists(Theme)); Directory.CreateDirectory(Theme); diff --git a/src/Project/Sucrose.Commandog/Helper/Arguments.cs b/src/Project/Sucrose.Commandog/Helper/Arguments.cs index 46a692ce1..ed83311f3 100644 --- a/src/Project/Sucrose.Commandog/Helper/Arguments.cs +++ b/src/Project/Sucrose.Commandog/Helper/Arguments.cs @@ -121,13 +121,9 @@ public static async Task Parse(string[] Arguments) SSSHP.Run(SCHP.ArgumentValue(Values[0])); break; case SSDECT.Watchdog: - if (Values.Count() == 3) + if (Values.Count() == 2) { - SSSHP.Run(SCHP.ArgumentValue(Values[0]), $"{SCHP.ArgumentValue(Values[1])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue(Values[2])}"); - } - else if (Values.Count() == 5) - { - SSSHP.Run(SCHP.ArgumentValue(Values[0]), $"{SCHP.ArgumentValue(Values[1])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue(Values[2])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue(Values[3])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue(Values[4])}"); + SSSHP.Run(SCHP.ArgumentValue(Values[0]), SCHP.ArgumentValue(Values[1])); } break; case SSDECT.Scheduler: diff --git a/src/Project/Sucrose.Watchdog/App.xaml.cs b/src/Project/Sucrose.Watchdog/App.xaml.cs index 7b573a542..17d2efbff 100644 --- a/src/Project/Sucrose.Watchdog/App.xaml.cs +++ b/src/Project/Sucrose.Watchdog/App.xaml.cs @@ -11,6 +11,7 @@ using SWMM = Sucrose.Watchdog.Manage.Manager; using SWVDEMB = Sucrose.Watchdog.View.DarkErrorMessageBox; using SWVLEMB = Sucrose.Watchdog.View.LightErrorMessageBox; +using SSECCE = Skylark.Standard.Extension.Cryptology.CryptologyExtension; namespace Sucrose.Watchdog { @@ -105,7 +106,8 @@ protected void Configure(string[] Args) { if (Args.Any()) { - string[] Arguments = Args.First().Split(SMR.ValueSeparatorChar); + string Decode = SSECCE.BaseToText(Args.First()); + string[] Arguments = Decode.Split(SMR.ValueSeparatorChar); if (Arguments.Any() && (Arguments.Count() == 2 || Arguments.Count() == 4)) { diff --git a/src/Project/Sucrose.Watchdog/View/DarkErrorMessageBox.xaml b/src/Project/Sucrose.Watchdog/View/DarkErrorMessageBox.xaml index 3eb663a33..0ee19962a 100644 --- a/src/Project/Sucrose.Watchdog/View/DarkErrorMessageBox.xaml +++ b/src/Project/Sucrose.Watchdog/View/DarkErrorMessageBox.xaml @@ -9,10 +9,10 @@ WindowStartupLocation="CenterScreen" ResizeMode="CanResizeWithGrip" mc:Ignorable="d" - MinHeight="250" - MinWidth="500" - Height="250" - Width="500"> + MinHeight="300" + MinWidth="600" + Height="300" + Width="600">