1.0.2 (beta) 更新

This commit is contained in:
Space Time 2022-05-08 11:13:47 +08:00
parent 55ec368160
commit f9619ccb31
8 changed files with 37 additions and 47 deletions

View File

@ -4,9 +4,6 @@ namespace Sheas_Cealer
{ {
public partial class App : Application public partial class App : Application
{ {
protected override void OnStartup(StartupEventArgs e) protected override void OnStartup(StartupEventArgs e) => new MainWindow(e.Args).Show();
{
new MainWindow(e.Args).Show();
}
} }
} }

Binary file not shown.

View File

@ -11,5 +11,6 @@
[["*instagram.com"],"ins","157.240.236.174"], [["*instagram.com"],"ins","157.240.236.174"],
[["*amazon.co.jp"],"ama","52.222.208.138"], [["*amazon.co.jp"],"ama","52.222.208.138"],
[["*github.com"],"git","140.82.121.3"], [["*github.com"],"git","140.82.121.3"],
[["*mikuclub.cc"],"mik","43.224.152.124"] [["*mikuclub.cc"],"mik","45.152.67.140"],
[["*twitch.tv"],"twi","199.232.138.167"]
] ]

View File

@ -16,9 +16,6 @@ namespace Sheas_Cealer
public override void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e) public override void Process_ErrorDataReceived(object sender, DataReceivedEventArgs e)
{ {
} }
public override void Process_Exited(object sender, EventArgs e) public override void Process_Exited(object sender, EventArgs e) => Environment.Exit(0);
{
Environment.Exit(0);
}
} }
} }

View File

@ -45,16 +45,10 @@ namespace Sheas_Cealer
//使用IconRemover //使用IconRemover
public partial class MainWindow public partial class MainWindow
{ {
protected override void OnSourceInitialized(EventArgs e) protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this);
{
IconRemover.RemoveIcon(this);
}
} }
public partial class AboutWindow public partial class AboutWindow
{ {
protected override void OnSourceInitialized(EventArgs e) protected override void OnSourceInitialized(EventArgs e) => IconRemover.RemoveIcon(this);
{
IconRemover.RemoveIcon(this);
}
} }
} }

View File

@ -8,10 +8,10 @@
<PackageReleaseNotes>Just Ceal It</PackageReleaseNotes> <PackageReleaseNotes>Just Ceal It</PackageReleaseNotes>
<Authors>Space Time</Authors> <Authors>Space Time</Authors>
<Company>Space Time</Company> <Company>Space Time</Company>
<AssemblyVersion>1.0.1</AssemblyVersion> <AssemblyVersion>1.0.2</AssemblyVersion>
<Version>1.0.1</Version> <Version>1.0.2</Version>
<FileVersion>1.0.1</FileVersion> <FileVersion>1.0.2</FileVersion>
<InformationalVersion>1.0.1</InformationalVersion> <InformationalVersion>1.0.2</InformationalVersion>
<PackageTags>Tool;Sheas;Cealer;Sni</PackageTags> <PackageTags>Tool;Sheas;Cealer;Sni</PackageTags>
<ApplicationIcon>Sheas-Cealer-Logo.ico</ApplicationIcon> <ApplicationIcon>Sheas-Cealer-Logo.ico</ApplicationIcon>
<PackageIcon>Sheas Cealer Logo.png</PackageIcon> <PackageIcon>Sheas Cealer Logo.png</PackageIcon>

View File

