mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-14 05:12:09 +08:00
1.1.3 -> 1.1.4 第42次更新
This commit is contained in:
parent
4009e8ce63
commit
42bd83f4d3
@ -1,20 +1,21 @@
|
||||
using System.IO;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Threading;
|
||||
using Sheas_Cealer.Consts;
|
||||
|
||||
namespace Sheas_Cealer.Utils
|
||||
{
|
||||
internal static class NginxStoppedCleaner
|
||||
{
|
||||
private static bool IsCleaning = false;
|
||||
private static readonly object IsCleaningLock = new();
|
||||
|
||||
internal static void Clean()
|
||||
{
|
||||
if (IsCleaning)
|
||||
if (!Monitor.TryEnter(IsCleaningLock))
|
||||
return;
|
||||
|
||||
IsCleaning = true;
|
||||
|
||||
try
|
||||
{
|
||||
string hostsContent = File.ReadAllText(MainConst.HostsConfPath);
|
||||
int hostsConfStartIndex = hostsContent.IndexOf(MainConst.HostsConfStartMarker);
|
||||
int hostsConfEndIndex = hostsContent.LastIndexOf(MainConst.HostsConfEndMarker);
|
||||
@ -35,8 +36,8 @@ namespace Sheas_Cealer.Utils
|
||||
catch { }
|
||||
|
||||
certStore.Close();
|
||||
|
||||
IsCleaning = false;
|
||||
}
|
||||
finally { Monitor.Exit(IsCleaningLock); }
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user