91av视频/亚洲h视频/操亚洲美女/外国一级黄色毛片 - 国产三级三级三级三级

  • 大小: 533KB
    文件類型: .rar
    金幣: 2
    下載: 1 次
    發(fā)布日期: 2021-06-12
  • 語言: C#
  • 標(biāo)簽: C#??SCP??

資源簡介

C#版本的SCP上傳和下載(基于Renci.SshNet),Vs2008工程,完整源代碼,有進(jìn)度條提示。

資源截圖

代碼片段和文件信息

using?System;
using?System.Collections.Generic;
using?System.ComponentModel;
using?System.Data;
using?System.Drawing;
using?System.Linq;
using?System.Text;
using?System.Windows.Forms;
using?Renci.SshNet;
using?Renci.SshNet.Common;


namespace?ScpFileTransfer
{
????public?partial?class?Form1?:?Form
????{
????????private?static?ScpClient?scpClient=null;

????????public?Form1()
????????{
????????????InitializeComponent();
????????}

????????private?void?btnDownload_Click(object?sender?EventArgs?e)
????????{
????????????if?(scpClient?!=?null)
????????????{
????????????????if?(scpClient.IsConnected)
????????????????{
????????????????????scpClient.Disconnect();
????????????????}
????????????????scpClient.Dispose();
????????????}

????????????string?scpHostIP?=?textHostIp.Text;
????????????string?scpUSER?=?textUsr.Text;
????????????string?scpPwd?=?textPwd.Text;
????????????int?scpPORT?=?22;

????????????string?remotePath?=?textServerFile.Text;
????????????string?localPath?=?textLocalFile.Text;

????????????try{
????????????//注意,需要加上try?catch語句
????????????????scpClient?=?new?ScpClient(scpHostIP?scpPORT?scpUSER?scpPwd);
????????????????scpClient.BufferSize?=?1024;
????????????????System.IO.FileInfo?fi?=?new?System.IO.FileInfo(localPath);
????????????????scpClient.Connect();
????????????????scpClient.Downloading?+=?scpDownloadInfoShow;//這里是直接使用+號,不能用new來添加.用new方式會報錯
????????????????initProgressbar();
????????????????setBtnStatus(false);
????????????????scpClient.Download(remotePath?fi);???

????????????}
????????????catch(Exception?e1){
????????????????setBtnStatus(true);
????????????????MessageBox.Show(e1.Message);
????????????}
????????}

????????//定義委托方法
????????void?scpDownloadInfoShow(object?sender?ScpDownloadEventArgs?e)
????????{
????????????progressBar1.Value?=?(int)(100?*?(e.Downloaded)?/?(e.Size));
????????????if?(e.Downloaded?>=?e.Size)
????????????{
????????????????setBtnStatus(true);
????????????????MessageBox.Show(“下載完成“);
????????????}

????????}

????????private?void?setBtnStatus(bool?st)
????????{
????????????btnDownload.Enabled?=?st;
????????????btnUpload.Enabled?=?st;
????????}
????????private?void?initProgressbar()
????????{
????????????progressBar1.Maximum?=?100;//設(shè)置最大長度值
????????????progressBar1.Value?=?0;//設(shè)置當(dāng)前值
????????????progressBar1.Step?=?1;//設(shè)置沒次增長多少
????????????progressBar1.Visible?=?true;
????????}

????????private?void?btnUpload_Click(object?sender?EventArgs?e)
????????{
????????????if?(scpClient?!=?null)
????????????{
????????????????if?(scpClient.IsConnected)
????????????????{
????????????????????scpClient.Disconnect();
????????????????}
????????????????scpClient.Dispose();
????????????}

????????????string?scpHostIP?=?textHostIp.Text;
????????????string?scpUSER?=?textUsr.Text;
????????????string?scpPwd?=?textPwd.Text;
????????????int?scpPORT?=?22;

????????????string?remotePath?=?textServerFile.Text;
????????????s

?屬性????????????大小?????日期????時間???名稱
-----------?---------??----------?-----??----

?????文件?????470016??2019-03-02?16:45??ScpFileTransfer\ScpFileTransfer\bin\Debug\Renci.SshNet.dll

?????文件??????12288??2019-03-04?10:21??ScpFileTransfer\ScpFileTransfer\bin\Debug\ScpFileTransfer.exe

?????文件??????28160??2019-03-04?10:21??ScpFileTransfer\ScpFileTransfer\bin\Debug\ScpFileTransfer.pdb

?????文件??????14328??2019-03-04?10:23??ScpFileTransfer\ScpFileTransfer\bin\Debug\ScpFileTransfer.vshost.exe

?????文件????????490??2009-06-11?05:14??ScpFileTransfer\ScpFileTransfer\bin\Debug\ScpFileTransfer.vshost.exe.manifest

?????文件?????470016??2019-03-02?16:45??ScpFileTransfer\ScpFileTransfer\dll\Renci.SshNet.dll

?????文件?????167266??2019-03-02?16:49??ScpFileTransfer\ScpFileTransfer\dll\Renci.SshNet.rar

?????文件???????4256??2019-03-04?10:21??ScpFileTransfer\ScpFileTransfer\Form1.cs

?????文件???????8568??2019-03-04?10:14??ScpFileTransfer\ScpFileTransfer\Form1.Designer.cs

?????文件???????5814??2019-03-04?10:14??ScpFileTransfer\ScpFileTransfer\Form1.resx

?????文件???????4569??2019-03-04?09:05??ScpFileTransfer\ScpFileTransfer\obj\Debug\ResolveAssemblyReference.cache

?????文件????????730??2019-03-04?10:23??ScpFileTransfer\ScpFileTransfer\obj\Debug\ScpFileTransfer.csproj.FileListAbsolute.txt

?????文件????????847??2019-03-04?10:17??ScpFileTransfer\ScpFileTransfer\obj\Debug\ScpFileTransfer.csproj.GenerateResource.Cache

?????文件??????12288??2019-03-04?10:21??ScpFileTransfer\ScpFileTransfer\obj\Debug\ScpFileTransfer.exe

?????文件????????180??2019-03-04?10:17??ScpFileTransfer\ScpFileTransfer\obj\Debug\ScpFileTransfer.Form1.resources

?????文件??????28160??2019-03-04?10:21??ScpFileTransfer\ScpFileTransfer\obj\Debug\ScpFileTransfer.pdb

?????文件????????180??2019-03-04?09:05??ScpFileTransfer\ScpFileTransfer\obj\Debug\ScpFileTransfer.Properties.Resources.resources

?????文件????????496??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\Program.cs

?????文件???????1380??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\Properties\AssemblyInfo.cs

?????文件???????2880??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\Properties\Resources.Designer.cs

?????文件???????5612??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\Properties\Resources.resx

?????文件???????1100??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\Properties\Settings.Designer.cs

?????文件????????249??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\Properties\Settings.settings

?????文件???????3994??2019-03-04?09:05??ScpFileTransfer\ScpFileTransfer\ScpFileTransfer.csproj

?????文件????????935??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer.sln

????..A..H.?????17920??2019-03-04?10:36??ScpFileTransfer\ScpFileTransfer.suo

?????目錄??????????0??2019-03-04?10:15??ScpFileTransfer\ScpFileTransfer\obj\Debug\Refactor

?????目錄??????????0??2019-03-04?08:51??ScpFileTransfer\ScpFileTransfer\obj\Debug\TempPE

?????目錄??????????0??2019-03-04?09:06??ScpFileTransfer\ScpFileTransfer\bin\Debug

?????目錄??????????0??2019-03-04?10:21??ScpFileTransfer\ScpFileTransfer\obj\Debug

............此處省略9個文件信息

評論

共有 條評論