mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 12:52:08 +08:00
1.1.3 -> 1.1.4 第86次更新
This commit is contained in:
parent
13d8663a6e
commit
ec5d3893fb
@ -9,11 +9,11 @@ namespace Sheas_Cealer.Utils;
|
||||
|
||||
internal static class NginxCleaner
|
||||
{
|
||||
private static readonly SemaphoreSlim IsCleaningSemaphore = new(1);
|
||||
internal static readonly SemaphoreSlim IsNginxCleaningSemaphore = new(1);
|
||||
|
||||
internal static async Task Clean()
|
||||
{
|
||||
if (!await IsCleaningSemaphore.WaitAsync(0))
|
||||
if (!await IsNginxCleaningSemaphore.WaitAsync(0))
|
||||
return;
|
||||
|
||||
try
|
||||
@ -40,6 +40,6 @@ internal static class NginxCleaner
|
||||
|
||||
certStore.Close();
|
||||
}
|
||||
finally { IsCleaningSemaphore.Release(); }
|
||||
finally { IsNginxCleaningSemaphore.Release(); }
|
||||
}
|
||||
}
|
@ -19,6 +19,7 @@ using System.Security.Cryptography;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Text.Json;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
@ -55,6 +56,8 @@ public partial class MainWin : Window
|
||||
private int GameClickTime = 0;
|
||||
private int GameFlashInterval = 1000;
|
||||
|
||||
private static readonly SemaphoreSlim IsNginxLaunchingSemaphore = new(1);
|
||||
|
||||
internal MainWin()
|
||||
{
|
||||
InitializeComponent();
|
||||
@ -202,6 +205,11 @@ public partial class MainWin : Window
|
||||
HoldButtonTimer?.Stop();
|
||||
|
||||
if (!MainPres.IsNginxRunning)
|
||||
{
|
||||
if (NginxCleaner.IsNginxCleaningSemaphore.CurrentCount == 0 || !await IsNginxLaunchingSemaphore.WaitAsync(0))
|
||||
return;
|
||||
|
||||
try
|
||||
{
|
||||
if ((CealHostRulesDict.ContainsValue(null!) && MessageBox.Show(MainConst._CealHostErrorPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes) ||
|
||||
(NginxHttpsPort != 443 && MessageBox.Show(string.Format(MainConst._NginxHttpsPortOccupiedPrompt, NginxHttpsPort), string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes) ||
|
||||
@ -312,6 +320,8 @@ public partial class MainWin : Window
|
||||
MainPres.IsNginxIniting = false;
|
||||
}
|
||||
}
|
||||
finally { IsNginxLaunchingSemaphore.Release(); }
|
||||
}
|
||||
else
|
||||
foreach (Process nginxProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainConst.NginxPath)))
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user