Skip to content

Commit 34e1974

Browse files
authored
Bump FluentFTP from 36.1.0 to 39.3.0 dependencies (#9744)
* Make zip dict concurrent (478794293u) * Update FluentFTP to 39.3.0
1 parent 067bade commit 34e1974

File tree

9 files changed

+28
-47
lines changed

9 files changed

+28
-47
lines changed

src/Files.Sdk.Storage/Files - Backup.Sdk.Storage.csproj

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Files.Uwp.Storage/Files.Uwp.Storage.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@
128128
</ItemGroup>
129129
<ItemGroup>
130130
<PackageReference Include="FluentFTP">
131-
<Version>37.1.0</Version>
131+
<Version>39.3.0</Version>
132132
</PackageReference>
133133
<PackageReference Include="Microsoft.NETCore.UniversalWindowsPlatform">
134134
<Version>6.2.13</Version>

src/Files.Uwp.Storage/FtpStorage/FtpFileSystemService.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public async Task<ILocatableFolder> GetFolderFromPathAsync(string path, Cancella
5050

5151
var ftpPath = FtpHelpers.GetFtpPath(path);
5252
var item = await ftpClient.GetObjectInfoAsync(ftpPath, token: cancellationToken);
53-
if (item is null || item.Type != FtpFileSystemObjectType.Directory)
53+
if (item is null || item.Type != FtpObjectType.Directory)
5454
throw new DirectoryNotFoundException("Directory was not found from path.");
5555

5656
return new FtpStorageFolder(ftpPath, item.Name);
@@ -63,7 +63,7 @@ public async Task<ILocatableFile> GetFileFromPathAsync(string path, Cancellation
6363

6464
var ftpPath = FtpHelpers.GetFtpPath(path);
6565
var item = await ftpClient.GetObjectInfoAsync(ftpPath, token: cancellationToken);
66-
if (item is null || item.Type != FtpFileSystemObjectType.File)
66+
if (item is null || item.Type != FtpObjectType.File)
6767
throw new FileNotFoundException("File was not found from path.");
6868

6969
return new FtpStorageFile(ftpPath, item.Name);

src/Files.Uwp.Storage/FtpStorage/FtpStorageFolder.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public async Task<IFile> GetFileAsync(string fileName, CancellationToken cancell
3232
var path = FtpHelpers.GetFtpPath(PathHelpers.Combine(Path, fileName));
3333
var item = await ftpClient.GetObjectInfoAsync(path, token: cancellationToken);
3434

35-
if (item is null || item.Type != FtpFileSystemObjectType.File)
35+
if (item is null || item.Type != FtpObjectType.File)
3636
throw new FileNotFoundException();
3737

3838
return new FtpStorageFile(path, item.Name);
@@ -48,7 +48,7 @@ public async Task<IFolder> GetFolderAsync(string folderName, CancellationToken c
4848
var item = await ftpClient.GetObjectInfoAsync(path, token: cancellationToken);
4949

5050

51-
if (item is null || item.Type != FtpFileSystemObjectType.Directory)
51+
if (item is null || item.Type != FtpObjectType.Directory)
5252
throw new DirectoryNotFoundException();
5353

5454
return new FtpStorageFolder(path, item.Name);
@@ -64,26 +64,26 @@ public async IAsyncEnumerable<IStorable> GetItemsAsync(StorableKind kind = Stora
6464
{
6565
foreach (var item in await ftpClient.GetListingAsync(Path, cancellationToken))
6666
{
67-
if (item.Type == FtpFileSystemObjectType.File)
67+
if (item.Type == FtpObjectType.File)
6868
yield return new FtpStorageFile(item.FullName, item.Name);
6969
}
7070
}
7171
else if (kind == StorableKind.Folders)
7272
{
7373
foreach (var item in await ftpClient.GetListingAsync(Path, cancellationToken))
7474
{
75-
if (item.Type == FtpFileSystemObjectType.Directory)
75+
if (item.Type == FtpObjectType.Directory)
7676
yield return new FtpStorageFolder(item.FullName, item.Name);
7777
}
7878
}
7979
else
8080
{
8181
foreach (var item in await ftpClient.GetListingAsync(Path, cancellationToken))
8282
{
83-
if (item.Type == FtpFileSystemObjectType.File)
83+
if (item.Type == FtpObjectType.File)
8484
yield return new FtpStorageFile(item.FullName, item.Name);
8585

86-
if (item.Type == FtpFileSystemObjectType.Directory)
86+
if (item.Type == FtpObjectType.Directory)
8787
yield return new FtpStorageFolder(item.FullName, item.Name);
8888
}
8989
}
@@ -156,7 +156,7 @@ public async Task<IFile> CreateFileAsync(string desiredName, CreationCollisionOp
156156

157157
using var stream = new MemoryStream();
158158
var replaceExisting = collisionOption == CreationCollisionOption.ReplaceExisting;
159-
var result = await ftpClient.UploadAsync(stream, newPath, replaceExisting ? FtpRemoteExists.Overwrite : FtpRemoteExists.Skip, token: cancellationToken);
159+
var result = await ftpClient.UploadStreamAsync(stream, newPath, replaceExisting ? FtpRemoteExists.Overwrite : FtpRemoteExists.Skip, token: cancellationToken);
160160

161161
if (result == FtpStatus.Success)
162162
{

src/Files.Uwp/Files.Uwp.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1550,7 +1550,7 @@
15501550
<Version>8.0.0</Version>
15511551
</PackageReference>
15521552
<PackageReference Include="FluentFTP">
1553-
<Version>36.1.0</Version>
1553+
<Version>39.3.0</Version>
15541554
</PackageReference>
15551555
<PackageReference Include="ini-parser-netstandard">
15561556
<Version>2.5.2</Version>

src/Files.Uwp/Filesystem/ListedItem.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -473,7 +473,7 @@ public class FtpItem : ListedItem
473473
{
474474
public FtpItem(FtpListItem item, string folder) : base(null)
475475
{
476-
var isFile = item.Type == FtpFileSystemObjectType.File;
476+
var isFile = item.Type == FtpObjectType.File;
477477
ItemDateCreatedReal = item.RawCreated < DateTime.FromFileTimeUtc(0) ? DateTimeOffset.MinValue : item.RawCreated;
478478
ItemDateModifiedReal = item.RawModified < DateTime.FromFileTimeUtc(0) ? DateTimeOffset.MinValue : item.RawModified;
479479
ItemNameRaw = item.Name;

src/Files.Uwp/Filesystem/StorageItems/FtpStorageFile.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -102,13 +102,13 @@ public override IAsyncOperation<IRandomAccessStream> OpenAsync(FileAccessMode ac
102102

103103
if (accessMode is FileAccessMode.Read)
104104
{
105-
var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken);
105+
var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken);
106106
return new NonSeekableRandomAccessStreamForRead(inStream, (ulong)inStream.Length)
107107
{
108108
DisposeCallback = ftpClient.Dispose
109109
};
110110
}
111-
return new NonSeekableRandomAccessStreamForWrite(await ftpClient.OpenWriteAsync(FtpPath, cancellationToken))
111+
return new NonSeekableRandomAccessStreamForWrite(await ftpClient.OpenWriteAsync(FtpPath, token: cancellationToken))
112112
{
113113
DisposeCallback = ftpClient.Dispose
114114
};
@@ -126,7 +126,7 @@ public override IAsyncOperation<IRandomAccessStreamWithContentType> OpenReadAsyn
126126
return null;
127127
}
128128

129-
var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken);
129+
var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken);
130130
var nsStream = new NonSeekableRandomAccessStreamForRead(inStream, (ulong)inStream.Length) { DisposeCallback = ftpClient.Dispose };
131131
return new StreamWithContentType(nsStream);
132132
});
@@ -141,7 +141,7 @@ public override IAsyncOperation<IInputStream> OpenSequentialReadAsync()
141141
return null;
142142
}
143143

144-
var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken);
144+
var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken);
145145
return new InputStreamWithDisposeCallback(inStream) { DisposeCallback = () => ftpClient.Dispose() };
146146
});
147147
}
@@ -167,14 +167,14 @@ public override IAsyncOperation<BaseStorageFile> CopyAsync(IStorageFolder destin
167167

168168
if (destFolder is ICreateFileWithStream cwsf)
169169
{
170-
using var inStream = await ftpClient.OpenReadAsync(FtpPath, cancellationToken);
170+
using var inStream = await ftpClient.OpenReadAsync(FtpPath, token: cancellationToken);
171171
return await cwsf.CreateFileAsync(inStream, desiredNewName, option.Convert());
172172
}
173173
else
174174
{
175175
BaseStorageFile file = await destFolder.CreateFileAsync(desiredNewName, option.Convert());
176176
using var stream = await file.OpenStreamForWriteAsync();
177-
return await ftpClient.DownloadAsync(stream, FtpPath, token: cancellationToken) ? file : null;
177+
return await ftpClient.DownloadStreamAsync(stream, FtpPath, token: cancellationToken) ? file : null;
178178
}
179179
});
180180
}
@@ -250,7 +250,7 @@ private async void FtpDataStreamingHandler(StreamedFileDataRequest request)
250250

