Skip to content

Commit

Permalink
Preparing Backgroundog
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Sep 19, 2023
1 parent 4b14a5b commit b97cf92
Show file tree
Hide file tree
Showing 19 changed files with 86 additions and 45 deletions.
19 changes: 13 additions & 6 deletions src/Project/Sucrose.Backgroundog/App.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using System.Globalization;
using SBHI = Sucrose.Backgroundog.Helper.Initialize;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SBMM = Sucrose.Backgroundog.Manage.Manager;
using SGCB = Sucrose.Grpc.Common.Backgroundog;
Expand All @@ -15,9 +14,9 @@

namespace Sucrose.Backgroundog
{
internal class App
internal class App : IDisposable
{
internal static async Task Main()
public static async Task Main()
{
try
{
Expand All @@ -36,14 +35,16 @@ internal static async Task Main()

SGSGSS.ServerInstance.Start();

SBHI.Start();
SBMI.Initialize.Start();

do
{
SBMI.Initialize.Dispose();

await Task.Delay(1000);
} while (SBMI.Exit);

SBHI.Stop();
SBMI.Initialize.Stop();

SGSGSS.ServerInstance.KillAsync().Wait();
//SGSGSS.ServerInstance.ShutdownAsync().Wait();
Expand All @@ -61,10 +62,16 @@ internal static async Task Main()
}
}

protected static void Close()
public static void Close()
{
Environment.Exit(0);
Application.Exit();
}

public void Dispose()
{
GC.Collect();
GC.SuppressFinalize(this);
}
}
}
7 changes: 3 additions & 4 deletions src/Project/Sucrose.Backgroundog/Helper/Attempt.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
using SBHI = Sucrose.Backgroundog.Helper.Initialize;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SSSHL = Sucrose.Shared.Space.Helper.Live;

namespace Sucrose.Backgroundog.Helper
Expand Down Expand Up @@ -28,9 +27,9 @@ public static async Task Start()

if (!Success)
{
Console.WriteLine("İşlem başarısız oldu ve 5 deneme sonunda hala true dönmedi.");
SBMI.Exit = false;
SBHI.Stop();
SBMI.Initialize.Stop();
Console.WriteLine("İşlem başarısız oldu ve 5 deneme sonunda hala true dönmedi.");
}
}
}
Expand Down
14 changes: 10 additions & 4 deletions src/Project/Sucrose.Backgroundog/Helper/Initialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,22 +7,22 @@

namespace Sucrose.Backgroundog.Helper
{
internal static class Initialize
internal class Initialize : IDisposable
{
public static void Start()
public void Start()
{
SBMI.Computer.Open();
TimerCallback Callback = InitializeTimer_Callback;
SBMI.InitializeTimer = new(Callback, null, 0, 250);
}

public static void Stop()
public void Stop()
{
SBMI.Computer.Close();
SBMI.InitializeTimer.Dispose();
}

private static async void InitializeTimer_Callback(object State)
private async void InitializeTimer_Callback(object State)
{
_ = SBHS.Start();

Expand All @@ -47,5 +47,11 @@ private static async void InitializeTimer_Callback(object State)
SBMI.Processing = true;
}
}

public void Dispose()
{
GC.Collect();
GC.SuppressFinalize(this);
}
}
}
3 changes: 3 additions & 0 deletions src/Project/Sucrose.Backgroundog/Manage/Internal.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using LibreHardwareMonitor.Hardware;
using System.Diagnostics;
using SBHI = Sucrose.Backgroundog.Helper.Initialize;
using SBSDBS = Sucrose.Backgroundog.Struct.Data.BatteryStruct;
using SBSDCS = Sucrose.Backgroundog.Struct.Data.CpuStruct;
using SBSDMDS = Sucrose.Backgroundog.Struct.Data.MotherboardStruct;
Expand All @@ -17,6 +18,8 @@ internal static class Internal

public static bool Processing = true;

public static SBHI Initialize = new();

public static bool CpuManagement = true;

public static Timer InitializeTimer = null;
Expand Down
12 changes: 9 additions & 3 deletions src/Project/Sucrose.Commandog/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@

