Skip to content

Commit

Permalink
Preparing Performance Setting Page
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Sep 18, 2023
1 parent 084d5eb commit afc4e2b
Show file tree
Hide file tree
Showing 27 changed files with 394 additions and 17 deletions.
4 changes: 4 additions & 0 deletions src/Library/Sucrose.Manager/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,10 @@ public static class Internal

public static readonly SMLM CefSharpLiveLogManager = new("CefSharpLive-{0}.log");

public static readonly SMLM BackgroundogLogManager = new("Backgroundog-{0}.log");

public static readonly SMSM BackgroundogSettingManager = new("Backgroundog.json");

public static readonly SMLM MpvPlayerLiveLogManager = new("MpvPlayerLive-{0}.log");
}
}
4 changes: 4 additions & 0 deletions src/Library/Sucrose.Memory/Readonly.cs
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,8 @@ public static class Readonly

public static readonly string ValueSeparator = $"{ValueSeparatorChar}";

public static readonly string Backgroundog = "Sucrose.Backgroundog.exe";

public static readonly string LogDescription = "SucroseWatchdog Thread";

public static readonly string DiscordApplication = "1126294965950103612";
Expand Down Expand Up @@ -108,6 +110,8 @@ public static class Readonly

public static readonly string KeyYouTube = $"https://www.youtube.com/watch?v=kRyML8axJxA";

public static readonly string BackgroundogMutex = "{Sucrose-Wallpaper-Engine-Backgroundog}";

public static readonly string WikiWebsite = $"https://github.com/{Owner}/{Repository}/wiki";

public static readonly string StoreWebsite = $"https://github.com/{Owner}/{StoreRepository}";
Expand Down
59 changes: 59 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
using System.Globalization;
using SBMM = Sucrose.Backgroundog.Manage.Manager;
using SGCB = Sucrose.Grpc.Common.Backgroundog;
using SGSGSS = Sucrose.Grpc.Services.GeneralServerService;
using SHC = Skylark.Helper.Culture;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMMM = Sucrose.Manager.Manage.Manager;
using SMR = Sucrose.Memory.Readonly;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSSBSS = Sucrose.Shared.Server.Services.BackgroundogServerService;
using SSWW = Sucrose.Shared.Watchdog.Watch;

namespace Sucrose.Backgroundog
{
internal class App
{
internal static void Main()
{
try
{
SHC.All = new CultureInfo(SMMM.Culture, true);

if (SBMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Backgroundog) <= 1)
{
Console.WriteLine("Start");

SGSGSS.ServerCreate(SGCB.BindService(new SSSSBSS()));

SMMI.BackgroundogSettingManager.SetSetting(SMC.Host, SGSGSS.Host);
SMMI.BackgroundogSettingManager.SetSetting(SMC.Port, SGSGSS.Port);

SGSGSS.ServerInstance.Start();

Console.ReadKey();

SGSGSS.ServerInstance.KillAsync().Wait();
//SGSGSS.ServerInstance.ShutdownAsync().Wait();

Console.WriteLine("Stop");
}
}
catch (Exception Exception)
{
SSWW.Watch_CatchException(Exception);
}
finally
{
Close();
}
}

protected static void Close()
{
Environment.Exit(0);
Application.Exit();
}
}
}
81 changes: 81 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.manifest
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
<?xml version="1.0" encoding="utf-8"?>
<assembly manifestVersion="1.0" xmlns="urn:schemas-microsoft-com:asm.v1">
<assemblyIdentity version="1.0.0.0" name="MyApplication.app"/>
<trustInfo xmlns="urn:schemas-microsoft-com:asm.v2">
<security>
<requestedPrivileges xmlns="urn:schemas-microsoft-com:asm.v3">
<!-- UAC Bildirim Seçenekleri
Windows Kullanıcı Hesabı Denetimi düzeyini değiştirmek istiyorsanız
requestedExecutionLevel düğümünü aşağıdakilerden biriyle değiştirin.
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
<requestedExecutionLevel level="requireAdministrator" uiAccess="false" />
<requestedExecutionLevel level="highestAvailable" uiAccess="false" />
requestedExecutionLevel öğesini belirtmek, dosya ve kayıt defteri sanallaştırmasını devre dışı bırakır.
Uygulamanız geriye doğru uyumluluk için bu sanallaştırmayı gerektiriyorsa, bu öğeyi
kaldırın.
-->
<requestedExecutionLevel level="asInvoker" uiAccess="false" />
</requestedPrivileges>
</security>
</trustInfo>

