From 158ee04adcf482c5180fec18eb4cdda24bf8e46a Mon Sep 17 00:00:00 2001 From: Space Time Date: Mon, 7 Oct 2024 11:48:38 +0800 Subject: [PATCH] =?UTF-8?q?1.1.1=20->=201.1.2=20=E7=AC=AC48=E6=AC=A1?= =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Sheas-Cealer.csproj | 8 ++++---- Utils/NginxProc.cs | 2 ++ Wins/MainWin.xaml.cs | 6 +++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/Sheas-Cealer.csproj b/Sheas-Cealer.csproj index 58d5587..a8a9b3f 100644 --- a/Sheas-Cealer.csproj +++ b/Sheas-Cealer.csproj @@ -8,10 +8,10 @@ Just Ceal It Space Time Space Time - 1.1.1 - 1.1.1 - 1.1.1 - 1.1.1 + 1.1.2 + 1.1.2 + 1.1.2 + 1.1.2 Tool;Sheas;Cealer;Sni Sheas-Cealer-Logo.ico Sheas Cealer Logo.png diff --git a/Utils/NginxProc.cs b/Utils/NginxProc.cs index d861651..dfa3d55 100644 --- a/Utils/NginxProc.cs +++ b/Utils/NginxProc.cs @@ -24,5 +24,7 @@ internal class NginxProc : Proc foreach (X509Certificate2 storedCert in certStore.Certificates) if (storedCert.Subject == MainConst.NginxRootCertSubjectName) certStore.Remove(storedCert); + + certStore.Close(); } } \ No newline at end of file diff --git a/Wins/MainWin.xaml.cs b/Wins/MainWin.xaml.cs index 5a2793a..ed2f8d0 100644 --- a/Wins/MainWin.xaml.cs +++ b/Wins/MainWin.xaml.cs @@ -57,7 +57,6 @@ public partial class MainWin : Window NginxConfWatcher.Changed += NginxConfWatcher_Changed; MihomoConfWatcher.Changed += MihomoConfWatcher_Changed; } - protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this); private async void MainWin_Loaded(object sender, RoutedEventArgs e) { @@ -196,7 +195,7 @@ public partial class MainWin : Window CertificateRequest rootCertRequest = new(MainConst.NginxRootCertSubjectName, certKey, HashAlgorithmName.SHA256, RSASignaturePadding.Pkcs1); rootCertRequest.CertificateExtensions.Add(new X509BasicConstraintsExtension(true, false, 0, false)); - X509Certificate2 rootCert = rootCertRequest.CreateSelfSigned(DateTimeOffset.UtcNow, DateTimeOffset.UtcNow.AddYears(100)); + using X509Certificate2 rootCert = rootCertRequest.CreateSelfSigned(DateTimeOffset.UtcNow, DateTimeOffset.UtcNow.AddYears(100)); using X509Store certStore = new(StoreName.Root, StoreLocation.CurrentUser, OpenFlags.ReadWrite); certStore.Add(rootCert); @@ -236,7 +235,7 @@ public partial class MainWin : Window } childCertRequest.CertificateExtensions.Add(childCertSanBuilder.Build()); - X509Certificate2 childCert = childCertRequest.Create(rootCert, rootCert.NotBefore, rootCert.NotAfter, Guid.NewGuid().ToByteArray()); + using X509Certificate2 childCert = childCertRequest.Create(rootCert, rootCert.NotBefore, rootCert.NotAfter, Guid.NewGuid().ToByteArray()); File.WriteAllText(MainConst.NginxCertPath, childCert.ExportCertificatePem()); File.WriteAllText(MainConst.NginxKeyPath, certKey.ExportPkcs8PrivateKeyPem()); @@ -362,6 +361,7 @@ public partial class MainWin : Window private void EditConfButton_Click(object sender, RoutedEventArgs e) { Button? senderButton = sender as Button; + string confPath = senderButton == EditHostsConfButton ? MainConst.HostsConfPath : senderButton == EditNginxConfButton ? MainConst.NginxConfPath : MainConst.MihomoConfPath;