namespace Sucrose.Commandog
{
internal class App
internal class App : IDisposable
{
internal static void Main(string[] Args)
public static void Main(string[] Args)
{
try
{
Expand All @@ -26,10 +26,16 @@ internal static void Main(string[] Args)
}
}

protected static void Close()
public static void Close()
{
Environment.Exit(0);
Application.Exit();
}

public void Dispose()
{
GC.Collect();
GC.SuppressFinalize(this);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using SSEAMI = Sucrose.Shared.Engine.Aurora.Manage.Internal;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SWHPI = Skylark.Wing.Helper.ProcessInterop;
Expand Down Expand Up @@ -60,6 +61,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSEAHA.SetVolume(SSEHD.GetVolume());

if (!SSSHP.Work(SSEAMI.Application))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

namespace Sucrose.Shared.Engine.CefSharp.View
Expand Down Expand Up @@ -45,6 +46,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSECSHU.SetVolume(SSEHD.GetVolume());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

Expand Down Expand Up @@ -47,6 +48,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSECSHV.SetLoop(SSEHD.GetLoop());

SSECSHV.SetVolume(SSEHD.GetVolume());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using SSECSHCCM = Sucrose.Shared.Engine.CefSharp.Handler.CustomContextMenu;
using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

namespace Sucrose.Shared.Engine.CefSharp.View
Expand Down Expand Up @@ -41,6 +42,8 @@ public Web(string Web)
private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using SSECSMI = Sucrose.Shared.Engine.CefSharp.Manage.Internal;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;

namespace Sucrose.Shared.Engine.CefSharp.View
Expand Down Expand Up @@ -46,6 +47,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSECSHYT.First();

SSECSHYT.SetLoop(SSEHD.GetLoop());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Windows.Media;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEMPHV = Sucrose.Shared.Engine.MpvPlayer.Helper.Video;
Expand Down Expand Up @@ -43,6 +44,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSEMPHV.SetLoop(SSEHD.GetLoop());

SSEMPHV.SetVolume(SSEHD.GetVolume());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Windows.Media;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSENEV = Sucrose.Shared.Engine.Nebula.Event.Video;
Expand Down Expand Up @@ -43,6 +44,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSENHV.SetLoop(SSEHD.GetLoop());

SSENHV.SetVolume(SSEHD.GetVolume());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Windows.Media;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEHS = Sucrose.Shared.Engine.Helper.Source;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEVEG = Sucrose.Shared.Engine.Vexana.Event.Gif;
Expand Down Expand Up @@ -41,6 +42,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSEVHG.SetLoop(SSEHD.GetLoop());

SSEVMI.ImageEngine.Stretch = (Stretch)SSEHD.GetStretch();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEWVEU = Sucrose.Shared.Engine.WebView.Event.Url;
using SSEWVHU = Sucrose.Shared.Engine.WebView.Helper.Url;
Expand Down Expand Up @@ -37,6 +38,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSEWVHU.SetVolume(SSEHD.GetVolume());
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEWVEV = Sucrose.Shared.Engine.WebView.Event.Video;
using SSEWVHV = Sucrose.Shared.Engine.WebView.Helper.Video;
Expand Down Expand Up @@ -39,6 +40,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSEWVHV.SetLoop(SSEHD.GetLoop());

SSEWVHV.SetVolume(SSEHD.GetVolume());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEWVEW = Sucrose.Shared.Engine.WebView.Event.Web;
using SSEWVMI = Sucrose.Shared.Engine.WebView.Manage.Internal;
Expand Down Expand Up @@ -34,6 +35,8 @@ public Web(string Web)
private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();
}

public void Dispose()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System.Windows;
using SSEEH = Sucrose.Shared.Engine.Event.Handler;
using SSEHD = Sucrose.Shared.Engine.Helper.Data;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEWVEYT = Sucrose.Shared.Engine.WebView.Event.YouTube;
using SSEWVHYT = Sucrose.Shared.Engine.WebView.Helper.YouTube;
Expand Down Expand Up @@ -39,6 +40,8 @@ private void GeneralTimer_Tick(object sender, EventArgs e)
{
Dispose();

SSEHR.Control();

SSEWVHYT.First();

SSEWVHYT.SetLoop(SSEHD.GetLoop());
Expand Down
13 changes: 12 additions & 1 deletion src/Shared/Engine/Sucrose.Shared.Engine/Helper/Run.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using SSDEET = Sucrose.Shared.Dependency.Enum.EngineType;
using SMMM = Sucrose.Manager.Manage.Manager;
using SMR = Sucrose.Memory.Readonly;
using SSDECT = Sucrose.Shared.Dependency.Enum.CommandsType;
using SSDEET = Sucrose.Shared.Dependency.Enum.EngineType;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSMI = Sucrose.Shared.Space.Manage.Internal;

Expand All @@ -20,5 +23,13 @@ public static bool Check()

return Result <= 1;
}

public static void Control()
{
if (!SSSHP.Work(SMR.Backgroundog) && SMMM.PerformanceCounter)
{
SSSHP.Run(SSSMI.Commandog, $"{SMR.StartCommand}{SSDECT.Backgroundog}{SMR.ValueSeparator}{SSSMI.Backgroundog}");
}
}
}
}
Loading

0 comments on commit b97cf92

Please sign in to comment.