From c6f91bee1c9c4aa82f30f5b152e1a684e0519e5f Mon Sep 17 00:00:00 2001 From: ProxySU Date: Thu, 19 Mar 2020 09:35:42 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E4=B9=A0=E4=B8=A4=E4=B8=AA=E7=AA=97?= =?UTF-8?q?=E5=8F=A3=E9=97=B4=E4=BC=A0=E9=80=92=E5=80=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ProxySU/MainWindow.xaml | 6 +- ProxySU/MainWindow.xaml.cs | 12 +++- ProxySU/TemplateConfiguration.xaml | 6 +- ProxySU/TemplateConfiguration.xaml.cs | 89 ++++++++++++++++++++++----- 4 files changed, 93 insertions(+), 20 deletions(-) diff --git a/ProxySU/MainWindow.xaml b/ProxySU/MainWindow.xaml index e1f89b2..7068d8b 100644 --- a/ProxySU/MainWindow.xaml +++ b/ProxySU/MainWindow.xaml @@ -98,7 +98,11 @@ --> - + + + + + diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index 9df5ceb..d9b08d3 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -24,14 +24,14 @@ namespace ProxySU /// public partial class MainWindow : Window { + public static string[] ReceiveConfigurationParameters { get; set; } public MainWindow() { InitializeComponent(); RadioButtonPasswordLogin.IsChecked = true; RadioButtonNoProxy.IsChecked = true; RadioButtonProxyNoLogin.IsChecked = true; - //GuideConfiguration.IsChecked = true; - //RadioButtonTemplateConfiguration.IsChecked = true; + ReceiveConfigurationParameters = new string[5]; } //System.Diagnostics.Process exitProgram = System.Diagnostics.Process.GetProcessById(System.Diagnostics.Process.GetCurrentProcess().Id); private void Button_Login_Click(object sender, RoutedEventArgs e) @@ -591,6 +591,14 @@ namespace ProxySU windowTemplateConfiguration.ShowDialog(); } + //测试接收到的模板参数 + private void Button_Click(object sender, RoutedEventArgs e) + { + foreach (string num in ReceiveConfigurationParameters) + { + MessageBox.Show(num); + } + } //private void ButtonSetConfiguration_Click(object sender, RoutedEventArgs e) //{ diff --git a/ProxySU/TemplateConfiguration.xaml b/ProxySU/TemplateConfiguration.xaml index 46d9dd1..9422b27 100644 --- a/ProxySU/TemplateConfiguration.xaml +++ b/ProxySU/TemplateConfiguration.xaml @@ -37,7 +37,7 @@ - + @@ -79,7 +79,7 @@ - + @@ -88,7 +88,7 @@ - + diff --git a/ProxySU/TemplateConfiguration.xaml.cs b/ProxySU/TemplateConfiguration.xaml.cs index bdf7c90..f2ad14c 100644 --- a/ProxySU/TemplateConfiguration.xaml.cs +++ b/ProxySU/TemplateConfiguration.xaml.cs @@ -14,7 +14,7 @@ using System.Windows.Shapes; namespace ProxySU { /// - /// Window1.xaml 的交互逻辑 + /// WindowTemplateConfiguration.xaml 的交互逻辑 /// public partial class WindowTemplateConfiguration : Window { @@ -29,56 +29,79 @@ namespace ProxySU if (RadioButtonTCP.IsChecked == true) { + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "TCP"; } else if (RadioButtonWebSocketTLS2Web.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "WebSocketTLS2Web"; + } else if (RadioButtonTCPhttp.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "TCPhttp"; } else if (RadioButtonMkcpNoCamouflage.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "MkcpNoCamouflage"; } else if (RadioButton2mKCP2SRTP.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "mKCP2SRTP"; } else if (RadioButton2mKCPuTP.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "mKCPuTP"; } else if (RadioButton2mKCP2WechatVideo.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WechatVideo"; } else if (RadioButton2mKCP2DTLS.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "mKCP2DTLS"; } else if (RadioButton2mKCP2WireGuard.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "mKCP2WireGuard"; } else if (RadioButtonHTTP2.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "HTTP2"; } else if (RadioButtonTLS.IsChecked == true) { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "TLS"; } else { - + //传递模板类型 + MainWindow.ReceiveConfigurationParameters[0] = "TCP"; } + //传递服务端口 + MainWindow.ReceiveConfigurationParameters[1] = TextBoxServerListenPort.Text.ToString(); + //传递uuid + MainWindow.ReceiveConfigurationParameters[2] = TextBoxNewUUID.Text.ToString(); + //传递路径 + MainWindow.ReceiveConfigurationParameters[3] = TextBoxPath.Text.ToString(); + //传递域名 + MainWindow.ReceiveConfigurationParameters[4] = TextBoxDomain.Text.ToString(); + this.Close(); } private void ButtondCancel_Click(object sender, RoutedEventArgs e) => Close(); - + #region 其他设置中的界面控制 private void RadioButtonTCP_Checked(object sender, RoutedEventArgs e) { TextBlockServerListenPort.Visibility = Visibility.Visible; @@ -92,6 +115,9 @@ namespace ProxySU ButtonDomain.Visibility = Visibility.Collapsed; Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); + Random random = new Random(); + int randomServerPort = random.Next(10000, 50000); + TextBoxServerListenPort.Text = randomServerPort.ToString(); } private void RadioButtonHTTP2_Checked(object sender, RoutedEventArgs e) @@ -102,6 +128,7 @@ namespace ProxySU ButtonServerListenPort.Visibility = Visibility.Visible; TextBlockPath.Visibility = Visibility.Visible; TextBoxPath.Visibility = Visibility.Visible; + TextBoxPath.Text = "/ray"; ButtonPath.Visibility = Visibility.Visible; TextBlockDomain.Visibility = Visibility.Visible; TextBoxDomain.Visibility = Visibility.Visible; @@ -109,11 +136,45 @@ namespace ProxySU Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); } - + private void RadioButtonTCPhttp_Checked(object sender, RoutedEventArgs e) + { + TextBlockServerListenPort.Visibility = Visibility.Visible; + TextBoxServerListenPort.Visibility = Visibility.Visible; + ButtonServerListenPort.Visibility = Visibility.Visible; + TextBoxServerListenPort.Text = "80"; + TextBlockPath.Visibility = Visibility.Collapsed; + TextBoxPath.Visibility = Visibility.Collapsed; + ButtonPath.Visibility = Visibility.Collapsed; + TextBlockDomain.Visibility = Visibility.Collapsed; + TextBoxDomain.Visibility = Visibility.Collapsed; + ButtonDomain.Visibility = Visibility.Collapsed; + Guid uuid = Guid.NewGuid(); + TextBoxNewUUID.Text = uuid.ToString(); + } + #endregion + //产生随机的uuid private void ButtonNewUUID_Click(object sender, RoutedEventArgs e) { Guid uuid = Guid.NewGuid(); TextBoxNewUUID.Text = uuid.ToString(); } + //产生随机服务端口 + private void ButtonServerListenPort_Click(object sender, RoutedEventArgs e) + { + Random random = new Random(); + int randomServerPort = random.Next(10000, 50000); + TextBoxServerListenPort.Text = randomServerPort.ToString(); + } + //产生随机的Path + private void ButtonPath_Click(object sender, RoutedEventArgs e) + { + Random random = new Random(); + int randomSerialNum = random.Next(0, 4); + Guid uuid = Guid.NewGuid(); + string[] pathArray = uuid.ToString().Split('-'); + string path = pathArray[randomSerialNum]; + TextBoxPath.Text = $"/{path}"; + //MessageBox.Show(path); + } } }