Skip to content

Commit

Permalink
add arg validation and remove async for .net core (per robinrodricks#127
Browse files Browse the repository at this point in the history
)
  • Loading branch information
Harsh Gupta committed Jul 25, 2017
1 parent 50d0155 commit 04f70bb
Show file tree
Hide file tree
Showing 17 changed files with 396 additions and 94 deletions.
22 changes: 11 additions & 11 deletions FluentFTP.Tests/Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Collections.Generic;
using System.Text.RegularExpressions;
using System.Linq;
#if (CORE || NETFX45)
#if NETFX45
using System.Threading.Tasks;
#endif
using System.IO.Compression;
Expand Down Expand Up @@ -127,7 +127,7 @@ static void Main(string[] args) {


//Async Tests
#if (CORE || NETFX45)
#if NETFX45
TestAsyncMethods();
#endif

Expand All @@ -139,7 +139,7 @@ static void Main(string[] args) {
// Console.ReadKey();
}

#if (CORE || NETFX45)
#if NETFX45
private static void TestAsyncMethods() {
FtpTrace.WriteLine("Running Async Tests");
List<Task> tasks = new List<Task>() {
Expand Down Expand Up @@ -213,7 +213,7 @@ static void TestListPath() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestListPathAsync()
{
using (FtpClient cl = new FtpClient())
Expand Down Expand Up @@ -258,7 +258,7 @@ static void StreamResponses() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task StreamResponsesAsync()
{
using (FtpClient cl = new FtpClient())
Expand Down Expand Up @@ -330,7 +330,7 @@ static void TestGetObjectInfo() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestGetObjectInfoAsync()
{
using (FtpClient cl = new FtpClient())
Expand Down Expand Up @@ -405,7 +405,7 @@ static void TestServerDownload(FtpClient client, string path) {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestServerDownloadAsync(FtpClient client, string path)
{
foreach (FtpListItem i in await client.GetListingAsync(path))
Expand Down Expand Up @@ -706,7 +706,7 @@ static void TestHash() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestHashAsync()
{
using (FtpClient cl = new FtpClient())
Expand Down Expand Up @@ -1014,7 +1014,7 @@ static void TestUploadDownloadFile() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestUploadDownloadFileAsync()
{

Expand Down Expand Up @@ -1102,7 +1102,7 @@ static void TestUploadDownloadManyFiles() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestUploadDownloadManyFilesAsync()
{

Expand Down Expand Up @@ -1153,7 +1153,7 @@ static void TestUploadDownloadManyFiles2() {
}
}

#if (CORE || NETFX45)
#if NETFX45
static async Task TestUploadDownloadManyFiles2Async()
{

Expand Down
14 changes: 10 additions & 4 deletions FluentFTP/Client/FtpClient_Connection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
#if (CORE || NETFX)
using System.Threading;
#endif
#if (CORE || NETFX45)
#if NETFX45
using System.Threading.Tasks;
#endif

Expand Down Expand Up @@ -858,6 +858,7 @@ public FtpReply Execute(string command) {
return reply;
}

#if !CORE
delegate FtpReply AsyncExecute(string command);

/// <summary>
Expand Down Expand Up @@ -889,8 +890,9 @@ public IAsyncResult BeginExecute(string command, AsyncCallback callback, object
public FtpReply EndExecute(IAsyncResult ar) {
return GetAsyncDelegate<AsyncExecute>(ar).EndInvoke(ar);
}
#endif

#if (CORE || NETFX45)
#if NETFX45
/// <summary>
/// Performs an asynchronous execution of the specified command
/// </summary>
Expand Down Expand Up @@ -1198,6 +1200,7 @@ protected virtual void GetFeatures(FtpReply reply) {
}
}

#if !CORE
delegate void AsyncConnect();

/// <summary>
Expand Down Expand Up @@ -1228,8 +1231,9 @@ public IAsyncResult BeginConnect(AsyncCallback callback, object state) {
public void EndConnect(IAsyncResult ar) {
GetAsyncDelegate<AsyncConnect>(ar).EndInvoke(ar);
}
#endif

#if (CORE || NETFX45)
#if NETFX45
/// <summary>
/// Connects to the server asynchronously
/// </summary>
Expand Down Expand Up @@ -1304,6 +1308,7 @@ public virtual void Disconnect() {
#endif
}

#if !CORE
delegate void AsyncDisconnect();

/// <summary>
Expand Down Expand Up @@ -1334,7 +1339,8 @@ public void EndDisconnect(IAsyncResult ar) {
GetAsyncDelegate<AsyncDisconnect>(ar).EndInvoke(ar);
}

#if (CORE || NETFX45)
#endif
#if NETFX45
/// <summary>
/// Disconnects from the server asynchronously
/// </summary>
Expand Down
Loading

0 comments on commit 04f70bb

Please sign in to comment.