From b3cc60e0bf88cebff936065eb3052acda3695833 Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:22:52 +0300 Subject: [PATCH] Preparing Watchdog --- .../Views/Controls/OtherAbout.xaml | 18 +++++++++--- .../Sucrose.Shared.Space/Helper/Watchdog.cs | 28 +++++++++++++------ 2 files changed, 34 insertions(+), 12 deletions(-) diff --git a/src/Portal/Sucrose.Portal/Views/Controls/OtherAbout.xaml b/src/Portal/Sucrose.Portal/Views/Controls/OtherAbout.xaml index 34bae4cff..0942fc265 100644 --- a/src/Portal/Sucrose.Portal/Views/Controls/OtherAbout.xaml +++ b/src/Portal/Sucrose.Portal/Views/Controls/OtherAbout.xaml @@ -35,52 +35,62 @@ @@ -89,13 +99,13 @@ @@ -121,13 +131,13 @@ diff --git a/src/Shared/Sucrose.Shared.Space/Helper/Watchdog.cs b/src/Shared/Sucrose.Shared.Space/Helper/Watchdog.cs index 82747056e..1080f4ca1 100644 --- a/src/Shared/Sucrose.Shared.Space/Helper/Watchdog.cs +++ b/src/Shared/Sucrose.Shared.Space/Helper/Watchdog.cs @@ -1,4 +1,5 @@ -using SMR = Sucrose.Memory.Readonly; +using System.IO; +using SMR = Sucrose.Memory.Readonly; using SSDECT = Sucrose.Shared.Dependency.Enum.CommandsType; using SSSHP = Sucrose.Shared.Space.Helper.Processor; using SSSMI = Sucrose.Shared.Space.Manage.Internal; @@ -9,19 +10,30 @@ internal static class Watchdog { public static void Start(string Message, string Path) { - SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Message}{SMR.ValueSeparator}{Path}"); + if (Check()) + { + SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Message}{SMR.ValueSeparator}{Path}"); + } } public static void Start(string Message, string Path, string Source, string Text) { - if (string.IsNullOrEmpty(Source) || string.IsNullOrEmpty(Text)) - { - Start(Message, Path); - } - else + if (Check()) { - SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Watchdog}{SMR.ValueSeparator}{SSSMI.Watchdog}{SMR.ValueSeparator}{Message}{SMR.ValueSeparator}{Path}{SMR.ValueSeparator}{Source}{SMR.ValueSeparator}{Text}"); + if (string.IsNullOrEmpty(Source) || string.IsNullOrEmpty(Text)) + { + Start(Message, Path); + } + 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}"); + } } } + + private static bool Check() + { + return File.Exists(SSSMI.Commandog) && File.Exists(SSSMI.Watchdog); + } } } \ No newline at end of file