<compatibility xmlns="urn:schemas-microsoft-com:compatibility.v1">
<application>
<!-- Bu uygulamanın test edildiği ve birlikte çalışmak için tasarlandığı
Windows sürümlerinin bir listesi. Uygun öğelerin açıklamasını kaldırdığınızda Windows
en uyumlu ortamı otomatik olarak seçer. -->

<!-- Windows Vista -->
<!--<supportedOS Id="{e2011457-1546-43c5-a5fe-008deee3d3f0}" />-->

<!-- Windows 7 -->
<!--<supportedOS Id="{35138b9a-5d96-4fbd-8e2d-a2440225f93a}" />-->

<!-- Windows 8 -->
<!--<supportedOS Id="{4a2f28e3-53b9-4441-ba9c-d69d4a4a6e38}" />-->

<!-- Windows 8.1 -->
<!--<supportedOS Id="{1f676c76-80e1-4239-95bb-83d0f6d0da78}" />-->

<!-- Windows 10 -->
<!--<supportedOS Id="{8e0f7a12-bfb3-4fe8-b9a5-48fd50a15a9a}" />-->

</application>
</compatibility>

<!-- Uygulamanın DPI kullanan uygulama olduğunu ve yüksek DPI'larda Windows tarafından otomatik olarak ölçeklendirilmeyeceğini
belirtir. Windows Presentation Foundation (WPF) uygulamaları otomatik olarak DPI kullanan uygulamalardır ve bunun kabul edilmesi
gerekmez. Bu ayarın kabul edildiği ve .NET Framework 4.6'yı hedefleyen Windows Forms uygulamalarında da
app.config'de 'EnableWindowsFormsHighDpiAutoResizing' ayarının 'true' olarak belirlenmesi gerekir.
Uygulamayı uzun yol kullanan uygulama haline getirir. Bkz. https://docs.microsoft.com/windows/win32/fileio/maximum-file-path-limitation -->

<application xmlns="urn:schemas-microsoft-com:asm.v3">
<windowsSettings>
<!--<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">false</dpiAware>-->

<dpiAware xmlns="http://schemas.microsoft.com/SMI/2005/WindowsSettings">true/PM</dpiAware>
<dpiAwareness xmlns="http://schemas.microsoft.com/SMI/2016/WindowsSettings">PerMonitorV2, PerMonitor</dpiAwareness>
</windowsSettings>
</application>


<!-- Windows genel denetimler ve iletişim kutuları için temaları etkinleştir (Windows XP ve sonrası) -->
<!--
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
-->

</assembly>
6 changes: 6 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.net48.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8" />
</startup>
</configuration>
6 changes: 6 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.net481.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.8.1" />
</startup>
</configuration>
3 changes: 3 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.net6.0-windows.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>
3 changes: 3 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.net7.0-windows.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>
3 changes: 3 additions & 0 deletions src/Project/Sucrose.Backgroundog/App.net8.0-windows.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<configuration>
</configuration>
Binary file added src/Project/Sucrose.Backgroundog/Assets/ICO.ico
Binary file not shown.
7 changes: 7 additions & 0 deletions src/Project/Sucrose.Backgroundog/Manage/Internal.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
namespace Sucrose.Backgroundog.Manage
{
internal static class Internal
{
public static bool State = true;
}
}
9 changes: 9 additions & 0 deletions src/Project/Sucrose.Backgroundog/Manage/Manager.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using SMR = Sucrose.Memory.Readonly;

