Skip to content

Commit 3e5f8b7

Browse files
committed
Merge branch 'upload-chunk-using-merge' into storage-client
2 parents 86d2cfa + 7bc72d9 commit 3e5f8b7

File tree

55 files changed

+494
-720
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+494
-720
lines changed

Directory.Build.props

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
<Project>
2+
3+
<PropertyGroup>
4+
<TargetFramework>net8.0</TargetFramework>
5+
<LangVersion>12</LangVersion>
6+
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7+
<DebugType>embedded</DebugType>
8+
<Nullable>enable</Nullable>
9+
</PropertyGroup>
10+
211
<!--NuGet-->
312
<PropertyGroup>
413
<Authors>ManagedCode</Authors>
@@ -21,6 +30,7 @@
2130
<PackageVersion>2.1.16</PackageVersion>
2231

2332
</PropertyGroup>
33+
2434
<PropertyGroup Condition="'$(GITHUB_ACTIONS)' == 'true'">
2535
<ContinuousIntegrationBuild>true</ContinuousIntegrationBuild>
2636
</PropertyGroup>
@@ -34,4 +44,4 @@
3444
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
3545
</PackageReference>
3646
</ItemGroup>
37-
</Project>
47+
</Project>

ManagedCode.Storage.Aws/ManagedCode.Storage.Aws.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
5-
<LangVersion>11</LangVersion>
6-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7-
<DebugType>embedded</DebugType>
8-
<Nullable>enable</Nullable>
94
<IsPackable>true</IsPackable>
105
</PropertyGroup>
116

@@ -22,10 +17,10 @@
2217
</ItemGroup>
2318

2419
<ItemGroup>
25-
<PackageReference Include="ManagedCode.Communication" Version="2.0.26" />
20+
<PackageReference Include="ManagedCode.Communication" Version="8.0.1" />
2621
<PackageReference Include="AWSSDK.S3" Version="3.7.308.7" />
2722
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
28-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
23+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
2924
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
3025
</ItemGroup>
3126

ManagedCode.Storage.Azure.DataLake/ManagedCode.Storage.Azure.DataLake.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
5-
<LangVersion>11</LangVersion>
6-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7-
<DebugType>embedded</DebugType>
8-
<Nullable>enable</Nullable>
94
<IsPackable>true</IsPackable>
105
</PropertyGroup>
116

@@ -23,10 +18,10 @@
2318

2419
<ItemGroup>
2520
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.18.0" />
26-
<PackageReference Include="ManagedCode.Communication" Version="2.0.26" />
21+
<PackageReference Include="ManagedCode.Communication" Version="8.0.1" />
2722
<PackageReference Include="Azure.Storage.Blobs" Version="12.20.0" />
2823
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
29-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
24+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
3025
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
3126
</ItemGroup>
3227

ManagedCode.Storage.Azure/ManagedCode.Storage.Azure.csproj

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
5-
<LangVersion>11</LangVersion>
6-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7-
<DebugType>embedded</DebugType>
8-
<Nullable>enable</Nullable>
94
<IsPackable>true</IsPackable>
105
</PropertyGroup>
116

@@ -24,10 +19,10 @@
2419
<ItemGroup>
2520
<PackageReference Include="Azure.Identity" Version="1.11.3" />
2621
<PackageReference Include="Azure.Storage.Files.DataLake" Version="12.18.0" />
27-
<PackageReference Include="ManagedCode.Communication" Version="2.0.26" />
22+
<PackageReference Include="ManagedCode.Communication" Version="8.0.1" />
2823
<PackageReference Include="Azure.Storage.Blobs" Version="12.20.0" />
2924
<PackageReference Include="Humanizer.Core" Version="2.14.1" />
30-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.1" />
25+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.1" />
3126
<PackageReference Include="System.Linq.Async" Version="6.0.1" />
3227
</ItemGroup>
3328

ManagedCode.Storage.Client.SignalR/ManagedCode.Storage.Client.SignalR.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
5-
<LangVersion>11</LangVersion>
6-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7-
<DebugType>embedded</DebugType>
8-
<Nullable>enable</Nullable>
94
<IsPackable>true</IsPackable>
105
<OutputType>Library</OutputType>
116
</PropertyGroup>
Lines changed: 26 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,34 @@
1-
using System.IO;
1+
using System;
2+
using System.IO;
23
using System.Threading;
34
using System.Threading.Tasks;
45
using ManagedCode.Communication;
6+
using ManagedCode.Storage.Core;
57
using ManagedCode.Storage.Core.Models;
68

79
namespace ManagedCode.Storage.Client;
810

9-
public interface IStorageClient
11+
public interface IStorageClient : IUploader, IDownloader
1012
{
11-
Task<Result<BlobMetadata>> UploadFile(Stream stream, string apiUrl, string contentName, CancellationToken cancellationToken = default);
12-
Task<Result<BlobMetadata>> UploadFile(FileInfo fileInfo, string apiUrl, string contentName, CancellationToken cancellationToken = default);
13-
Task<Result<BlobMetadata>> UploadFile(byte[] bytes, string apiUrl, string contentName, CancellationToken cancellationToken = default);
14-
Task<Result<BlobMetadata>> UploadFile(string base64, string apiUrl, string contentName, CancellationToken cancellationToken = default);
15-
Task<Result> UploadFileInChunks(Stream file, string apiUrl, int chunkSize, CancellationToken cancellationToken = default);
16-
Task<Result<LocalFile>> DownloadFile(string fileName, string apiUrl, string? path = null, CancellationToken cancellationToken = default);
17-
}
13+
void SetChunkSize(long size);
14+
15+
/// <summary>
16+
/// Event triggered when the progress status changes during an upload or download operation.
17+
/// </summary>
18+
/// <remarks>
19+
/// The event handler receives an argument of type <see cref="ProgressStatus"/> which contains detailed information about the progress of the operation.
20+
/// This includes the file name, progress percentage, total bytes, transferred bytes, elapsed time, remaining time, speed, and any error message.
21+
/// </remarks>
22+
event EventHandler<ProgressStatus> OnProgressStatusChanged;
23+
}
24+
25+
26+
public record ProgressStatus(
27+
string File,
28+
float Progress,
29+
long TotalBytes,
30+
long TransferredBytes,
31+
TimeSpan Elapsed,
32+
TimeSpan Remaining,
33+
string Speed,
34+
string? Error = null);

ManagedCode.Storage.Client/ManagedCode.Storage.Client.csproj

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,6 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4-
<TargetFrameworks>net6.0;net7.0</TargetFrameworks>
5-
<LangVersion>11</LangVersion>
6-
<EnableNETAnalyzers>true</EnableNETAnalyzers>
7-
<DebugType>embedded</DebugType>
8-
<Nullable>enable</Nullable>
94
<IsPackable>true</IsPackable>
105
<OutputType>Library</OutputType>
116
</PropertyGroup>

0 commit comments

Comments
 (0)