Skip to content

Commit

Permalink
Preparing Watchdog
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 22, 2023
1 parent c0da055 commit d6da1f7
Show file tree
Hide file tree
Showing 11 changed files with 68 additions and 33 deletions.
4 changes: 2 additions & 2 deletions src/Library/Sucrose.Memory/Readonly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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";

Expand All @@ -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";

Expand Down
6 changes: 3 additions & 3 deletions src/Portal/Sucrose.Portal/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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();
Expand Down
2 changes: 2 additions & 0 deletions src/Portal/Sucrose.Portal/Services/LibraryService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
{
internal class LibraryService : IDisposable
{
public string Theme = string.Empty;

public event EventHandler CreatedWallpaper;

public void CreateWallpaper()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand Down Expand Up @@ -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();
}

Expand Down
14 changes: 6 additions & 8 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeCreate.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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
};
Expand All @@ -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
};
Expand Down Expand Up @@ -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);
Expand Down
8 changes: 2 additions & 6 deletions src/Project/Sucrose.Commandog/Helper/Arguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,13 +121,9 @@ public static async Task Parse(string[] Arguments)
SSSHP.Run(SCHP.ArgumentValue<string>(Values[0]));
break;
case SSDECT.Watchdog:
if (Values.Count() == 3)
if (Values.Count() == 2)
{
SSSHP.Run(SCHP.ArgumentValue<string>(Values[0]), $"{SCHP.ArgumentValue<string>(Values[1])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue<string>(Values[2])}");
}
else if (Values.Count() == 5)
{
SSSHP.Run(SCHP.ArgumentValue<string>(Values[0]), $"{SCHP.ArgumentValue<string>(Values[1])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue<string>(Values[2])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue<string>(Values[3])}{SMR.ValueSeparatorChar}{SCHP.ArgumentValue<string>(Values[4])}");
SSSHP.Run(SCHP.ArgumentValue<string>(Values[0]), SCHP.ArgumentValue<string>(Values[1]));
}
break;
case SSDECT.Scheduler:
Expand Down
4 changes: 3 additions & 1 deletion src/Project/Sucrose.Watchdog/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down Expand Up @@ -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))
{
Expand Down
8 changes: 4 additions & 4 deletions src/Project/Sucrose.Watchdog/View/DarkErrorMessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<Window.Resources>
<Style TargetType="Button">
Expand Down
8 changes: 4 additions & 4 deletions src/Project/Sucrose.Watchdog/View/LightErrorMessageBox.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<Window.Resources>
<Style TargetType="Button">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,16 @@
<system:String x:Key="Portal.ThemeCreate.ThemeContact.Hint">Lütfen geçerli bir iletişim adresi yazın</system:String>
<system:String x:Key="Portal.ThemeCreate.ThemeArguments.Hint">Lütfen geçerli bir uygulama argümanları yazın</system:String>

<system:String x:Key="Portal.ThemeCreate.ThemePreview.Hint">Bir kapak resmi seçin</system:String>
<system:String x:Key="Portal.ThemeCreate.ThemeThumbnail.Hint">Bir önizleme dosyası seçin</system:String>
<system:String x:Key="Portal.ThemeCreate.ThemeThumbnail.Hint">Bir kapak resmi seçin</system:String>
<system:String x:Key="Portal.ThemeCreate.ThemePreview.Hint">Bir önizleme dosyası seçin</system:String>

<system:String x:Key="Portal.ThemeCreate.DragDrop.Delete">Geri Al</system:String>

<system:String x:Key="Portal.ThemeCreate.DragDrop.Gif">Gif dosyanızı buraya sürükleyin ve bırakın</system:String>

<system:String x:Key="Portal.ThemeCreate.ThemeThumbnail.Title">Kapak Resmi Seç</system:String>
<system:String x:Key="Portal.ThemeCreate.ThemeThumbnail.Filter">Resim Dosyaları (*.png;*.jpg;*.jpeg;*.tiff;*.webp)|*.png;*.jpg;*.jpeg;*.tiff;*.webp</system:String>

<system:String x:Key="Portal.ThemeCreate.ThemePreview.Title">Önizleme Dosyası Seç</system:String>
<system:String x:Key="Portal.ThemeCreate.ThemePreview.Filter">Gif Dosyaları (*.gif)|*.gif</system:String>
</ResourceDictionary>
15 changes: 13 additions & 2 deletions src/Shared/Sucrose.Shared.Space/Helper/Watchdog.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.IO;
using SMR = Sucrose.Memory.Readonly;
using SSDECT = Sucrose.Shared.Dependency.Enum.CommandsType;
using SSECCE = Skylark.Standard.Extension.Cryptology.CryptologyExtension;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSMI = Sucrose.Shared.Space.Manage.Internal;

Expand All @@ -12,7 +13,7 @@ public static void Start(string Message, string Path)
{
if (Check())
{
SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Message}{SMR.ValueSeparator}{Path}");
SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Encrypt(Message, Path)}");
}
}

Expand All @@ -26,7 +27,7 @@ public static void Start(string Message, string Path, string Source, string Text
}
else
{
SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Message}{SMR.ValueSeparator}{Path}{SMR.ValueSeparator}{Source}{SMR.ValueSeparator}{Text}");
SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Encrypt(Message, Path, Source, Text)}");
}
}
}
Expand All @@ -35,5 +36,15 @@ private static bool Check()
{
return File.Exists(SSSMI.Commandog) && File.Exists(SSSMI.Watchdog);
}

private static string Encrypt(string Message, string Path)
{
return SSECCE.TextToBase($"{Message}{SMR.ValueSeparator}{Path}");
}

private static string Encrypt(string Message, string Path, string Source, string Text)
{
return SSECCE.TextToBase($"{Message}{SMR.ValueSeparator}{Path}{SMR.ValueSeparator}{Source}{SMR.ValueSeparator}{Text}");
}
}
}

0 comments on commit d6da1f7

Please sign in to comment.