Skip to content

Commit

Permalink
Major Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 6, 2023
1 parent 82b1c32 commit 302050a
Show file tree
Hide file tree
Showing 35 changed files with 234 additions and 108 deletions.
11 changes: 2 additions & 9 deletions src/Launcher/Sucrose.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,12 +15,11 @@
using SSLMI = Sucrose.Shared.Launcher.Manage.Internal;
using SSLMM = Sucrose.Shared.Launcher.Manage.Manager;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSSLSS = Sucrose.Shared.Server.Services.LauncherServerService;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Launcher
{
Expand Down Expand Up @@ -177,14 +176,8 @@ protected override void OnStartup(StartupEventArgs e)

SMMI.LauncherLogManager.Log(SELLT.Info, "Application initializing..");

if (!SWUSI.IsAppMutexRunning(SMR.LauncherMutex) && SSSHP.WorkCount(SMR.Launcher) <= 1)
if (SSSHI.Basic(SMR.LauncherMutex, SMR.Launcher))
{
SMMI.LauncherLogManager.Log(SELLT.Info, "Application mutex is being releasing.");

SSLMI.Mutex.ReleaseMutex();

SMMI.LauncherLogManager.Log(SELLT.Info, "Application mutex is being released.");

Configure();

SMMI.LauncherLogManager.Log(SELLT.Info, "Application initialized..");
Expand Down
6 changes: 6 additions & 0 deletions src/Library/Sucrose.Manager/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ public static class Manager

public static string LibraryLocation => SMMI.LibrarySettingManager.GetSetting(SMC.LibraryLocation, Path.Combine(SMR.DocumentsPath, SMR.AppName));

public static int UpdateLimitValue => SHS.Clamp(SMMI.UpdateSettingManager.GetSettingStable(SMC.UpdateLimitValue, 100), 0, 99999999);

public static int DownloadValue => SHS.Clamp(SMMI.BackgroundogSettingManager.GetSettingStable(SMC.DownloadValue, 10), 0, 99999999);

public static int BackgroundOpacity => SHS.Clamp(SMMI.PortalSettingManager.GetSettingStable(SMC.BackgroundOpacity, 100), 0, 100);
Expand Down Expand Up @@ -67,6 +69,8 @@ public static class Manager

public static string BackgroundImage => SMMI.PortalSettingManager.GetSetting(SMC.BackgroundImage, string.Empty);

public static SEST UpdateLimitType => SMMI.UpdateSettingManager.GetSetting(SMC.UpdateLimitType, SEST.Megabyte);

public static SEST DownloadType => SMMI.BackgroundogSettingManager.GetSetting(SMC.DownloadType, SEST.Megabyte);

public static bool PausePerformance => SMMI.BackgroundogSettingManager.GetSetting(SMC.PausePerformance, false);
Expand All @@ -79,6 +83,8 @@ public static class Manager

public static int Volume => SHS.Clamp(SMMI.EngineSettingManager.GetSettingStable(SMC.Volume, 100), 0, 100);

public static string UpdatePercentage => SMMI.UpdateSettingManager.GetSetting(SMC.UpdatePercentage, "0%");

public static string UserAgent => SMMI.GeneralSettingManager.GetSetting(SMC.UserAgent, SMR.UserAgent);

public static bool LibraryConfirm => SMMI.LibrarySettingManager.GetSetting(SMC.LibraryConfirm, true);
Expand Down
6 changes: 6 additions & 0 deletions src/Library/Sucrose.Memory/Constant.cs
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,12 @@ public static class Constant

public const string BackgroundImage = "BackgroundImage";

public const string UpdateLimitType = "UpdateLimitType";

public const string UpdatePercentage = "UpdatePercentage";

public const string UpdateLimitValue = "UpdateLimitValue";

public const string ClosePerformance = "ClosePerformance";

public const string PausePerformance = "PausePerformance";
Expand Down
7 changes: 2 additions & 5 deletions src/Live/Sucrose.Live.Aurora/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,15 @@
using SSDEWT = Sucrose.Shared.Dependency.Enum.WallpaperType;
using SSEAVA = Sucrose.Shared.Engine.Aurora.View.Application;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEMM = Sucrose.Shared.Engine.Manage.Manager;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSHS = Sucrose.Shared.Space.Helper.Security;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
using SSTHV = Sucrose.Shared.Theme.Helper.Various;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Live.Aurora
{
Expand Down Expand Up @@ -191,10 +190,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSEHR.Check())
if (SSSHI.Basic(SMR.LiveMutex, SMR.AuroraLive) && SSEHR.Check())
{
SSEMI.Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
6 changes: 2 additions & 4 deletions src/Live/Sucrose.Live.CefSharp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using SSEMM = Sucrose.Shared.Engine.Manage.Manager;
using SSLHK = Sucrose.Shared.Live.Helper.Kill;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSHS = Sucrose.Shared.Space.Helper.Security;
using SSTHC = Sucrose.Shared.Theme.Helper.Compatible;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
Expand All @@ -28,7 +29,6 @@
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Live.CefSharp
{
Expand Down Expand Up @@ -257,10 +257,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSEHR.Check())
if (SSSHI.Basic(SMR.LiveMutex, SMR.CefSharpLive) && SSEHR.Check())
{
SSEMI.Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
7 changes: 2 additions & 5 deletions src/Live/Sucrose.Live.MpvPlayer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,16 @@
using SMR = Sucrose.Memory.Readonly;
using SSDEWT = Sucrose.Shared.Dependency.Enum.WallpaperType;
using SSEHR = Sucrose.Shared.Engine.Helper.Run;
using SSEMI = Sucrose.Shared.Engine.Manage.Internal;
using SSEMM = Sucrose.Shared.Engine.Manage.Manager;
using SSEMPVV = Sucrose.Shared.Engine.MpvPlayer.View.Video;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSHS = Sucrose.Shared.Space.Helper.Security;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
using SSTHV = Sucrose.Shared.Theme.Helper.Various;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Live.MpvPlayer
{
Expand Down Expand Up @@ -187,10 +186,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSEHR.Check())
if (SSSHI.Basic(SMR.LiveMutex, SMR.MpvPlayerLive) && SSEHR.Check())
{
SSEMI.Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
6 changes: 2 additions & 4 deletions src/Live/Sucrose.Live.Nebula/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
using SSEMM = Sucrose.Shared.Engine.Manage.Manager;
using SSENVV = Sucrose.Shared.Engine.Nebula.View.Video;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSHS = Sucrose.Shared.Space.Helper.Security;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
using SSTHV = Sucrose.Shared.Theme.Helper.Various;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Live.Nebula
{
Expand Down Expand Up @@ -187,10 +187,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSEHR.Check())
if (SSSHI.Basic(SMR.LiveMutex, SMR.NebulaLive) && SSEHR.Check())
{
SSEMI.Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
6 changes: 2 additions & 4 deletions src/Live/Sucrose.Live.Vexana/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@
using SSEMM = Sucrose.Shared.Engine.Manage.Manager;
using SSEVVG = Sucrose.Shared.Engine.Vexana.View.Gif;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSHS = Sucrose.Shared.Space.Helper.Security;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
using SSTHV = Sucrose.Shared.Theme.Helper.Various;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Live.Vexana
{
Expand Down Expand Up @@ -187,10 +187,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSEHR.Check())
if (SSSHI.Basic(SMR.LiveMutex, SMR.VexanaLive) && SSEHR.Check())
{
SSEMI.Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
5 changes: 2 additions & 3 deletions src/Live/Sucrose.Live.WebView/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
using SSEWVVYT = Sucrose.Shared.Engine.WebView.View.YouTube;
using SSLHK = Sucrose.Shared.Live.Helper.Kill;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSHS = Sucrose.Shared.Space.Helper.Security;
using SSTHC = Sucrose.Shared.Theme.Helper.Compatible;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
Expand All @@ -28,7 +29,6 @@
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Live.WebView
{
Expand Down Expand Up @@ -244,9 +244,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSEHR.Check())
if (SSSHI.Basic(SMR.LiveMutex, SMR.WebViewLive) && SSEHR.Check())
{
SSEMI.Mutex.ReleaseMutex();
Configure();
}
else
Expand Down
8 changes: 2 additions & 6 deletions src/Portal/Sucrose.Portal/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
using SMMM = Sucrose.Manager.Manage.Manager;
using SMR = Sucrose.Memory.Readonly;
using SPMAC = Sucrose.Portal.Models.AppConfig;
using SPMI = Sucrose.Portal.Manage.Internal;
using SPMM = Sucrose.Portal.Manage.Manager;
using SPSAHS = Sucrose.Portal.Services.ApplicationHostService;
using SPSCIW = Sucrose.Portal.Services.Contracts.IWindow;
Expand All @@ -37,11 +36,10 @@
using SPVPSWSP = Sucrose.Portal.Views.Pages.Setting.WallpaperSettingPage;
using SPVWMW = Sucrose.Portal.Views.Windows.MainWindow;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Portal
{
Expand Down Expand Up @@ -249,10 +247,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnLastWindowClose;

if (!SWUSI.IsAppMutexRunning(SMR.PortalMutex) && SSSHP.WorkCount(SMR.Portal) <= 1)
if (SSSHI.Basic(SMR.PortalMutex, SMR.Portal))
{
SPMI.Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
3 changes: 0 additions & 3 deletions src/Portal/Sucrose.Portal/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using System.Windows.Media.Imaging;
using Wpf.Ui;
using Wpf.Ui.Controls;
using SMR = Sucrose.Memory.Readonly;
using SPSBS = Sucrose.Portal.Services.BackdropService;
using SPSCES = Sucrose.Portal.Services.CultureService;
using SPSCYS = Sucrose.Portal.Services.CategoryService;
Expand Down Expand Up @@ -31,8 +30,6 @@ internal static class Internal

public static INavigationService NavigationService;

public static Mutex Mutex = new(true, SMR.PortalMutex);

public static IContentDialogService ContentDialogService;

public static Dictionary<string, bool> StoreDownloader = new();
Expand Down
7 changes: 2 additions & 5 deletions src/Project/Sucrose.Backgroundog/App.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,9 @@
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 SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSSBSS = Sucrose.Shared.Server.Services.BackgroundogServerService;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.Backgroundog
{
Expand All @@ -24,10 +23,8 @@ public static async Task Main()
Console.OutputEncoding = Encoding.UTF8;
SHC.All = new CultureInfo(SMMM.Culture, true);

if (!SWUSI.IsAppMutexRunning(SMR.BackgroundogMutex) && SSSHP.WorkCount(SMR.Backgroundog) <= 1)
if (SSSHI.Basic(SMR.BackgroundogMutex, SMR.Backgroundog))
{
SBMI.Mutex.ReleaseMutex();

Console.WriteLine("Start");

SGSGSS.ServerCreate(SGCB.BindService(new SSSSBSS()));
Expand Down
3 changes: 0 additions & 3 deletions src/Project/Sucrose.Backgroundog/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using SBSDMDS = Sucrose.Backgroundog.Struct.Data.MotherboardStruct;
using SBSDMYS = Sucrose.Backgroundog.Struct.Data.MemoryStruct;
using SBSDNS = Sucrose.Backgroundog.Struct.Data.NetworkStruct;
using SMR = Sucrose.Memory.Readonly;
using SSDECPT = Sucrose.Shared.Dependency.Enum.CategoryPerformanceType;
using SSDENPT = Sucrose.Shared.Dependency.Enum.NetworkPerformanceType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;
Expand Down Expand Up @@ -75,8 +74,6 @@ internal static class Internal

public static NowPlayingSessionManager SessionManager = null;

public static Mutex Mutex = new(true, SMR.BackgroundogMutex);

public static SBSDCS CpuData = new()
{
Min = 0f,
Expand Down
13 changes: 4 additions & 9 deletions src/Project/Sucrose.WPF.CS/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,12 @@
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
using SSSHP = Sucrose.Shared.Space.Helper.Processor;
using SSSHI = Sucrose.Shared.Space.Helper.Instance;
using SSSSWSS = Sucrose.Shared.Server.Services.WebsiterServerService;
using SSWDEMB = Sucrose.Shared.Watchdog.DarkErrorMessageBox;
using SSWLEMB = Sucrose.Shared.Watchdog.LightErrorMessageBox;
using SSWW = Sucrose.Shared.Watchdog.Watch;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;
using SWUSI = Skylark.Wing.Utility.SingleInstance;

namespace Sucrose.WPF.CS
{
Expand All @@ -30,9 +29,7 @@ public partial class App : Application
{
private static string Culture => SMMI.GeneralSettingManager.GetSetting(SMC.CultureName, SHC.CurrentUITwoLetterISOLanguageName);

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

private static Mutex Mutex = new(true, SMR.LiveMutex);
private static SEWTT ThemeType => SMMI.GeneralSettingManager.GetSetting(SMC.ThemeType, SWHWT.GetTheme());

private static bool HasError { get; set; } = true;

Expand Down Expand Up @@ -134,7 +131,7 @@ protected void Message(string Message)

string Path = SMMI.CefSharpLiveLogManager.LogFile();

switch (Theme)
switch (ThemeType)
{
case SEWTT.Dark:
SSWDEMB DarkMessageBox = new(Message, Path);
Expand Down Expand Up @@ -184,10 +181,8 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (!SWUSI.IsAppMutexRunning(SMR.LiveMutex) && SSSHP.WorkCount("Sucrose.WPF.CS.exe") <= 1)
if (SSSHI.Basic(SMR.LiveMutex, "Sucrose.WPF.CS.exe"))
{
Mutex.ReleaseMutex();

Configure();
}
else
Expand Down
3 changes: 0 additions & 3 deletions src/Shared/Engine/Sucrose.Shared.Engine/Manage/Internal.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System.Windows.Threading;
using SGCBBC = Sucrose.Grpc.Common.Backgroundog.BackgroundogClient;
using SMR = Sucrose.Memory.Readonly;
using SSESB = Sucrose.Shared.Engine.Setting.Browser;
using SSTHC = Sucrose.Shared.Theme.Helper.Compatible;
using SSTHP = Sucrose.Shared.Theme.Helper.Properties;
Expand Down Expand Up @@ -37,8 +36,6 @@ internal static class Internal

public static string MotherboardData = string.Empty;

public static Mutex Mutex = new(true, SMR.LiveMutex);

public delegate Task<string> ExecuteTask(string script);

public static readonly DispatcherTimer GeneralTimer = new();
Expand Down
Loading

0 comments on commit 302050a

Please sign in to comment.