diff --git a/src/Project/Sucrose.Backgroundog/Extension/Data.cs b/src/Project/Sucrose.Backgroundog/Extension/Data.cs index 82964bad8..4550db2d0 100644 --- a/src/Project/Sucrose.Backgroundog/Extension/Data.cs +++ b/src/Project/Sucrose.Backgroundog/Extension/Data.cs @@ -18,6 +18,20 @@ public static JObject GetCpuInfo() { "Fullname", SBMI.CpuData.Fullname } }; } + public static JObject GetBiosInfo() + { + return new JObject + { + { "Name", SBMI.BiosData.Name }, + { "Caption", SBMI.BiosData.Caption }, + { "Version", SBMI.BiosData.Version }, + { "Description", SBMI.BiosData.Description }, + { "ReleaseDate", SBMI.BiosData.ReleaseDate }, + { "Manufacturer", SBMI.BiosData.Manufacturer }, + { "SerialNumber", SBMI.BiosData.SerialNumber }, + { "CurrentLanguage", SBMI.BiosData.CurrentLanguage } + }; + } public static JObject GetDateInfo() { diff --git a/src/Project/Sucrose.Backgroundog/Helper/Specification.cs b/src/Project/Sucrose.Backgroundog/Helper/Specification.cs index 04cf66a8a..d5bff6846 100644 --- a/src/Project/Sucrose.Backgroundog/Helper/Specification.cs +++ b/src/Project/Sucrose.Backgroundog/Helper/Specification.cs @@ -161,6 +161,29 @@ public static async Task Start() } }); + _ = Task.Run(() => + { + if (SBMI.BiosManagement) + { + SBMI.BiosManagement = false; + + ManagementObjectSearcher Searcher = new("SELECT * FROM Win32_BIOS"); + + foreach (ManagementObject Object in Searcher.Get().Cast()) + { + SBMI.BiosData.Name = Object["Name"].ToString(); + SBMI.BiosData.Caption = Object["Caption"].ToString(); + SBMI.BiosData.Version = Object["Version"].ToString(); + SBMI.BiosData.Description = Object["Description"].ToString(); + SBMI.BiosData.ReleaseDate = Object["ReleaseDate"].ToString(); + SBMI.BiosData.Manufacturer = Object["Manufacturer"].ToString(); + SBMI.BiosData.SerialNumber = Object["SerialNumber"].ToString(); + SBMI.BiosData.CurrentLanguage = Object["CurrentLanguage"].ToString(); + break; + } + } + }); + _ = Task.Run(() => { foreach (string Name in SSSHN.InstanceNetworkInterfaces()) diff --git a/src/Project/Sucrose.Backgroundog/Manage/Internal.cs b/src/Project/Sucrose.Backgroundog/Manage/Internal.cs index ca8f9493a..18c35ae22 100644 --- a/src/Project/Sucrose.Backgroundog/Manage/Internal.cs +++ b/src/Project/Sucrose.Backgroundog/Manage/Internal.cs @@ -1,7 +1,8 @@ using LibreHardwareMonitor.Hardware; using System.Diagnostics; using SBHI = Sucrose.Backgroundog.Helper.Initialize; -using SBSDBS = Sucrose.Backgroundog.Struct.Data.BatteryStruct; +using SBSDBSS = Sucrose.Backgroundog.Struct.Data.BiosStruct; +using SBSDBYS = Sucrose.Backgroundog.Struct.Data.BatteryStruct; using SBSDCS = Sucrose.Backgroundog.Struct.Data.CpuStruct; using SBSDMDS = Sucrose.Backgroundog.Struct.Data.MotherboardStruct; using SBSDMYS = Sucrose.Backgroundog.Struct.Data.MemoryStruct; @@ -22,6 +23,8 @@ internal static class Internal public static bool CpuManagement = true; + public static bool BiosManagement = true; + public static Timer InitializeTimer = null; public static PerformanceCounter UploadCounter = null; @@ -39,6 +42,18 @@ internal static class Internal Fullname = string.Empty }; + public static SBSDBSS BiosData = new() + { + Name = string.Empty, + Caption = string.Empty, + Version = string.Empty, + Description = string.Empty, + ReleaseDate = string.Empty, + Manufacturer = string.Empty, + SerialNumber = string.Empty, + CurrentLanguage = string.Empty + }; + public static SBSDMYS MemoryData = new() { MemoryUsed = 0f, @@ -63,7 +78,18 @@ internal static class Internal IsMotherboardEnabled = true, }; - public static SBSDBS BatteryData = new() + public static SBSDNS NetworkData = new() + { + Upload = 0f, + Download = 0f, + UploadData = new(), + Name = string.Empty, + DownloadData = new(), + FormatUploadData = string.Empty, + FormatDownloadData = string.Empty + }; + + public static SBSDBYS BatteryData = new() { Voltage = 0f, ChargeRate = 0f, @@ -82,17 +108,6 @@ internal static class Internal RemainingTimeEstimated = 0f }; - public static SBSDNS NetworkData = new() - { - Upload = 0f, - Download = 0f, - UploadData = new(), - Name = string.Empty, - DownloadData = new(), - FormatUploadData = string.Empty, - FormatDownloadData = string.Empty - }; - public static SBSDMDS MotherboardData = new() { Name = string.Empty diff --git a/src/Project/Sucrose.Backgroundog/Struct/Data.cs b/src/Project/Sucrose.Backgroundog/Struct/Data.cs index 64876a06d..cc8e95922 100644 --- a/src/Project/Sucrose.Backgroundog/Struct/Data.cs +++ b/src/Project/Sucrose.Backgroundog/Struct/Data.cs @@ -39,6 +39,46 @@ public struct CpuStruct public string Fullname; } + /// + /// + /// + [StructLayout(LayoutKind.Sequential)] + public struct BiosStruct + { + /// + /// + /// + public string Name; + /// + /// + /// + public string Caption; + /// + /// + /// + public string Version; + /// + /// + /// + public string Description; + /// + /// + /// + public string ReleaseDate; + /// + /// + /// + public string Manufacturer; + /// + /// + /// + public string SerialNumber; + /// + /// + /// + public string CurrentLanguage; + } + /// /// /// diff --git a/src/Shared/Engine/Sucrose.Shared.Engine/Helper/Compatible.cs b/src/Shared/Engine/Sucrose.Shared.Engine/Helper/Compatible.cs index 1d94a4f72..428adc3ec 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine/Helper/Compatible.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine/Helper/Compatible.cs @@ -22,6 +22,11 @@ public static void ExecuteNormal(SESMIEN Function) Function(string.Format(SSEMI.Compatible.SystemCpu, SSEHS.GetSystemCpu())); } + if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemBios)) + { + Function(string.Format(SSEMI.Compatible.SystemBios, SSEHS.GetSystemBios())); + } + if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemDate)) { Function(string.Format(SSEMI.Compatible.SystemDate, SSEHS.GetSystemDate())); diff --git a/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs b/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs index a17671fa5..5f2a64f8f 100644 --- a/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs +++ b/src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs @@ -32,6 +32,28 @@ public static string GetSystemCpu() return string.Empty; } + public static string GetSystemBios() + { + if (SSSHP.Work(SMR.Backgroundog)) + { + try + { + SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port); + SSEMI.Client = new(SGSGSS.ChannelInstance); + + BackgroundogBiosResponse Response = SGCSBCS.GetBios(SSEMI.Client); + + return Response.Info; + } + catch + { + // + } + } + + return string.Empty; + } + public static string GetSystemDate() { if (SSSHP.Work(SMR.Backgroundog)) diff --git a/src/Shared/Sucrose.Shared.Dependency/Enum/CompatibilityType.cs b/src/Shared/Sucrose.Shared.Dependency/Enum/CompatibilityType.cs index c40ccf62c..1d8663a0d 100644 --- a/src/Shared/Sucrose.Shared.Dependency/Enum/CompatibilityType.cs +++ b/src/Shared/Sucrose.Shared.Dependency/Enum/CompatibilityType.cs @@ -58,6 +58,10 @@ public enum CompatibilityType /// InvalidUrl, /// + /// Geçersiz sistem bios değeri! + /// + SystemBios, + /// /// Geçersiz sistem zamanı değeri! /// SystemDate, diff --git a/src/Shared/Sucrose.Shared.Server/Services/BackgroundogServerService.cs b/src/Shared/Sucrose.Shared.Server/Services/BackgroundogServerService.cs index d78282813..b8c1eaaea 100644 --- a/src/Shared/Sucrose.Shared.Server/Services/BackgroundogServerService.cs +++ b/src/Shared/Sucrose.Shared.Server/Services/BackgroundogServerService.cs @@ -36,6 +36,11 @@ public override Task DateBackgroundog(Empty _, ServerC return Task.FromResult(new BackgroundogDateResponse { Info = JsonConvert.SerializeObject(SBED.GetDateInfo(), Formatting.Indented) }); } + public override Task BiosBackgroundog(Empty _, ServerCallContext Context) + { + return Task.FromResult(new BackgroundogBiosResponse { Info = JsonConvert.SerializeObject(SBED.GetBiosInfo(), Formatting.Indented) }); + } + public override Task CpuBackgroundog(Empty _, ServerCallContext Context) { return Task.FromResult(new BackgroundogCpuResponse { Info = JsonConvert.SerializeObject(SBED.GetCpuInfo(), Formatting.Indented) }); diff --git a/src/Shared/Sucrose.Shared.Theme/Helper/Compatible.cs b/src/Shared/Sucrose.Shared.Theme/Helper/Compatible.cs index 4d25f8968..7e9e10b29 100644 --- a/src/Shared/Sucrose.Shared.Theme/Helper/Compatible.cs +++ b/src/Shared/Sucrose.Shared.Theme/Helper/Compatible.cs @@ -16,6 +16,9 @@ internal partial class Compatible [JsonProperty("SystemCpu", Required = Required.Default)] public string SystemCpu { get; set; } + [JsonProperty("SystemBios", Required = Required.Default)] + public string SystemBios { get; set; } + [JsonProperty("SystemDate", Required = Required.Default)] public string SystemDate { get; set; } diff --git a/src/Shared/Sucrose.Shared.Theme/Helper/Zip.cs b/src/Shared/Sucrose.Shared.Theme/Helper/Zip.cs index 2aabe73d7..579551b8c 100644 --- a/src/Shared/Sucrose.Shared.Theme/Helper/Zip.cs +++ b/src/Shared/Sucrose.Shared.Theme/Helper/Zip.cs @@ -178,6 +178,12 @@ public static SSDECT Check(string Archive) return SSDECT.SystemCpu; } + // Compatible içindeki SystemBios değeri boş değil ve {0} içermiyor mu? + if (!string.IsNullOrEmpty(Compatible.SystemBios) && !Compatible.SystemBios.Contains("{0}")) + { + return SSDECT.SystemBios; + } + // Compatible içindeki SystemDate değeri boş değil ve {0} içermiyor mu? if (!string.IsNullOrEmpty(Compatible.SystemDate) && !Compatible.SystemDate.Contains("{0}")) { diff --git a/src/gRPC/Sucrose.Grpc.Client/Services/BackgroundogClientService.cs b/src/gRPC/Sucrose.Grpc.Client/Services/BackgroundogClientService.cs index d4fc49350..73640fee1 100644 --- a/src/gRPC/Sucrose.Grpc.Client/Services/BackgroundogClientService.cs +++ b/src/gRPC/Sucrose.Grpc.Client/Services/BackgroundogClientService.cs @@ -41,6 +41,13 @@ public static BackgroundogDateResponse GetDate(BackgroundogClient Client) return Response; } + public static BackgroundogBiosResponse GetBios(BackgroundogClient Client) + { + BackgroundogBiosResponse Response = Client.BiosBackgroundog(new Empty()); + + return Response; + } + public static BackgroundogCpuResponse GetCpu(BackgroundogClient Client) { BackgroundogCpuResponse Response = Client.CpuBackgroundog(new Empty()); diff --git a/src/gRPC/Sucrose.Grpc.Common/Proto/Backgroundog.proto b/src/gRPC/Sucrose.Grpc.Common/Proto/Backgroundog.proto index c968a9562..3435f1ac6 100644 --- a/src/gRPC/Sucrose.Grpc.Common/Proto/Backgroundog.proto +++ b/src/gRPC/Sucrose.Grpc.Common/Proto/Backgroundog.proto @@ -11,6 +11,7 @@ service Backgroundog { rpc BatteryBackgroundog (google.protobuf.Empty) returns (BackgroundogBatteryResponse); rpc MemoryBackgroundog (google.protobuf.Empty) returns (BackgroundogMemoryResponse); rpc DateBackgroundog (google.protobuf.Empty) returns (BackgroundogDateResponse); + rpc BiosBackgroundog (google.protobuf.Empty) returns (BackgroundogBiosResponse); rpc CpuBackgroundog (google.protobuf.Empty) returns (BackgroundogCpuResponse); } @@ -34,6 +35,10 @@ message BackgroundogDateResponse { string info = 1; } +message BackgroundogBiosResponse { + string info = 1; +} + message BackgroundogCpuResponse { string info = 1; } \ No newline at end of file