Skip to content

Commit

Permalink
Major Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Taiizor committed Oct 5, 2023
1 parent 6b8ff98 commit 10366b9
Show file tree
Hide file tree
Showing 23 changed files with 58 additions and 38 deletions.
4 changes: 2 additions & 2 deletions src/Launcher/Sucrose.Launcher/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ protected override void OnStartup(StartupEventArgs e)

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

if (SSLMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Launcher) <= 1)
if (SSLMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Launcher) <= 1)
{
SMMI.LauncherLogManager.Log(SELLT.Info, "Application mutex is being releasing.");

SSLMM.Mutex.ReleaseMutex();
SSLMI.Mutex.ReleaseMutex();

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

Expand Down
5 changes: 3 additions & 2 deletions src/Live/Sucrose.Live.Aurora/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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 SSSHS = Sucrose.Shared.Space.Helper.Security;
Expand Down Expand Up @@ -189,9 +190,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SSEMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
if (SSEMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
{
SSEMM.Mutex.ReleaseMutex();
SSEMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Live/Sucrose.Live.CefSharp/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SSEMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
if (SSEMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
{
SSEMM.Mutex.ReleaseMutex();
SSEMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
5 changes: 3 additions & 2 deletions src/Live/Sucrose.Live.MpvPlayer/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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;
Expand Down Expand Up @@ -185,9 +186,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SSEMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
if (SSEMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
{
SSEMM.Mutex.ReleaseMutex();
SSEMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
5 changes: 3 additions & 2 deletions src/Live/Sucrose.Live.Nebula/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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 SSENVV = Sucrose.Shared.Engine.Nebula.View.Video;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
Expand Down Expand Up @@ -185,9 +186,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SSEMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
if (SSEMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
{
SSEMM.Mutex.ReleaseMutex();
SSEMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
5 changes: 3 additions & 2 deletions src/Live/Sucrose.Live.Vexana/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
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 SSEVVG = Sucrose.Shared.Engine.Vexana.View.Gif;
using SSRHR = Sucrose.Shared.Resources.Helper.Resources;
Expand Down Expand Up @@ -185,9 +186,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SSEMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
if (SSEMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
{
SSEMM.Mutex.ReleaseMutex();
SSEMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
4 changes: 2 additions & 2 deletions src/Live/Sucrose.Live.WebView/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -243,9 +243,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SSEMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
if (SSEMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSEHR.Check())
{
SSEMM.Mutex.ReleaseMutex();
SSEMI.Mutex.ReleaseMutex();
Configure();
}
else
Expand Down
5 changes: 3 additions & 2 deletions src/Portal/Sucrose.Portal/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
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 Down Expand Up @@ -247,9 +248,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnLastWindowClose;

if (SPMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Portal) <= 1)
if (SPMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Portal) <= 1)
{
SPMM.Mutex.ReleaseMutex();
SPMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
3 changes: 3 additions & 0 deletions src/Portal/Sucrose.Portal/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
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 @@ -30,6 +31,8 @@ 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
3 changes: 0 additions & 3 deletions src/Portal/Sucrose.Portal/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using SHS = Skylark.Helper.Skymath;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSCEUT = Sucrose.Shared.Core.Enum.UpdateType;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;
Expand Down Expand Up @@ -62,7 +61,5 @@ internal static class Manager
public static WindowBackdropType DefaultBackdropType => WindowBackdropType.None;

public static Stretch DefaultBackgroundStretch => Stretch.UniformToFill;

public static Mutex Mutex => new(true, SMR.PortalMutex);
}
}
15 changes: 15 additions & 0 deletions src/Portal/Sucrose.Portal/Views/Controls/ThemeDelete.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,11 @@
using SEST = Skylark.Enum.StorageType;
using SHC = Skylark.Helper.Culture;
using SHN = Skylark.Helper.Numeric;
using SMMM = Sucrose.Manager.Manage.Manager;
using SPEIL = Sucrose.Portal.Extension.ImageLoader;
using SPMI = Sucrose.Portal.Manage.Internal;
using SSESSE = Skylark.Standard.Extension.Storage.StorageExtension;
using SSSHL = Sucrose.Shared.Space.Helper.Live;
using SSSHS = Sucrose.Shared.Space.Helper.Size;
using SSSSS = Skylark.Struct.Storage.StorageStruct;
using SSTHI = Sucrose.Shared.Theme.Helper.Info;
Expand Down Expand Up @@ -61,6 +63,19 @@ private void ContentDialog_Loaded(object sender, RoutedEventArgs e)
}
}

protected override void OnButtonClick(ContentDialogButton Button)
{
if (Button == ContentDialogButton.Primary)
{
if (SMMM.LibrarySelected == Path.GetFileName(Theme) && SSSHL.Run())
{
return;
}
}

base.OnButtonClick(Button);
}

public void Dispose()
{
GC.Collect();
Expand Down
5 changes: 2 additions & 3 deletions src/Project/Sucrose.Backgroundog/App.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
using System.Globalization;
using System.Text;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SBMM = Sucrose.Backgroundog.Manage.Manager;
using SGCB = Sucrose.Grpc.Common.Backgroundog;
using SGSGSS = Sucrose.Grpc.Services.GeneralServerService;
using SHC = Skylark.Helper.Culture;
Expand All @@ -24,9 +23,9 @@ public static async Task Main()
Console.OutputEncoding = Encoding.UTF8;
SHC.All = new CultureInfo(SMMM.Culture, true);

if (SBMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Backgroundog) <= 1)
if (SBMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Backgroundog) <= 1)
{
SBMM.Mutex.ReleaseMutex();
SBMI.Mutex.ReleaseMutex();

Console.WriteLine("Start");

Expand Down
2 changes: 1 addition & 1 deletion src/Project/Sucrose.Backgroundog/Helper/Initialize.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using SBHP = Sucrose.Backgroundog.Helper.Performance;
using SBHS = Sucrose.Backgroundog.Helper.Specification;
using SBMI = Sucrose.Backgroundog.Manage.Internal;
using SSSHL = Sucrose.Shared.Space.Helper.Live;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SSSHL = Sucrose.Shared.Space.Helper.Live;

namespace Sucrose.Backgroundog.Helper
{
Expand Down
3 changes: 3 additions & 0 deletions src/Project/Sucrose.Backgroundog/Manage/Internal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
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 @@ -74,6 +75,8 @@ 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
3 changes: 0 additions & 3 deletions src/Project/Sucrose.Backgroundog/Manage/Manager.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSDEPT = Sucrose.Shared.Dependency.Enum.PerformanceType;

namespace Sucrose.Backgroundog.Manage
Expand All @@ -26,7 +25,5 @@ internal static class Manager
public static SSDEPT CpuPerformance => SMMI.BackgroundogSettingManager.GetSetting(SMC.CpuPerformance, SSDEPT.Pause);

public static bool Windows11_OrGreater => Environment.OSVersion.Version.Build >= 22000;

public static Mutex Mutex => new(true, SMR.BackgroundogMutex);
}
}
2 changes: 1 addition & 1 deletion src/Project/Sucrose.WPF.CS/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ public partial class App : Application

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

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

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

Expand Down
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
@@ -1,5 +1,6 @@
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 @@ -36,6 +37,8 @@ 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
3 changes: 0 additions & 3 deletions src/Shared/Engine/Sucrose.Shared.Engine/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using SHS = Skylark.Helper.Skymath;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSDEDT = Sucrose.Shared.Dependency.Enum.DisplayType;
using SSDEST = Sucrose.Shared.Dependency.Enum.StretchType;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;
Expand All @@ -32,7 +31,5 @@ internal static class Manager
public static SSDEST StretchType => SMMI.EngineSettingManager.GetSetting(SMC.StretchType, SSDEST.Fill);

public static SSDEST DefaultStretchType => SSDEST.None;

public static Mutex Mutex => new(true, SMR.LiveMutex);
}
}
5 changes: 4 additions & 1 deletion src/Shared/Sucrose.Shared.Launcher/Manage/Internal.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using SSLMTIM = Sucrose.Shared.Launcher.Manager.TrayIconManager;
using SMR = Sucrose.Memory.Readonly;
using SSLMTIM = Sucrose.Shared.Launcher.Manager.TrayIconManager;

namespace Sucrose.Shared.Launcher.Manage
{
Expand All @@ -7,5 +8,7 @@ internal static class Internal
public static bool ReportBox = true;

public static SSLMTIM TrayIconManager = new();

public static Mutex Mutex = new(true, SMR.LauncherMutex);
}
}
3 changes: 0 additions & 3 deletions src/Shared/Sucrose.Shared.Launcher/Manage/Manager.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,12 @@
using SEWTT = Skylark.Enum.WindowsThemeType;
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SWHWT = Skylark.Wing.Helper.WindowsTheme;

namespace Sucrose.Shared.Launcher.Manage
{
internal static class Manager
{
public static SEWTT ThemeType => SMMI.GeneralSettingManager.GetSetting(SMC.ThemeType, SWHWT.GetTheme());

public static Mutex Mutex => new(true, SMR.LauncherMutex);
}
}
4 changes: 2 additions & 2 deletions src/Update/Sucrose.Update/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -345,9 +345,9 @@ protected override void OnStartup(StartupEventArgs e)

ShutdownMode = ShutdownMode.OnExplicitShutdown;

if (SUMM.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Update) <= 1)
if (SUMI.Mutex.WaitOne(TimeSpan.Zero, true) && SSSHP.WorkCount(SMR.Update) <= 1)
{
SUMM.Mutex.ReleaseMutex();
SUMI.Mutex.ReleaseMutex();

Configure();
}
Expand Down
3 changes: 3 additions & 0 deletions src/Update/Sucrose.Update/Manage/Internal.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using SMC = Sucrose.Memory.Constant;
using SMMI = Sucrose.Manager.Manage.Internal;
using SMR = Sucrose.Memory.Readonly;
using SSCEUT = Sucrose.Shared.Core.Enum.UpdateType;

namespace Sucrose.Update.Manage
Expand All @@ -8,6 +9,8 @@ internal static class Internal
{
public static string Source = string.Empty;

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

public static readonly SSCEUT UpdateType = SMMI.UpdateSettingManager.GetSetting(SMC.UpdateType, SSCEUT.Compressed);
}
}
2 changes: 0 additions & 2 deletions src/Update/Sucrose.Update/Manage/Manager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,5 @@ internal static class Manager
public static string CachePath => Path.Combine(SMR.AppDataPath, SMR.AppName, SMR.CacheFolder, SMR.Bundle);

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

public static Mutex Mutex => new(true, SMR.UpdateMutex);
}
}

0 comments on commit 10366b9

Please sign in to comment.