mirror of
https://github.com/SpaceTimee/Sheas-Cealer.git
synced 2025-07-14 05:12:09 +08:00
1.1.1 -> 1.1.2 第12次更新
This commit is contained in:
parent
4c966e4b09
commit
7e85989fa8
@ -2,6 +2,7 @@
|
||||
using System.IO;
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using MaterialDesignThemes.Wpf;
|
||||
using Microsoft.Win32;
|
||||
using Sheas_Cealer.Consts;
|
||||
using Sheas_Cealer.Props;
|
||||
using File = System.IO.File;
|
||||
@ -16,9 +17,12 @@ internal partial class MainPres : ObservableObject
|
||||
int upstreamUrlIndex = Array.FindIndex(args, arg => arg.Equals("-u", StringComparison.OrdinalIgnoreCase)) + 1;
|
||||
int extraArgsIndex = Array.FindIndex(args, arg => arg.Equals("-e", StringComparison.OrdinalIgnoreCase)) + 1;
|
||||
|
||||
BrowserPath = browserPathIndex == 0 || browserPathIndex == args.Length ?
|
||||
!string.IsNullOrWhiteSpace(Settings.Default.BrowserPath) ? Settings.Default.BrowserPath : string.Empty :
|
||||
args[browserPathIndex];
|
||||
BrowserPath = browserPathIndex != 0 && browserPathIndex != args.Length ?args[browserPathIndex]:
|
||||
!string.IsNullOrWhiteSpace(Settings.Default.BrowserPath) ? Settings.Default.BrowserPath :
|
||||
(Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\msedge.exe", string.Empty, null) ??
|
||||
Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\chrome.exe", string.Empty, null) ??
|
||||
Registry.GetValue(@"HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\brave.exe", string.Empty, null) ??
|
||||
string.Empty).ToString()!;
|
||||
|
||||
UpstreamUrl = upstreamUrlIndex == 0 || upstreamUrlIndex == args.Length ?
|
||||
!string.IsNullOrWhiteSpace(Settings.Default.UpstreamUrl) ? Settings.Default.UpstreamUrl : MainConst.DefaultUpstreamUrl :
|
||||
|
@ -177,11 +177,12 @@ public partial class MainWin : Window
|
||||
|
||||
private void HostWatcher_Changed(object sender, FileSystemEventArgs e)
|
||||
{
|
||||
string hostName = e.Name!.TrimStart("Cealing-Host-".ToCharArray()).TrimEnd(".json".ToCharArray());
|
||||
|
||||
try
|
||||
{
|
||||
string hostRulesFragments = string.Empty;
|
||||
string hostResolverRulesFragments = string.Empty;
|
||||
string hostName = e.Name!.TrimStart("Cealing-Host-".ToCharArray()).TrimEnd(".json".ToCharArray());
|
||||
int ruleIndex = 0;
|
||||
|
||||
using FileStream hostStream = new(e.FullPath, FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
|
||||
@ -202,7 +203,10 @@ public partial class MainWin : Window
|
||||
}
|
||||
|
||||
CealArgsFragments[hostName] = (hostRulesFragments, hostResolverRulesFragments);
|
||||
|
||||
}
|
||||
catch { CealArgsFragments.Remove(hostName); }
|
||||
finally
|
||||
{
|
||||
string hostRules = string.Empty;
|
||||
string hostResolverRules = string.Empty;
|
||||
|
||||
@ -212,9 +216,8 @@ public partial class MainWin : Window
|
||||
hostResolverRules += CealArgsFragment.hostResolverRulesFragments;
|
||||
}
|
||||
|
||||
CealArgs = @$"--host-rules=""{hostRules.TrimEnd(',')}"" --host-resolver-rules=""{hostResolverRules.TrimEnd(',')}"" --test-type --ignore-certificate-errors";
|
||||
CealArgs = @$"/c @start .\""Uncealed-Browser.lnk"" --host-rules=""{hostRules.TrimEnd(',')}"" --host-resolver-rules=""{hostResolverRules.TrimEnd(',')}"" --test-type --ignore-certificate-errors";
|
||||
}
|
||||
catch { CealArgs = string.Empty; }
|
||||
}
|
||||
private void MainWin_KeyDown(object sender, KeyEventArgs e)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user