namespace Sucrose.Backgroundog.Manage
{
internal static class Manager
{
public static Mutex Mutex => new(true, SMR.BackgroundogMutex);
}
}
101 changes: 101 additions & 0 deletions src/Project/Sucrose.Backgroundog/Sucrose.Backgroundog.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFrameworks>net48;net481;net6.0-windows;net7.0-windows;net8.0-windows</TargetFrameworks>
<ApplicationIcon>Assets\ICO.ico</ApplicationIcon>
<StartupObject>Sucrose.Backgroundog.App</StartupObject>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>disable</Nullable>
<Company>Taiizor</Company>
<Title>Sucrose Wallpaper Engine</Title>
<Description>$(Title)</Description>
<Product>$(Title)</Product>
<InformationalVersion>$(Version)</InformationalVersion>
<AssemblyVersion>$(Version)</AssemblyVersion>
<FileVersion>$(Version)</FileVersion>
<Version>$([System.DateTime]::Today.ToString(yy)).$([System.DateTime]::Today.ToString(MM)).$([System.DateTime]::Today.ToString(dd))</Version>
<AssemblyName>Sucrose.Backgroundog</AssemblyName>
<RootNamespace>$(AssemblyName)</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<UseWPF>true</UseWPF>
<AnalysisLevel>preview</AnalysisLevel>
<LangVersion>preview</LangVersion>
<Platforms>AnyCPU;ARM64;x64;x86</Platforms>
<DefineConstants>$(DefineConstants);BACKGROUNDOG</DefineConstants>
<Copyright>Copyright © $([System.DateTime]::Today.ToString(yyyy)) $(Company)</Copyright>
<GeneratePackageOnBuild>false</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>false</PackageRequireLicenseAcceptance>
<AppendTargetFrameworkToOutputPath>true</AppendTargetFrameworkToOutputPath>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<ApplicationManifest>App.manifest</ApplicationManifest>
<OutputPath>..\..\Sucrose\Backgroundog\$(Platform)</OutputPath>
</PropertyGroup>

<PropertyGroup>
<ConcurrentGarbageCollection>true</ConcurrentGarbageCollection>
<ServerGarbageCollection>true</ServerGarbageCollection>
<RetainVMGarbageCollection>true</RetainVMGarbageCollection>
<ThreadPoolMinThreads>1</ThreadPoolMinThreads>
<ThreadPoolMaxThreads>100</ThreadPoolMaxThreads>
<!-- Supported as of .NET Core SDK 3.0 Preview 1 -->
<TieredCompilation>true</TieredCompilation>
<InvariantGlobalization>false</InvariantGlobalization>
</PropertyGroup>

<PropertyGroup Condition="'$(PlatformTarget)' == 'x86'">
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x86</RuntimeIdentifier>
<SelfContained Condition="'$(SelfContained)' == ''">false</SelfContained>
<DefineConstants>$(DefineConstants);X86</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(PlatformTarget)' == 'x64'">
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-x64</RuntimeIdentifier>
<SelfContained Condition="'$(SelfContained)' == ''">false</SelfContained>
<DefineConstants>$(DefineConstants);X64</DefineConstants>
</PropertyGroup>

<PropertyGroup Condition="'$(PlatformTarget)' == 'arm64'">
<RuntimeIdentifier Condition="'$(RuntimeIdentifier)' == ''">win-arm64</RuntimeIdentifier>
<SelfContained Condition="'$(SelfContained)' == ''">false</SelfContained>
<DefineConstants>$(DefineConstants);ARM64</DefineConstants>
</PropertyGroup>

<ItemGroup>
<AppConfigWithTargetPath Include="App.$(TargetFramework).config">
<TargetPath>$(AssemblyName).exe.config</TargetPath>
</AppConfigWithTargetPath>
</ItemGroup>

