Skip to content

Commit

Permalink
1.0.4 更新
Browse files Browse the repository at this point in the history
  • Loading branch information
SpaceTimee committed May 19, 2022
1 parent 202aba0 commit d7e8727
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions Windows/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,13 @@ private void ClashButton_Click(object sender, RoutedEventArgs e)
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;
YamlMappingNode configMap;
try
{
configStream.Load(File.OpenText(Path.Combine(AppDomain.CurrentDomain.SetupInformation.ApplicationBase!, @"config.yaml")));
configMap = (YamlMappingNode)configStream.Documents[0].RootNode;
}
catch { throw new Exception("规则无法识别,请检查代理规则是否含有语法错误"); }

proxyKey.SetValue("ProxyEnable", 1);
proxyKey.SetValue("ProxyServer", "127.0.0.1:" + configMap["mixed-port"]);
Expand All @@ -150,6 +155,8 @@ private void OpenButton_Click(object sender, RoutedEventArgs e)
{
try
{
if (string.IsNullOrWhiteSpace(CEALING_ARGUMENT))
throw new Exception("规则无法识别,请检查伪造规则是否含有语法错误");
if (MessageBox.Show("启动前将关闭所选浏览器的所有进程,是否继续?", string.Empty, MessageBoxButton.YesNo) != MessageBoxResult.Yes)
return;

Expand Down

0 comments on commit d7e8727

Please sign in to comment.