13
13
using System . Threading . Tasks ;
14
14
using System . Windows . Forms ;
15
15
using ARKBreedingStats . utils ;
16
+ using FluentFTP . Exceptions ;
16
17
17
18
namespace ARKBreedingStats
18
19
{
@@ -176,7 +177,7 @@ await ImportSavegame.ImportCollectionFromSavegame(_creatureCollection, workingCo
176
177
}
177
178
}
178
179
}
179
- var client = new FtpClient ( ftpUri . Host , ftpUri . Port , credentials . Username , credentials . Password ) ;
180
+ var client = new AsyncFtpClient ( ftpUri . Host , credentials . Username , credentials . Password , ftpUri . Port ) ;
180
181
string ftpPath = null ;
181
182
182
183
try
@@ -193,7 +194,7 @@ await ImportSavegame.ImportCollectionFromSavegame(_creatureCollection, workingCo
193
194
// TaskCanceledException
194
195
// on cancelling it throws
195
196
// Cannot access a disposed object. Object name: 'System.Net.Sockets.Socket'.
196
- await client . ConnectAsync ( token : cancellationTokenSource . Token ) ;
197
+ await client . Connect ( token : cancellationTokenSource . Token ) ;
197
198
198
199
progressDialog . StatusText = "Finding most recent file" ;
199
200
await Task . Yield ( ) ;
@@ -219,7 +220,7 @@ await ImportSavegame.ImportCollectionFromSavegame(_creatureCollection, workingCo
219
220
await Task . Yield ( ) ;
220
221
221
222
var filePath = Path . Combine ( workingCopyFolder , Path . GetFileName ( ftpPath ) ) ;
222
- await client . DownloadFileAsync ( filePath , ftpPath , FtpLocalExists . Overwrite , FtpVerify . Retry , progressDialog , token : cancellationTokenSource . Token ) ;
223
+ await client . DownloadFile ( filePath , ftpPath , FtpLocalExists . Overwrite , FtpVerify . Retry , progressDialog , token : cancellationTokenSource . Token ) ;
223
224
await Task . Delay ( 500 , cancellationTokenSource . Token ) ;
224
225
225
226
if ( filePath . EndsWith ( ".gz" ) )
@@ -302,10 +303,10 @@ private async Task<string> DecompressGZippedFileAsync(string filePath, Cancellat
302
303
return newFileName ;
303
304
}
304
305
305
- public async Task < FtpListItem > GetLastModifiedFileAsync ( FtpClient client , Uri ftpUri , string fileRegex , CancellationToken cancellationToken )
306
+ public async Task < FtpListItem > GetLastModifiedFileAsync ( AsyncFtpClient client , Uri ftpUri , string fileRegex , CancellationToken cancellationToken )
306
307
{
307
308
var folderUri = new Uri ( ftpUri , "." ) ;
308
- var listItems = await client . GetListingAsync ( folderUri . AbsolutePath , cancellationToken ) ;
309
+ var listItems = await client . GetListing ( folderUri . AbsolutePath , cancellationToken ) ;
309
310
310
311
Regex fileNameRegex ;
311
312
if ( ! fileRegex . Contains ( "(?<" ) )
0 commit comments