|
using System;
using System.Collections;
using System.Runtime.InteropServices;
namespace KCommon.Net.FTP
{
#region COM Interface IFtpAsyncResult
public interface IFtpAsyncResult
{
bool IsSuccess {get;}
bool IsAborted {get;}
bool IsFailed {get;}
string Message {get;}
int FtpResponseCode {get;}
}
#endregion
[ClassInterface(ClassInterfaceType.None)]
public class FtpAsyncResult : IFtpAsyncResult
{
public const int Complete = 0;
public const int Fail = 1;
public const int Abort = 2;
private readonly BitArray m_result;
private string m_message;
private int m_ftpResponse;
#region Constructors
internal FtpAsyncResult() : this("Success.", (int)FtpResponse.InvalidCode, Complete)
{
}
internal FtpAsyncResult(string message, int result) : this(message, (int)FtpResponse.InvalidCode, result)
{
}
/*public FtpAsyncResult(string message) : this(message, null, (int)FtpResponse.InvalidCode, Fail)
{
}
public FtpAsyncResult(string message, string fileName) : this(message, fileName, (int)FtpResponse.InvalidCode, Fail)
{
}
public FtpAsyncResult(string message, int ftpCode) : this(message, null, ftpCode, Fail)
{
}
public FtpAsyncResult(string message, string fileName, int ftpCode) : this(message, fileName, ftpCode, Fail)
{
}*/
internal FtpAsyncResult(string message, int ftpCode, int result)
{
m_result = new BitArray(3);
m_message = message;
m_ftpResponse = ftpCode;
m_result[result]= true;
}
#endregion
public bool IsSuccess
{
get {return m_result[Complete];}
}
public bool IsFailed
{
get {return m_result[Fail];}
}
public bool IsAborted
{
get {return m_result[Abort];}
}
public int FtpResponseCode
{
get {return m_ftpResponse;}
}
public string Message
{
get {return m_message;}
}
}
}
|
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.