mirror of
https://github.com/proxysu/ProxySU.git
synced 2024-11-25 14:46:08 +03:00
测试上传文件
This commit is contained in:
parent
51cd5937b6
commit
b27f76efe0
@ -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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Binary file not shown.
Binary file not shown.
Loading…
Reference in New Issue
Block a user