1.1.2 -> 1.1.3 第16次更新

This commit is contained in:
Space Time 2024-10-21 00:27:12 +08:00
parent 37bcd63b9e
commit 0c76f6ed59
3 changed files with 5 additions and 13 deletions

View File

@ -21,8 +21,6 @@ internal partial class MainConst : MainMultilangConst
internal static string EdgeBrowserRegistryPath => @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe";
internal static string ChromeBrowserRegistryPath => @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe";
internal static string BraveBrowserRegistryPath => @"SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\brave.exe";
internal static string UncealedBrowserPath => Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Uncealed-Browser.lnk");
internal static string UncealedBrowserDescription => "Created By Sheas Cealer";
internal static string HostsConfPath => Path.Combine(Registry.LocalMachine.OpenSubKey(@"\SYSTEM\CurrentControlSet\Services\Tcpip\Parameters\DataBasePath")?.GetValue("DataBasePath", null)?.ToString() ?? @"C:\Windows\System32\drivers\etc", "hosts");
internal static string HostsConfStartMarker => "# Cealing Nginx Start\n";

View File

@ -4,11 +4,11 @@ using SheasCore;
namespace Sheas_Cealer.Utils;
internal class CommandProc : Proc
internal class BrowserProc : Proc
{
private static bool ShutDownAppOnProcessExit;
internal CommandProc(bool shutDownAppOnProcessExit) : base("Cmd.exe") => ShutDownAppOnProcessExit = shutDownAppOnProcessExit;
internal BrowserProc(string browserPath, bool shutDownAppOnProcessExit) : base(browserPath) => ShutDownAppOnProcessExit = shutDownAppOnProcessExit;
public override void Process_Exited(object sender, EventArgs e)
{

View File

@ -14,7 +14,6 @@ using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Threading;
using IWshRuntimeLibrary;
using MaterialDesignThemes.Wpf;
using Microsoft.Win32;
using NginxConfigParser;
@ -151,12 +150,7 @@ public partial class MainWin : Window
if (MessageBox.Show(MainConst._KillBrowserProcessPrompt, string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;
IWshShortcut uncealedBrowserShortcut = (IWshShortcut)new WshShell().CreateShortcut(MainConst.UncealedBrowserPath);
uncealedBrowserShortcut.TargetPath = MainPres!.BrowserPath;
uncealedBrowserShortcut.Description = MainConst.UncealedBrowserDescription;
uncealedBrowserShortcut.Save();
foreach (Process browserProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainPres.BrowserPath)))
foreach (Process browserProcess in Process.GetProcessesByName(Path.GetFileNameWithoutExtension(MainPres!.BrowserPath)))
{
browserProcess.Kill();
await browserProcess.WaitForExitAsync();
@ -164,7 +158,7 @@ public partial class MainWin : Window
await Task.Run(() =>
{
new CommandProc(sender == null).ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, ($"{CealArgs} {MainPres!.ExtraArgs}").Trim());
new BrowserProc(MainPres.BrowserPath, sender == null).ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, ($"{CealArgs} {MainPres.ExtraArgs}").Trim());
});
}
private void NginxButton_Click(object sender, RoutedEventArgs e)
@ -543,7 +537,7 @@ public partial class MainWin : Window
hostResolverRules += $"MAP {cealHostSniWithoutNull} {cealHostIp},";
}
CealArgs = @$"/c @start .\""{Path.GetFileName(MainConst.UncealedBrowserPath)}"" --host-rules=""{hostRules.TrimEnd(',')}"" --host-resolver-rules=""{hostResolverRules.TrimEnd(',')}"" --test-type --ignore-certificate-errors";
CealArgs = @$"--host-rules=""{hostRules.TrimEnd(',')}"" --host-resolver-rules=""{hostResolverRules.TrimEnd(',')}"" --test-type --ignore-certificate-errors";
NginxConfWatcher_Changed(null!, null!);
}