花了点时间弄了个带相应事件的FTP类(C#)
来源:互联网 发布:java web课程设计总结 编辑:程序博客网 时间:2024/05/01 10:31
类下载地址:
http://download.csdn.net/source/334678
实例代码:
using System;
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Xml;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace FTPTest
...{
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
...{
FtpLogin();
}
FTP ft;
private void FtpLogin()
...{
}
void ft_StatusChange(FTP.FtpReturns frt)
...{
richTextBox1.Select(richTextBox1.Text.Length, frt.FtpMessage.Length);
if (frt.FtpCode == -2)
...{
progressBar1.Value = Convert.ToInt32(frt.FtpMessage);
}
else
...{
if (frt.FtpCode < 0)
...{
richTextBox1.SelectionColor = Color.Red;
}
else
...{
richTextBox1.SelectionColor = Color.Green;
}
richTextBox1.AppendText(frt.FtpMessage);
}
}
private void button1_Click(object sender, EventArgs e)
...{
string FTPUri = "***.***.***.***";
ft = new FTP(FTPUri, 21, "admin", "password");
ft.StatusChange += new FTP.ConnectStatusChange(ft_StatusChange);
ft.ConnectFTP();
ft.LoginFTP();
}
private void button2_Click(object sender, EventArgs e)
...{
ft.thisDir();
}
private void button3_Click(object sender, EventArgs e)
...{
string c = ft.DIR();
richTextBox1.AppendText(c); ;
}
private void button4_Click(object sender, EventArgs e)
...{
ft.UpLoad(@"C:a.rar");
}
private void button5_Click(object sender, EventArgs e)
...{
ft.DownLoad("a.rar");
}
private void timer1_Tick(object sender, EventArgs e)
...{
if (progressBar1.Value == 100)
...{
progressBar1.Value = 0;
}
progressBar1.Value++;
}
private void button8_Click(object sender, EventArgs e)
...{
ft.RemoveDir("sss");
}
private void button6_Click(object sender, EventArgs e)
...{
ft.FtpQuit();
}
private void button7_Click(object sender, EventArgs e)
...{
ft.MakeDir("sss");
}
private void button9_Click(object sender, EventArgs e)
...{
ft.ChangeDir("sss");
}
}
}
using System.IO;
using System.Net;
using System.Net.Sockets;
using System.Xml;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Threading;
using System.Windows.Forms;
namespace FTPTest
...{
public partial class Form1 : Form
...{
public Form1()
...{
InitializeComponent();
}
private void Form1_Load(object sender, EventArgs e)
...{
FtpLogin();
}
FTP ft;
private void FtpLogin()
...{
}
void ft_StatusChange(FTP.FtpReturns frt)
...{
richTextBox1.Select(richTextBox1.Text.Length, frt.FtpMessage.Length);
if (frt.FtpCode == -2)
...{
progressBar1.Value = Convert.ToInt32(frt.FtpMessage);
}
else
...{
if (frt.FtpCode < 0)
...{
richTextBox1.SelectionColor = Color.Red;
}
else
...{
richTextBox1.SelectionColor = Color.Green;
}
richTextBox1.AppendText(frt.FtpMessage);
}
}
private void button1_Click(object sender, EventArgs e)
...{
string FTPUri = "***.***.***.***";
ft = new FTP(FTPUri, 21, "admin", "password");
ft.StatusChange += new FTP.ConnectStatusChange(ft_StatusChange);
ft.ConnectFTP();
ft.LoginFTP();
}
private void button2_Click(object sender, EventArgs e)
...{
ft.thisDir();
}
private void button3_Click(object sender, EventArgs e)
...{
string c = ft.DIR();
richTextBox1.AppendText(c); ;
}
private void button4_Click(object sender, EventArgs e)
...{
ft.UpLoad(@"C:a.rar");
}
private void button5_Click(object sender, EventArgs e)
...{
ft.DownLoad("a.rar");
}
private void timer1_Tick(object sender, EventArgs e)
...{
if (progressBar1.Value == 100)
...{
progressBar1.Value = 0;
}
progressBar1.Value++;
}
private void button8_Click(object sender, EventArgs e)
...{
ft.RemoveDir("sss");
}
private void button6_Click(object sender, EventArgs e)
...{
ft.FtpQuit();
}
private void button7_Click(object sender, EventArgs e)
...{
ft.MakeDir("sss");
}
private void button9_Click(object sender, EventArgs e)
...{
ft.ChangeDir("sss");
}
}
}
- 花了点时间弄了个带相应事件的FTP类(C#)
- 今天花了点时间详细了解了一下WiFi
- 花了点时间用Java写好的弹球(可帮助入门啊)
- 带指示点的无限轮播(直接可以向左滑,速度稳定,时间久了速度也不会变)
- 刚学编程,写了个判断独立点与多边形位置关系的算法(C#)
- 找了一圈都找不到Git里怎么add带点的目录(带点的文件夹、隐藏文件)解决了!
- 最近抽了点时间做了个Android电子书一键生成器
- 花了两天时间,写了个lex
- 有时间看了点java中泛型的实现
- C了个++:03 - C++的字符串与 string 类
- C了个++:02 - C++的名称空间(层次)
- 同事给安装了个带log的 ios 软件。
- Flex - 带时间选择(可手工输入)的日期组件,去掉了 StringToolkit.formatNumberWithChar
- sed命令详解(终于花了点时间看完)
- 使用helloCharts做的图表,花了点时间请看重点
- 如何才能成功?有人总结了很好的10个点。
- opencv提供了多少个特征点的descriptor?
- ios8的UIScrollview 模拟器向下偏移了64个点
- Cisco Route PPPOE On Ethernet拨号及VPN设置
- ASP中各种数据库连接代码
- 如何使用VISIO中的UML图来表达C++语言中抽象类或抽象方法
- 对.Net程序进行打包
- 精妙的SQL语句
- 花了点时间弄了个带相应事件的FTP类(C#)
- Jsp/Java Web 开发环境搭建,MyEclipse 开发环境搭建
- 马化腾:腾讯看走眼YouTube 现在学习Facebook
- javascript 之 select下拉框
- xp样式按钮
- 使用Hibernate做一对多的实体映射(使用面向对象的方式设计表)
- WM_IDLEUPDATECMDUI,WM_KICKIDLE消息
- ADSL上网常见问题锦集
- c#写的虚拟机成功运转了