@ -13,10 +13,7 @@ namespace Sheas_Cealer
{ {
InitializeComponent(); InitializeComponent();
} }
private void AboutWin_Loaded(object sender, RoutedEventArgs e) private void AboutWin_Loaded(object sender, RoutedEventArgs e) => UpdateButton.Content = "版本号: " + Assembly.GetExecutingAssembly().GetName().Version!.ToString()[0..^2];
{
UpdateButton.Content = "版本号: " + Assembly.GetExecutingAssembly().GetName().Version!.ToString()[0..^2];
}
private void AboutButton_Click(object sender, RoutedEventArgs e) private void AboutButton_Click(object sender, RoutedEventArgs e)
{ {

View File

@ -16,6 +16,7 @@ namespace Sheas_Cealer
public partial class MainWindow : Window public partial class MainWindow : Window
{ {
private static string? CEALING_ARGUMENT; private static string? CEALING_ARGUMENT;
private static readonly FileSystemWatcher CEALING_HOST_WATCHER = new(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "Cealing-Host.json") { EnableRaisingEvents = true, NotifyFilter = NotifyFilters.LastWrite };
private static readonly DispatcherTimer MONITOR_TIMER = new() { Interval = new TimeSpan(1000000) }; //0.1s private static readonly DispatcherTimer MONITOR_TIMER = new() { Interval = new TimeSpan(1000000) }; //0.1s
internal MainWindow(string[] args) internal MainWindow(string[] args)
@ -34,28 +35,14 @@ namespace Sheas_Cealer
else if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.BrowserPath)) else if (!string.IsNullOrWhiteSpace(Properties.Settings.Default.BrowserPath))
Dispatcher.Invoke(() => ShowBox.Text = Properties.Settings.Default.BrowserPath); Dispatcher.Invoke(() => ShowBox.Text = Properties.Settings.Default.BrowserPath);
string hostRules = string.Empty, hostResolverRules = string.Empty; CEALING_HOST_WATCHER.Changed += CEALING_HOST_WATCHER_Changed;
FileStream hostStream = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"), FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete); CEALING_HOST_WATCHER_Changed(null!, null!);
JArray hostJArray = JArray.Parse(new StreamReader(hostStream).ReadToEnd());
foreach (var hostJToken in hostJArray)
{
hostResolverRules += "MAP " + hostJToken[1]!.ToString() + " " + hostJToken[2]!.ToString() + ",";
foreach (var hostName in hostJToken[0]!)
hostRules += "MAP " + hostName.ToString() + " " + hostJToken[1] + ",";
}
CEALING_ARGUMENT = @"/c @start .\""Uncealed-Browser.lnk"" --host-rules=""" + hostRules[0..^1] + @""" --host-resolver-rules=""" + hostResolverRules[0..^1] + @""" --test-type --ignore-certificate-errors";
}); });
} }
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); }
} }
private void MainWin_Loaded(object sender, RoutedEventArgs e) private void MainWin_Loaded(object sender, RoutedEventArgs e) => ShowBox.Focus();
{ private void MainWin_Closing(object sender, System.ComponentModel.CancelEventArgs e) => Environment.Exit(0);
ShowBox.Focus();
}
private void MainWin_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
Environment.Exit(0);
}
private void ShowBox_GotFocus(object sender, RoutedEventArgs e) private void ShowBox_GotFocus(object sender, RoutedEventArgs e)
{ {
@ -185,10 +172,7 @@ namespace Sheas_Cealer
} }
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; } catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
} }
private void AboutButton_Click(object sender, RoutedEventArgs e) private void AboutButton_Click(object sender, RoutedEventArgs e) => new AboutWindow().ShowDialog();
{
new AboutWindow().ShowDialog();
}
private void MONITOR_TIMER_Tick(object? sender, EventArgs e) private void MONITOR_TIMER_Tick(object? sender, EventArgs e)
{ {
@ -198,6 +182,26 @@ namespace Sheas_Cealer
ClashButton.Content = "停代"; ClashButton.Content = "停代";
} }
private void CEALING_HOST_WATCHER_Changed(object sender, FileSystemEventArgs e)
{
try
{
string hostRules = string.Empty, hostResolverRules = string.Empty;
FileStream hostStream = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json"), FileMode.OpenOrCreate, FileAccess.Read, FileShare.ReadWrite | FileShare.Delete);
JArray hostJArray = JArray.Parse(new StreamReader(hostStream).ReadToEnd());
foreach (var hostJToken in hostJArray)
{
hostResolverRules += "MAP " + hostJToken[1]!.ToString() + " " + hostJToken[2]!.ToString() + ",";
foreach (var hostName in hostJToken[0]!)
hostRules += "MAP " + hostName.ToString() + " " + hostJToken[1] + ",";
}
CEALING_ARGUMENT = @"/c @start .\""Uncealed-Browser.lnk"" --host-rules=""" + hostRules[0..^1] + @""" --host-resolver-rules=""" + hostResolverRules[0..^1] + @""" --test-type --ignore-certificate-errors";
}
catch { return; }
}
private void MainWin_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) private void MainWin_KeyDown(object sender, System.Windows.Input.KeyEventArgs e)
{ {
if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.W) if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.W)