File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -1377,12 +1377,26 @@ await Task.Run(async () =>
1377
1377
client . Host = FtpHelpers . GetFtpHost ( path ) ;
1378
1378
client . Port = FtpHelpers . GetFtpPort ( path ) ;
1379
1379
client . Credentials = FtpManager . Credentials . Get ( client . Host , FtpManager . Anonymous ) ;
1380
+
1381
+ static async Task < FtpProfile > WrappedAutoConnectFtpAsync ( FtpClient client )
1382
+ {
1383
+ try
1384
+ {
1385
+ return await client . AutoConnectAsync ( ) ;
1386
+ }
1387
+ catch ( FtpAuthenticationException )
1388
+ {
1389
+ return null ;
1390
+ }
1391
+
1392
+ throw new InvalidOperationException ( ) ;
1393
+ }
1380
1394
1381
1395
await Task . Run ( async ( ) =>
1382
1396
{
1383
1397
try
1384
1398
{
1385
- if ( ! client . IsConnected && await client . AutoConnectAsync ( ) is null )
1399
+ if ( ! client . IsConnected && await WrappedAutoConnectFtpAsync ( client ) is null )
1386
1400
{
1387
1401
await CoreApplication . MainView . DispatcherQueue . EnqueueAsync ( async ( ) =>
1388
1402
{
@@ -1403,7 +1417,7 @@ await CoreApplication.MainView.DispatcherQueue.EnqueueAsync(async () =>
1403
1417
}
1404
1418
} ) ;
1405
1419
}
1406
- if ( ! client . IsConnected && await client . AutoConnectAsync ( ) is null )
1420
+ if ( ! client . IsConnected && await WrappedAutoConnectFtpAsync ( client ) is null )
1407
1421
{
1408
1422
throw new InvalidOperationException ( ) ;
1409
1423
}
You can’t perform that action at this time.
0 commit comments