251251
using (var outStream = request.AsStreamForWrite())
252252
{
253-
await ftpClient.DownloadAsync(outStream, FtpPath);
253+
await ftpClient.DownloadStreamAsync(outStream, FtpPath);
254254
await outStream.FlushAsync();
255255
}
256256
request.Dispose();

src/Files.Uwp/Filesystem/StorageItems/FtpStorageFolder.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,11 +93,11 @@ public override IAsyncOperation<IStorageItem> GetItemAsync(string name)
9393
var item = await ftpClient.GetObjectInfoAsync(FtpHelpers.GetFtpPath(PathNormalization.Combine(Path, name)));
9494
if (item is not null)
9595
{
96-
if (item.Type is FtpFileSystemObjectType.File)
96+
if (item.Type is FtpObjectType.File)
9797
{
9898
return new FtpStorageFile(Path, item);
9999
}
100-
if (item.Type is FtpFileSystemObjectType.Directory)
100+
if (item.Type is FtpObjectType.Directory)
101101
{
102102
return new FtpStorageFolder(Path, item);
103103
}
@@ -133,11 +133,11 @@ public override IAsyncOperation<IReadOnlyList<IStorageItem>> GetItemsAsync()
133133
var list = await ftpClient.GetListingAsync(FtpPath);
134134
foreach (var item in list)
135135
{
136-
if (item.Type is FtpFileSystemObjectType.File)
136+
if (item.Type is FtpObjectType.File)
137137
{
138138
items.Add(new FtpStorageFile(Path, item));
139139
}
140-
else if (item.Type is FtpFileSystemObjectType.Directory)
140+
else if (item.Type is FtpObjectType.Directory)
141141
{
142142
items.Add(new FtpStorageFolder(Path, item));
143143
}
@@ -186,7 +186,7 @@ public override IAsyncOperation<BaseStorageFile> CreateFileAsync(string desiredN
186186
string remotePath = $"{FtpPath}/{desiredName}";
187187
var ftpRemoteExists = options is CreationCollisionOption.ReplaceExisting ? FtpRemoteExists.Overwrite : FtpRemoteExists.Skip;
188188

189-
var result = await ftpClient.UploadAsync(stream, remotePath, ftpRemoteExists);
189+
var result = await ftpClient.UploadStreamAsync(stream, remotePath, ftpRemoteExists);
190190
if (result is FtpStatus.Success)
191191
{
192192
return new FtpStorageFile(new StorageFileWithPath(null, $"{Path}/{desiredName}"));

src/Files.Uwp/Filesystem/StorageItems/ZipStorageFolder.cs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
using SevenZip;
66
using System;
77
using System.Collections.Generic;
8+
using System.Collections.Concurrent;
89
using System.IO;
910
using System.Linq;
1011
using System.Runtime.InteropServices.WindowsRuntime;
@@ -72,7 +73,7 @@ public static bool IsZipPath(string path, bool includeRoot = true)
7273
return (marker == path.Length && includeRoot) || (marker < path.Length && path[marker] is '\\');
7374
}
7475

75-
private static Dictionary<string, Task<bool>> defaultAppDict = new Dictionary<string, Task<bool>>();
76+
private static ConcurrentDictionary<string, Task<bool>> defaultAppDict = new();
7677
public static async Task<bool> CheckDefaultZipApp(string filePath)
7778
{
7879
Func<Task<bool>> queryFileAssoc = async () =>
@@ -81,11 +82,11 @@ public static async Task<bool> CheckDefaultZipApp(string filePath)
8182
if (assoc != null)
8283
{
8384
return assoc == Package.Current.Id.FamilyName
84-
|| assoc.Equals(System.IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"), StringComparison.OrdinalIgnoreCase);
85+
|| assoc.Equals(IO.Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.Windows), "explorer.exe"), StringComparison.OrdinalIgnoreCase);
8586
}
8687
return true;
8788
};
88-
var ext = System.IO.Path.GetExtension(filePath)?.ToLowerInvariant();
89+
var ext = IO.Path.GetExtension(filePath)?.ToLowerInvariant();
8990
return await defaultAppDict.GetAsync(ext, queryFileAssoc);
9091
}
9192

0 commit comments

Comments
 (0)