From 76804a3be09a1b18d534db0ab54d9e3716e3607b Mon Sep 17 00:00:00 2001
From: Space Time <55327009+SpaceTimee@users.noreply.github.com>
Date: Thu, 19 May 2022 13:11:29 +0800
Subject: [PATCH] =?UTF-8?q?1.0.4=20(beta)=20=E6=9B=B4=E6=96=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Sheas-Cealer.csproj | 9 +++++----
Windows/MainWindow.xaml | 18 ++++++++++++-----
Windows/MainWindow.xaml.cs | 41 ++++++++++++++++++++++++++------------
3 files changed, 46 insertions(+), 22 deletions(-)
diff --git a/Sheas-Cealer.csproj b/Sheas-Cealer.csproj
index 1270ceb..a38ed9d 100644
--- a/Sheas-Cealer.csproj
+++ b/Sheas-Cealer.csproj
@@ -8,10 +8,10 @@
Just Ceal It
Space Time
Space Time
- 1.0.3
- 1.0.3
- 1.0.3
- 1.0.3
+ 1.0.4
+ 1.0.4
+ 1.0.4
+ 1.0.4
Tool;Sheas;Cealer;Sni
Sheas-Cealer-Logo.ico
Sheas Cealer Logo.png
@@ -74,6 +74,7 @@
+
diff --git a/Windows/MainWindow.xaml b/Windows/MainWindow.xaml
index e056a05..e846032 100644
--- a/Windows/MainWindow.xaml
+++ b/Windows/MainWindow.xaml
@@ -10,6 +10,7 @@
+
@@ -21,17 +22,24 @@
-
+
+
+
+
+
+
+
+
+
-
-
-
-
+
+
+
\ No newline at end of file
diff --git a/Windows/MainWindow.xaml.cs b/Windows/MainWindow.xaml.cs
index 8cda9bd..297d142 100644
--- a/Windows/MainWindow.xaml.cs
+++ b/Windows/MainWindow.xaml.cs
@@ -9,6 +9,7 @@
using IWshRuntimeLibrary;
using Microsoft.Win32;
using Newtonsoft.Json.Linq;
+using YamlDotNet.RepresentationModel;
using File = System.IO.File;
namespace Sheas_Cealer
@@ -119,24 +120,19 @@ private void ViewButton_Click(object sender, RoutedEventArgs e)
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
}
- private void EditButton_Click(object sender, RoutedEventArgs e)
- {
- try
- {
- ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json")) { UseShellExecute = true };
- Process.Start(processStartInfo);
- }
- catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
- }
private void ClashButton_Click(object sender, RoutedEventArgs e)
{
try
{
RegistryKey proxyKey = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true)!;
- if (ClashButton.Content.ToString() == "代理")
+ if (ClashButton.Content.ToString() == "启动代理")
{
+ YamlStream configStream = new();
+ configStream.Load(File.OpenText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"config.yaml")));
+ YamlMappingNode configMap = (YamlMappingNode)configStream.Documents[0].RootNode;
+
proxyKey.SetValue("ProxyEnable", 1);
- proxyKey.SetValue("ProxyServer", "127.0.0.1:7880");
+ proxyKey.SetValue("ProxyServer", "127.0.0.1:" + configMap["mixed-port"]);
new Clash().ShellRun(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, "-d .");
}
@@ -172,14 +168,33 @@ private void OpenButton_Click(object sender, RoutedEventArgs e)
}
catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
}
+
+ private void ConfigButton_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"config.yaml")) { UseShellExecute = true };
+ Process.Start(processStartInfo);
+ }
+ catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
+ }
+ private void HostButton_Click(object sender, RoutedEventArgs e)
+ {
+ try
+ {
+ ProcessStartInfo processStartInfo = new(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"Cealing-Host.json")) { UseShellExecute = true };
+ Process.Start(processStartInfo);
+ }
+ catch (Exception ex) { MessageBox.Show("Error: " + ex.Message); return; }
+ }
private void AboutButton_Click(object sender, RoutedEventArgs e) => new AboutWindow().ShowDialog();
private void MONITOR_TIMER_Tick(object? sender, EventArgs e)
{
if (Process.GetProcessesByName("Cealing-Clash").Length == 0)
- ClashButton.Content = "代理";
+ ClashButton.Content = "启动代理";
else
- ClashButton.Content = "停代";
+ ClashButton.Content = "停止代理";
}
private void CEALING_HOST_WATCHER_Changed(object sender, FileSystemEventArgs e)