www.pudn.com > SharpDownload(FTP¼°WEBÏÂÔØ).zip > DownloadInfo.cs
using System;
namespace SharpDownload
{
///
/// Summary description for DownloadInfo.
///
public class DownloadInfo : URLComponent
{
private string localPath = string.Empty;
private string localFileName = string.Empty;
private string username = "anonymous";
private string password = "anonymous@anonymous.net";
private long fileSize = 0;
private bool resumeSupported = false;
///
/// Default constructor
///
public DownloadInfo() : base(){}
///
/// Overloaded constructor
///
public DownloadInfo(string url) : base(url){}
///
/// Path to local download directory
///
public string LocalPath
{
get
{
return localPath;
}
set
{
localPath = value;
}
}
///
/// Name of local file
///
public string LocalFileName
{
get
{
return localFileName;
}
set
{
localFileName = value;
}
}
///
/// Return the complete path and filename
///
public string LocalPathFile
{
get
{
// Check for trailing \
string local;
if (localPath.Substring(localPath.Length-1, 1)==@"\")
{
local = localPath;
}
else
{
local = localPath + @"\";
}
// Return full path and file name
if (localFileName.Length==0)
{
return localPath + this.FileName;
}
else
{
return localPath + localFileName;
}
}
}
///
/// Size of the file in bytes
///
public long FileSize
{
get
{
return fileSize;
}
set
{
if (value<0)
{
fileSize = 0;
throw new ApplicationException("Cannot set file size less than zero.");
}
fileSize = (long)value;
}
}
///
/// User name to log in with
///
public string UserName
{
get
{
return username;
}
set
{
username = value;
}
}
///
/// Password to log in with
///
public string Password
{
get
{
return password;
}
set
{
password = value;
}
}
///
/// Whether resume is supported
///
public bool ResumeSupported
{
get
{
return resumeSupported;
}
set
{
resumeSupported = value;
}
}
///
/// Public read-only property for the remote path and filename
///
public string RemotePathFile
{
get
{
return this.Directory + "/" + this.FileName;
}
}
}
}