From 7c283cadc7083608e52e4a6575280f95bf1080bc Mon Sep 17 00:00:00 2001 From: Taiizor <41683699+Taiizor@users.noreply.github.com> Date: Thu, 21 Sep 2023 03:51:30 +0300 Subject: [PATCH] Update System.cs --- .../Sucrose.Shared.Engine/Helper/System.cs | 113 ++++++++++++++---- 1 file changed, 87 insertions(+), 26 deletions(-) diff --git a/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs b/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs index ebe1f7143..f6079ef1a 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs @@ -16,64 +16,125 @@ public static async void GetSystem() { try { - if (SSEMI.Client == null) - { - SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port); - SSEMI.Client = new(SGSGSS.ChannelInstance); - } + SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port); + SSEMI.Client = new(SGSGSS.ChannelInstance); + } + catch { } - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogCpuResponse Response = SGCSBCS.GetCpu(SSEMI.Client); SSEMI.CpuData = Response.Info; - }); + } + catch + { + SSEMI.CpuData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogBiosResponse Response = SGCSBCS.GetBios(SSEMI.Client); SSEMI.BiosData = Response.Info; - }); + } + catch + { + SSEMI.BiosData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogDateResponse Response = SGCSBCS.GetDate(SSEMI.Client); SSEMI.DateData = Response.Info; - }); + } + catch + { + SSEMI.DateData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogAudioResponse Response = SGCSBCS.GetAudio(SSEMI.Client); SSEMI.AudioData = Response.Info; - }); + } + catch + { + SSEMI.AudioData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogMemoryResponse Response = SGCSBCS.GetMemory(SSEMI.Client); SSEMI.MemoryData = Response.Info; - }); + } + catch + { + SSEMI.MemoryData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogBatteryResponse Response = SGCSBCS.GetBattery(SSEMI.Client); SSEMI.BatteryData = Response.Info; - }); + } + catch + { + SSEMI.BatteryData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogNetworkResponse Response = SGCSBCS.GetNetwork(SSEMI.Client); SSEMI.NetworkData = Response.Info; - }); + } + catch + { + SSEMI.NetworkData = string.Empty; + } + }); - _ = Task.Run(() => + _ = Task.Run(() => + { + try { BackgroundogMotherboardResponse Response = SGCSBCS.GetMotherboard(SSEMI.Client); SSEMI.MotherboardData = Response.Info; - }); - } - catch - { - // - } + } + catch + { + SSEMI.MotherboardData = string.Empty; + } + }); + } + else + { + SSEMI.CpuData = string.Empty; + SSEMI.BiosData = string.Empty; + SSEMI.DateData = string.Empty; + SSEMI.AudioData = string.Empty; + SSEMI.MemoryData = string.Empty; + SSEMI.BatteryData = string.Empty; + SSEMI.NetworkData = string.Empty; + SSEMI.MotherboardData = string.Empty; } await Task.CompletedTask;