- ftp-box-source.zip
- Ftp-Box
- Assemblies
- DSn.FtpBox.App
- DSn.FtpBox.FtpService
- DSn.FtpBox.Jobs
- DSn.FtpBox.Logic
- DSn.FtpBox.Objects
- DSn.FtpBox.TestUI
- Dsn.FtpBox.TestXPTable
- DSn.FtpBox.View
- DSn.FtpBox
- Ftp-Box.sln
- FtpBoxSetup
- FtpBoxSetup.vdproj
- Lib
- XPTable UserGuide.chm
- XPTable.chm
- XPTable.dll
- XPTable.xml
- MockFtpFileList
- BuildTasks
- Clean.bat
- Ftp-Box.gadget
- ftp-box.zip
- Ftp-Box.gadget
- Ftp-Box.msi
|
using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.IO;
namespace DSn.FtpBox.Objects
{
public class Ftp
{
public event EventHandler<DoDownloadEventArgs> DoDownload;
public event EventHandler<DoUploadEventArgs> DoUpload;
public event EventHandler<DoListEventArgs> DoList;
public event EventHandler DoConnect;
public event EventHandler DoDisconnect;
public event EventHandler SettingsChanged;
private void OnSettingsChanged(EventArgs e)
{
if (SettingsChanged != null) SettingsChanged(this, e);
}
private FtpSettingsData ftpData;
public FtpSettingsData FtpData
{
get { return ftpData; }
set
{
ftpData = value;
OnSettingsChanged(new EventArgs());
}
}
public void Upload(FtpFile ftpFile, string source)
{
if (DoUpload != null) DoUpload(this, new DoUploadEventArgs(ftpFile, source));
}
public void Download(FtpFile ftpFile, string target)
{
if (DoDownload != null) DoDownload(this, new DoDownloadEventArgs(ftpFile, target));
}
public List<FtpFile> List()
{
DoListEventArgs e = new DoListEventArgs();
if (DoList != null) DoList(this, e);
return e.Result;
}
public void Connect()
{
if (DoConnect != null) DoConnect(this, new EventArgs());
}
public void Disconnect()
{
if (DoDisconnect != null) DoDisconnect(this, new EventArgs());
}
public event EventHandler<DoDeleteEventArgs> DoDelete;
public void Delete(FtpFile ftpFile)
{
if (DoDelete != null) DoDelete(this, new DoDeleteEventArgs(ftpFile));
}
public class ProgressEventArgs : CancelEventArgs
{
private readonly FtpFile ftpFile;
public FtpFile FtpFile
{
get { return ftpFile; }
}
private readonly int progress;
public int Progress
{
get { return progress; }
}
public ProgressEventArgs(FtpFile ftpFile, int progress)
{
this.ftpFile = ftpFile;
this.progress = progress;
}
}
public event EventHandler<ProgressEventArgs> Progress;
public bool OnProgress(FtpFile ftpFile, int progress)
{
ProgressEventArgs e = new ProgressEventArgs(ftpFile, progress);
if (Progress != null) Progress(this, e);
return e.Cancel;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.
A list of licenses authors might use can be found here
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.