Skip to content

Commit

Permalink
Preparing Backgroundog
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Sep 18, 2023
1 parent 7e6d4af commit a90f687
Show file tree
Hide file tree
Showing 20 changed files with 233 additions and 43 deletions.
2 changes: 0 additions & 2 deletions src/Library/Sucrose.Manager/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ public static class Manager

public static bool Shuffle => SMMI.EngineSettingManager.GetSetting(SMC.Shuffle, true);

public static int Port => SMMI.LauncherSettingManager.GetSettingStable(SMC.Port, 0);

public static string Key => SMMI.PrivateSettingManager.GetSetting(SMC.Key, SMR.Key);

public static bool Start => SMMI.EngineSettingManager.GetSetting(SMC.Start, false);
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.Aurora/Sucrose.Live.Aurora.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc\Sucrose.Grpc.csproj" />
<ProjectReference Include="..\..\Library\Sucrose.Manager\Sucrose.Manager.csproj" />
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc.Client\Sucrose.Grpc.Client.csproj" />
</ItemGroup>

<Import Project="..\..\Shared\Sucrose.Shared.Zip\Sucrose.Shared.Zip.projitems" Label="Shared" />
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.CefSharp/Sucrose.Live.CefSharp.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc\Sucrose.Grpc.csproj" />
<ProjectReference Include="..\..\Library\Sucrose.Manager\Sucrose.Manager.csproj" />
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc.Client\Sucrose.Grpc.Client.csproj" />
</ItemGroup>

<Import Project="..\..\Shared\Sucrose.Shared.Zip\Sucrose.Shared.Zip.projitems" Label="Shared" />
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.MpvPlayer/Sucrose.Live.MpvPlayer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc\Sucrose.Grpc.csproj" />
<ProjectReference Include="..\..\Library\Sucrose.Manager\Sucrose.Manager.csproj" />
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc.Client\Sucrose.Grpc.Client.csproj" />
</ItemGroup>

<Import Project="..\..\Shared\Sucrose.Shared.Zip\Sucrose.Shared.Zip.projitems" Label="Shared" />
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.Nebula/Sucrose.Live.Nebula.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc\Sucrose.Grpc.csproj" />
<ProjectReference Include="..\..\Library\Sucrose.Manager\Sucrose.Manager.csproj" />
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc.Client\Sucrose.Grpc.Client.csproj" />
</ItemGroup>

<Import Project="..\..\Shared\Sucrose.Shared.Zip\Sucrose.Shared.Zip.projitems" Label="Shared" />
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.Vexana/Sucrose.Live.Vexana.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc\Sucrose.Grpc.csproj" />
<ProjectReference Include="..\..\Library\Sucrose.Manager\Sucrose.Manager.csproj" />
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc.Client\Sucrose.Grpc.Client.csproj" />
</ItemGroup>

<Import Project="..\..\Shared\Sucrose.Shared.Zip\Sucrose.Shared.Zip.projitems" Label="Shared" />
Expand Down
2 changes: 2 additions & 0 deletions src/Live/Sucrose.Live.WebView/Sucrose.Live.WebView.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc\Sucrose.Grpc.csproj" />
<ProjectReference Include="..\..\Library\Sucrose.Manager\Sucrose.Manager.csproj" />
<ProjectReference Include="..\..\gRPC\Sucrose.Grpc.Client\Sucrose.Grpc.Client.csproj" />
</ItemGroup>

<Import Project="..\..\Shared\Sucrose.Shared.Zip\Sucrose.Shared.Zip.projitems" Label="Shared" />
Expand Down
2 changes: 2 additions & 0 deletions src/Portal/Sucrose.Portal/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ internal static class Manager

public static SEWTT Theme => SMMI.GeneralSettingManager.GetSetting(SMC.ThemeType, SWHWT.GetTheme());

public static int Port => SMMI.LauncherSettingManager.GetSettingStable(SMC.Port, 0);

public static WindowBackdropType DefaultBackdropType => WindowBackdropType.None;

public static Stretch DefaultBackgroundStretch => Stretch.UniformToFill;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -428,7 +428,7 @@ private void NotifySelected(int Index)

if (SSSHP.Work(SMR.Launcher))
{
SGSGSS.ChannelCreate($"{SPMM.Host}", SMMM.Port);
SGSGSS.ChannelCreate($"{SPMM.Host}", SPMM.Port);
SGCLLC Client = new(SGSGSS.ChannelInstance);

if (State)
Expand Down
11 changes: 1 addition & 10 deletions src/Project/Sucrose.Backgroundog/Helper/Specification.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
using LibreHardwareMonitor.Hardware;
using Newtonsoft.Json;
using Skylark.Enum;
using Skylark.Helper;
using Skylark.Standard.Extension.Storage;
using Sucrose.Backgroundog.Extension;
using System.Management;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SMMM = Sucrose.Manager.Manage.Manager;
Expand Down Expand Up @@ -193,13 +191,6 @@ public static async Task Start()
}
});

