mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-13 12:52:08 +08:00
1.1.2 -> 1.1.3 第16次更新
This commit is contained in:
parent
37bcd63b9e
commit
0c76f6ed59
@ -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";
|
||||
|
@ -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)
|
||||
{
|
@ -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!);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user