<ItemGroup>
<PackageReference Include="Skylark.Wing" Version="3.1.1.3" />
<PackageReference Include="LibreHardwareMonitorLib" Version="0.9.3-pre256" />
</ItemGroup>

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

<Import Project="..\..\Shared\Sucrose.Shared.Space\Sucrose.Shared.Space.projitems" Label="Shared" />
<Import Project="..\..\Shared\Sucrose.Shared.Server\Sucrose.Shared.Server.projitems" Label="Shared" />
<Import Project="..\..\Shared\Sucrose.Shared.Watchdog\Sucrose.Shared.Watchdog.projitems" Label="Shared" />
<Import Project="..\..\Shared\Sucrose.Shared.Dependency\Sucrose.Shared.Dependency.projitems" Label="Shared" />

<ItemGroup>
<Folder Include="Properties\" />
</ItemGroup>

<PropertyGroup>
<SourceDirectory>$(OutputPath)\$(TargetFramework)\win-$(Platform)</SourceDirectory>
<DestinationDirectory>..\..\Sucrose\Package\$(TargetFramework)\$(Platform)\$(AssemblyName)\</DestinationDirectory>
</PropertyGroup>

<Target Name="CopyFiles" BeforeTargets="Build">
<ItemGroup>
<FilesToCopy Include="$(SourceDirectory)\**\*.*" />
</ItemGroup>
<Copy SourceFiles="@(FilesToCopy)" DestinationFiles="@(FilesToCopy->'$(DestinationDirectory)%(RecursiveDir)%(Filename)%(Extension)')" SkipUnchangedFiles="true" />
</Target>

</Project>
7 changes: 6 additions & 1 deletion src/Project/Sucrose.Commandog/App.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using SCHA = Sucrose.Commandog.Helper.Arguments;
using System.Globalization;
using SCHA = Sucrose.Commandog.Helper.Arguments;
using SHC = Skylark.Helper.Culture;
using SMMM = Sucrose.Manager.Manage.Manager;
using SSWW = Sucrose.Shared.Watchdog.Watch;

namespace Sucrose.Commandog
Expand All @@ -9,6 +12,8 @@ internal static void Main(string[] Args)
{
try
{
SHC.All = new CultureInfo(SMMM.Culture, true);

SCHA.Parse(Args);
}
catch (Exception Exception)
Expand Down
3 changes: 3 additions & 0 deletions src/Project/Sucrose.Commandog/Helper/Arguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ public static void Parse(string[] Arguments)
SSSHP.Run(SCHP.ArgumentValue<string>(Values[0]));
}
break;
case SSDECT.Backgroundog:
SSSHP.Run(SCHP.ArgumentValue<string>(Values[0]), string.Empty);
break;
default:
break;
}
Expand Down
3 changes: 2 additions & 1 deletion src/Shared/Sucrose.Shared.Dependency/Enum/CommandsType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ internal enum CommandsType
StartupM,
StartupP,
Scheduler,
Interface
Interface,
Backgroundog
}

internal enum ArgumentCommandsType
Expand Down
5 changes: 5 additions & 0 deletions src/Shared/Sucrose.Shared.Launcher/Command/Close.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,11 @@ public static void Command()
{
SSSHP.Kill(SMR.Commandog);
}

if (SSSHP.Work(SMR.Backgroundog))
{
SSSHP.Kill(SMR.Backgroundog);
}
}

WinForms.ExitThread();
Expand Down
2 changes: 2 additions & 0 deletions src/Shared/Sucrose.Shared.Live/Helper/Run.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ public static void Start()

if (Info.AppVersion.CompareTo(SHV.Entry()) <= 0)
{
SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Backgroundog}{SMR.ValueSeparator}{SSSMI.Backgroundog}");

switch (Info.Type)
{
case SSDEWT.Web:
Expand Down
Loading

0 comments on commit afc4e2b

Please sign in to comment.