Console.WriteLine("Cpu" + Environment.NewLine + JsonConvert.SerializeObject(Data.GetCpuInfo(), Formatting.Indented));
Console.WriteLine("Date" + Environment.NewLine + JsonConvert.SerializeObject(Data.GetDateInfo(), Formatting.Indented));
Console.WriteLine("Memory" + Environment.NewLine + JsonConvert.SerializeObject(Data.GetMemoryInfo(), Formatting.Indented));
Console.WriteLine("Battery" + Environment.NewLine + JsonConvert.SerializeObject(Data.GetBatteryInfo(), Formatting.Indented));
Console.WriteLine("Network" + Environment.NewLine + JsonConvert.SerializeObject(Data.GetNetworkInfo(), Formatting.Indented));
Console.WriteLine("Motherboard" + Environment.NewLine + JsonConvert.SerializeObject(Data.GetMotherboardInfo(), Formatting.Indented));

//foreach (IHardware Hardware in SBMI.Computer.Hardware)
//{
// Console.WriteLine("Hardware: {0}", Hardware.Name);
Expand All @@ -220,7 +211,7 @@ public static async Task Start()
// }
//}

Console.WriteLine("----------------------------------------------");
//Console.WriteLine("----------------------------------------------");
}

await Task.CompletedTask;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public static void WebEngineInitializationCompleted(object sender, CoreWebView2I

SSEWVMI.WebEngine.CoreWebView2.DOMContentLoaded += WebEngineDOMContentLoaded;

//SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow();
SSEWVMI.WebEngine.CoreWebView2.OpenDevToolsWindow();
}
}
}
30 changes: 28 additions & 2 deletions src/Shared/Engine/Sucrose.Shared.Engine/Helper/Compatible.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using SESMIEN = Sucrose.Shared.Engine.Manage.Internal.ExecuteNormal;
using SESMIET = Sucrose.Shared.Engine.Manage.Internal.ExecuteTask;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHS = Sucrose.Shared.Engine.Helper.System;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

namespace Sucrose.Shared.Engine.Helper
Expand All @@ -16,6 +17,16 @@ public static void ExecuteNormal(SESMIEN Function)
Function(string.Format(SSEMI.Compatible.LoopMode, SSEHD.GetLoop()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemCpu))
{
Function(string.Format(SSEMI.Compatible.SystemCpu, SSEHS.GetSystemCpu()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemDate))
{
Function(string.Format(SSEMI.Compatible.SystemDate, SSEHS.GetSystemDate()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.VolumeLevel))
{
Function(string.Format(SSEMI.Compatible.VolumeLevel, SSEHD.GetVolume()));
Expand All @@ -31,9 +42,24 @@ public static void ExecuteNormal(SESMIEN Function)
Function(string.Format(SSEMI.Compatible.StretchMode, SSEHD.GetStretch()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.ComputerDate))
if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemMemory))
{
Function(string.Format(SSEMI.Compatible.SystemMemory, SSEHS.GetSystemMemory()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemBattery))
{
Function(string.Format(SSEMI.Compatible.SystemBattery, SSEHS.GetSystemBattery()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemNetwork))
{
Function(string.Format(SSEMI.Compatible.SystemNetwork, SSEHS.GetSystemNetwork()));
}

if (!string.IsNullOrEmpty(SSEMI.Compatible.SystemMotherboard))
{
Function(string.Format(SSEMI.Compatible.ComputerDate, SSEHD.GetComputerDate()));
Function(string.Format(SSEMI.Compatible.SystemMotherboard, SSEHS.GetSystemMotherboard()));
}
}
}
Expand Down
18 changes: 1 addition & 17 deletions src/Shared/Engine/Sucrose.Shared.Engine/Helper/Data.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using Newtonsoft.Json.Linq;
using SEDST = Skylark.Enum.DuplicateScreenType;
using SEDST = Skylark.Enum.DuplicateScreenType;
using SEEST = Skylark.Enum.ExpandScreenType;
using SEST = Skylark.Enum.ScreenType;
using SMMM = Sucrose.Manager.Manage.Manager;
Expand Down Expand Up @@ -55,21 +54,6 @@ public static SSDEDT GetDisplayType()
return SSEMM.DisplayType;
}

public static JObject GetComputerDate()
{
DateTime Date = DateTime.Now;

return new JObject
{
{ "Year", Date.Year },
{ "Month", Date.Month },
{ "Day", Date.Day },
{ "Hour", Date.Hour },
{ "Minute", Date.Minute },
{ "Second", Date.Second }
};
}

