Update to latest FluentFTP version

This commit is contained in:
Rick Brown
2023-10-08 18:23:11 -04:00
parent c16eeff130
commit c8abb4d76a
2 changed files with 45 additions and 35 deletions

View File

@@ -1,18 +1,18 @@
#if !NoNet
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Net;
using System.Reflection;
using System.Threading;
using Android.Content;
using Android.OS;
using Android.Preferences;
using FluentFTP;
using FluentFTP.Exceptions;
using KeePassLib;
using KeePassLib.Serialization;
using KeePassLib.Utility;
namespace keepass2android.Io
{
public class NetFtpFileStorage: IFileStorage
@@ -138,7 +138,7 @@ namespace keepass2android.Io
var settings = ConnectionSettings.FromIoc(ioc);
FtpClient client = new FtpClient();
client.RetryAttempts = 3;
client.Config.RetryAttempts = 3;
if ((settings.Username.Length > 0) || (settings.Password.Length > 0))
client.Credentials = new NetworkCredential(settings.Username, settings.Password);
else
@@ -154,7 +154,7 @@ namespace keepass2android.Io
args.Accept = _app.CertificateValidationCallback(control, args.Certificate, args.Chain, args.PolicyErrors);
};
client.EncryptionMode = settings.EncryptionMode;
client.Config.EncryptionMode = settings.EncryptionMode;
client.Connect();
return client;
@@ -290,12 +290,11 @@ namespace keepass2android.Io
{
List<FileDescription> files = new List<FileDescription>();
foreach (FtpListItem item in client.GetListing(IocToLocalPath(ioc),
FtpListOption.Modify | FtpListOption.Size | FtpListOption.DerefLinks))
FtpListOption.SizeModify | FtpListOption.AllFiles))
{
switch (item.Type)
{
case FtpFileSystemObjectType.Directory:
case FtpObjectType.Directory:
files.Add(new FileDescription()
{
CanRead = true,
@@ -306,7 +305,7 @@ namespace keepass2android.Io
Path = IocPathFromUri(ioc, item.FullName)
});
break;
case FtpFileSystemObjectType.File:
case FtpObjectType.File:
files.Add(new FileDescription()
{
CanRead = true,
@@ -318,7 +317,9 @@ namespace keepass2android.Io
SizeInBytes = item.Size
});
break;
default:
Kp2aLog.Log("FTP: ListContents item skipped: " + IocToUri(ioc) + ": " + item.FullName + ", type=" + item.Type);
break;
}
}
return files;
@@ -330,7 +331,6 @@ namespace keepass2android.Io
}
}
public FileDescription GetFileDescription(IOConnectionInfo ioc)
{
try
@@ -466,7 +466,9 @@ namespace keepass2android.Io
public static int GetDefaultPort(FtpEncryptionMode encryption)
{
return new FtpClient() { EncryptionMode = encryption}.Port;
var client = new FtpClient();
client.Config.EncryptionMode = encryption;
return client.Port;
}
public string BuildFullPath(string host, int port, string initialPath, string user, string password, FtpEncryptionMode encryption)
@@ -582,5 +584,13 @@ namespace keepass2android.Io
_stream.Close();
}
}
class Kp2aLogFTPLogger : IFtpLogger
{
public void Log(FtpLogEntry entry)
{
Kp2aLog.Log("FluentFTP: " + entry.Message);
}
}
}
#endif

View File

@@ -182,7 +182,7 @@
</ItemGroup>
<ItemGroup Condition=" '$(Flavor)'!='NoNet' ">
<PackageReference Include="FluentFTP">
<Version>31.3.1</Version>
<Version>48.0.0</Version>
</PackageReference>
<PackageReference Include="MegaApiClient">
<Version>1.10.3</Version>