Skip to content

Commit

Permalink
Merge pull request robinrodricks#282 from peterfortuin/278_async_vers…
Browse files Browse the repository at this point in the history
…ions_of_methods_to_IFtpClient

Added more async versions of methods to IFtpClient
  • Loading branch information
robinrodricks authored Mar 23, 2018
2 parents becd036 + d8edabe commit f2bb26a
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions FluentFTP/Client/IFtpClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,13 @@ public interface IFtpClient : IDisposable {
bool HasFeature(FtpCapability cap);
void DisableUTF8();

#if ASYNC
Task<FtpReply> ExecuteAsync(string command);
Task<FtpReply> GetReplyAsync();
Task ConnectAsync();
Task DisconnectAsync();
#endif


// MANAGEMENT

Expand Down Expand Up @@ -99,6 +106,24 @@ public interface IFtpClient : IDisposable {
DateTime GetModifiedTime(string path, FtpDate type = FtpDate.Original);
void SetModifiedTime(string path, DateTime date, FtpDate type = FtpDate.Original);

#if ASYNC
Task DeleteFileAsync(string path);
Task<bool> DirectoryExistsAsync(string path);
Task<bool> FileExistsAsync(string path);
Task CreateDirectoryAsync(string path, bool force);
Task RenameAsync(string path, string dest);
Task<bool> MoveFileAsync(string path, string dest, FtpExists existsMode = FtpExists.Overwrite);
Task<bool> MoveDirectoryAsync(string path, string dest, FtpExists existsMode = FtpExists.Overwrite);
Task SetFilePermissionsAsync(string path, int permissions);
Task<FtpListItem> GetFilePermissionsAsync(string path);
Task<int> GetChmodAsync(string path);
Task SetWorkingDirectoryAsync(string path);
Task<string> GetWorkingDirectoryAsync();
Task<long> GetFileSizeAsync(string path);
Task<DateTime> GetModifiedTimeAsync(string path, FtpDate type = FtpDate.Original);
Task SetModifiedTimeAsync(string path, DateTime date, FtpDate type = FtpDate.Original);
#endif


// LISTING

Expand All @@ -109,6 +134,12 @@ public interface IFtpClient : IDisposable {
string[] GetNameListing();
string[] GetNameListing(string path);

#if ASYNC
Task<FtpListItem> GetObjectInfoAsync(string path, bool dateModified = false);
Task<FtpListItem[]> GetListingAsync(string path, FtpListOption options);
Task<string[]> GetNameListingAsync(string path);
#endif


// LOW LEVEL

Expand All @@ -126,6 +157,12 @@ public interface IFtpClient : IDisposable {
Stream OpenAppend(string path, FtpDataType type);
Stream OpenAppend(string path, FtpDataType type, bool checkIfFileExists);

#if ASYNC
Task<Stream> OpenReadAsync(string path, FtpDataType type, long restart, bool checkIfFileExists);
Task<Stream> OpenWriteAsync(string path, FtpDataType type, bool checkIfFileExists);
Task<Stream> OpenAppendAsync(string path, FtpDataType type, bool checkIfFileExists);
#endif


// HIGH LEVEL

Expand Down Expand Up @@ -173,5 +210,17 @@ public interface IFtpClient : IDisposable {
string GetXSHA256(string path);
string GetXSHA512(string path);

#if ASYNC
Task<FtpHashAlgorithm> GetHashAlgorithmAsync();
Task SetHashAlgorithmAsync(FtpHashAlgorithm type);
Task<FtpHash> GetHashAsync(string path);
Task<FtpHash> GetChecksumAsync(string path);
Task<string> GetMD5Async(string path);
Task<string> GetXCRCAsync(string path);
Task<string> GetXMD5Async(string path);
Task<string> GetXSHA1Async(string path);
Task<string> GetXSHA256Async(string path);
Task<string> GetXSHA512Async(string path);
#endif
}
}

0 comments on commit f2bb26a

Please sign in to comment.