public static SEEST GetExpandScreenType()
{
return SSEMM.ExpandScreenType;
Expand Down
103 changes: 103 additions & 0 deletions src/Shared/Engine/Sucrose.Shared.Engine/Helper/System.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
using SSEMM = Sucrose.Shared.Engine.Manage.Manager;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SGSGSS = Sucrose.Grpc.Services.GeneralServerService;
using SGCSBCS = Sucrose.Grpc.Client.Services.BackgroundogClientService;
using SMR = Sucrose.Memory.Readonly;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using Sucrose.Grpc.Common;

namespace Sucrose.Shared.Engine.Helper
{
internal static class System
{
public static string GetSystemCpu()
{
if (SSSHP.Work(SMR.Backgroundog))
{
SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port);
SSEMI.Client = new(SGSGSS.ChannelInstance);

BackgroundogCpuResponse Response = SGCSBCS.GetCpu(SSEMI.Client);

return Response.Info;
}

return string.Empty;
}

public static string GetSystemDate()
{
if (SSSHP.Work(SMR.Backgroundog))
{
SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port);
SSEMI.Client = new(SGSGSS.ChannelInstance);

BackgroundogDateResponse Response = SGCSBCS.GetDate(SSEMI.Client);

return Response.Info;
}

return string.Empty;
}

public static string GetSystemMemory()
{
if (SSSHP.Work(SMR.Backgroundog))
{
SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port);
SSEMI.Client = new(SGSGSS.ChannelInstance);

BackgroundogMemoryResponse Response = SGCSBCS.GetMemory(SSEMI.Client);

return Response.Info;
}

return string.Empty;
}

public static string GetSystemBattery()
{
if (SSSHP.Work(SMR.Backgroundog))
{
SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port);
SSEMI.Client = new(SGSGSS.ChannelInstance);

BackgroundogBatteryResponse Response = SGCSBCS.GetBattery(SSEMI.Client);

return Response.Info;
}

return string.Empty;
}

public static string GetSystemNetwork()
{
if (SSSHP.Work(SMR.Backgroundog))
{
SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port);
SSEMI.Client = new(SGSGSS.ChannelInstance);

BackgroundogNetworkResponse Response = SGCSBCS.GetNetwork(SSEMI.Client);

return Response.Info;
}

return string.Empty;
}

public static string GetSystemMotherboard()
{
if (SSSHP.Work(SMR.Backgroundog))
{
SGSGSS.ChannelCreate($"{SSEMM.Host}", SSEMM.Port);
SSEMI.Client = new(SGSGSS.ChannelInstance);

BackgroundogMotherboardResponse Response = SGCSBCS.GetMotherboard(SSEMI.Client);

return Response.Info;
}

return string.Empty;
}
}
}
3 changes: 3 additions & 0 deletions src/Shared/Engine/Sucrose.Shared.Engine/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,14 @@
using SSESB = Sucrose.Shared.Engine.Setting.Browser;
using SSTHC = Sucrose.Shared.Theme.Helper.Compatible;
using SSTHP = Sucrose.Shared.Theme.Helper.Properties;
using SGCBBC = Sucrose.Grpc.Common.Backgroundog.BackgroundogClient;

namespace Sucrose.Shared.Engine.Manage
{
internal static class Internal
{
public static SGCBBC Client = null;

public static bool Initialized = false;

public static SSTHP Properties = new();
Expand Down
7 changes: 6 additions & 1 deletion src/Shared/Engine/Sucrose.Shared.Engine/Manage/Manager.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SEDST = Skylark.Enum.DuplicateScreenType;
using System.Net;
using SEDST = Skylark.Enum.DuplicateScreenType;
using SEEST = Skylark.Enum.ExpandScreenType;
using SEST = Skylark.Enum.ScreenType;
using SEWTT = Skylark.Enum.WindowsThemeType;
Expand All @@ -17,6 +18,8 @@ internal static class Manager

public static SEEST ExpandScreenType => SMMI.EngineSettingManager.GetSetting(SMC.ExpandScreenType, SEEST.Default);

public static IPAddress Host => SMMI.BackgroundogSettingManager.GetSettingAddress(SMC.Host, IPAddress.Loopback);

public static SEST ScreenType => SMMI.EngineSettingManager.GetSetting(SMC.ScreenType, SEST.DisplayBound);

public static SSDEDT DisplayType => SMMI.EngineSettingManager.GetSetting(SMC.DisplayType, SSDEDT.Screen);
Expand All @@ -25,6 +28,8 @@ internal static class Manager

public static SEWTT Theme => SMMI.GeneralSettingManager.GetSetting(SMC.ThemeType, SWHWT.GetTheme());

public static int Port => SMMI.BackgroundogSettingManager.GetSettingStable(SMC.Port, 0);

public static SSDEST DefaultStretchType => SSDEST.None;

public static Mutex Mutex => new(true, SMR.LiveMutex);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
</PropertyGroup>
<ItemGroup>
<Compile Include="$(MSBuildThisFileDirectory)Event\Handler.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\System.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Properties.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Data.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Helper\Compatible.cs" />
Expand Down
Loading

0 comments on commit a90f687

Please sign in to comment.