diff --git a/ProxySU/MainWindow.xaml.cs b/ProxySU/MainWindow.xaml.cs index 166aa9c..91afeee 100644 --- a/ProxySU/MainWindow.xaml.cs +++ b/ProxySU/MainWindow.xaml.cs @@ -15,6 +15,7 @@ using Renci.SshNet; using System.Text.RegularExpressions; using System.Threading; using System.Threading.Tasks; +using System.IO; namespace ProxySU { @@ -369,10 +370,43 @@ namespace ProxySU { currentStatus = "主机已登录"; textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + Thread.Sleep(2000); + } + //检测远程主机系统环境是否符合要求 + currentStatus = "检测系统是否符合安装要求......"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + Thread.Sleep(2000); + currentStatus = "检测完毕,符合安装要求,布署中......"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + Thread.Sleep(2000); + + //运行命令 + //client.RunCommand("apt update"); + //client.RunCommand("apt install curl -y"); + //client.RunCommand("bash <(curl -L -s https://install.direct/go.sh)"); + try + { + using (var sftpClient = new SftpClient(connectionInfo)) + { + sftpClient.Connect(); + MessageBox.Show("sftp信息1" + sftpClient.ConnectionInfo.ServerVersion.ToString()); + sftpClient.UploadFile(File.OpenRead("config\\config.json"),"/root/config.json", true); + MessageBox.Show("sftp信息"+sftpClient.ConnectionInfo.ServerVersion.ToString()); + } + + } + catch(Exception ex2) + { + MessageBox.Show("sftp"+ex2.ToString()); + MessageBox.Show("sftp出现未知错误"); } - client.RunCommand("echo 1111 >> test.json"); - MessageBox.Show(client.ConnectionInfo.ServerVersion.ToString()); + currentStatus = "安装成功"; + textBlockName.Dispatcher.BeginInvoke(updateAction, textBlockName, progressBar, currentStatus); + //Thread.Sleep(2000); + MessageBox.Show("安装成功"); + MessageBox.Show("ssh信息"+client.ConnectionInfo.ServerVersion.ToString()); + //MessageBox.Show(client); client.Disconnect(); @@ -424,6 +458,21 @@ namespace ProxySU progressBar.IsIndeterminate = true; } else if (currentStatus.Contains("主机已登录") == true) + { + progressBar.IsIndeterminate = true; + //progressBar.Value = 100; + } + else if (currentStatus.Contains("检测系统是否符合安装要求") == true) + { + progressBar.IsIndeterminate = true; + //progressBar.Value = 100; + } + else if (currentStatus.Contains("布署中") == true) + { + progressBar.IsIndeterminate = true; + //progressBar.Value = 100; + } + else if (currentStatus.Contains("安装成功") == true) { progressBar.IsIndeterminate = false; progressBar.Value = 100; @@ -434,6 +483,7 @@ namespace ProxySU progressBar.Value = 0; } + } } } diff --git a/ProxySU/bin/Release/ProxySU.exe b/ProxySU/bin/Release/ProxySU.exe index 6bdb925..4ecca25 100644 Binary files a/ProxySU/bin/Release/ProxySU.exe and b/ProxySU/bin/Release/ProxySU.exe differ diff --git a/ProxySU/bin/Release/Release.zip b/ProxySU/bin/Release/Release.zip index 108aa57..31417e8 100644 Binary files a/ProxySU/bin/Release/Release.zip and b/ProxySU/bin/Release/Release.zip differ