Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions .github/workflows/Build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ name: FileSystem [Build]
env:
JAVA_VERSION: 17
JAVA_DISTRIBUTION: microsoft
DOTNET_VERSION: 7.0.x
DOTNET_VERSION: |
3.1.x
6.0.x
7.0.x
8.0.x
DOTNET_BUILD_CONFIGURATION: Release
SONAR_PATH: .\.sonar\scanner
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
Expand Down Expand Up @@ -34,7 +38,7 @@ jobs:
java-version: ${{ env.JAVA_VERSION }}
distribution: ${{ env.JAVA_DISTRIBUTION }}

- name: Setup .NET
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
Expand All @@ -55,7 +59,7 @@ jobs:
- name: Test solution
run: dotnet test --no-build -c ${{ env.DOTNET_BUILD_CONFIGURATION }} --verbosity normal

- name: Cleanup solution
- name: Clean solution
run: dotnet clean

- name: Analyze solution
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/Release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
with:
fetch-depth: 0

- name: Setup .NET
- name: Set up .NET
uses: actions/setup-dotnet@v3
with:
dotnet-version: ${{ env.DOTNET_VERSION }}
Expand Down
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<Project>
<PropertyGroup>
<TargetFrameworks>netstandard2.0;netstandard2.1</TargetFrameworks>
<TargetFrameworks>netstandard2.0;netstandard2.1;net6.0;net7.0;net8.0</TargetFrameworks>
<Nullable>enable</Nullable>
<LangVersion>8.0</LangVersion>
<NoWarn>NU1701</NoWarn>
Expand Down
32 changes: 7 additions & 25 deletions FileSystem.Adapters.AmazonS3/src/AmazonS3Adapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@

namespace SharpGrip.FileSystem.Adapters.AmazonS3
{
public class AmazonS3Adapter : Adapter
public class AmazonS3Adapter : Adapter<AmazonS3AdapterConfiguration, string, string>
{
private readonly IAmazonS3 client;
private readonly string bucketName;

public AmazonS3Adapter(string prefix, string rootPath, IAmazonS3 client, string bucketName) : base(prefix, rootPath)
public AmazonS3Adapter(string prefix, string rootPath, IAmazonS3 client, string bucketName, Action<AmazonS3AdapterConfiguration>? configuration = null) : base(prefix, rootPath, configuration)
{
this.client = client;
this.bucketName = bucketName;
Expand Down Expand Up @@ -61,12 +61,7 @@ public override async Task<IFile> GetFileAsync(string virtualPath, CancellationT

public override async Task<IDirectory> GetDirectoryAsync(string virtualPath, CancellationToken cancellationToken = default)
{
var path = GetPath(virtualPath);

if (!path.EndsWith("/"))
{
path += "/";
}
var path = GetPath(virtualPath).RemoveLeadingForwardSlash().EnsureTrailingForwardSlash();

try
{
Expand Down Expand Up @@ -109,12 +104,7 @@ public override async Task<IDirectory> GetDirectoryAsync(string virtualPath, Can
public override async Task<IEnumerable<IFile>> GetFilesAsync(string virtualPath = "", CancellationToken cancellationToken = default)
{
await GetDirectoryAsync(virtualPath, cancellationToken);
var path = GetPath(virtualPath);

if (!path.EndsWith("/"))
{
path += "/";
}
var path = GetPath(virtualPath).EnsureTrailingForwardSlash();

if (path == "/")
{
Expand All @@ -134,7 +124,6 @@ public override async Task<IEnumerable<IFile>> GetFilesAsync(string virtualPath

foreach (var item in response.S3Objects)
{
// var itemName = item.Key.Substring(0, item.Key.Length - path.Length);
var itemName = item.Key.Substring(path.Length).RemoveLeadingForwardSlash();

if (!item.Key.EndsWith("/") && !itemName.Contains('/'))
Expand All @@ -157,12 +146,7 @@ public override async Task<IEnumerable<IFile>> GetFilesAsync(string virtualPath
public override async Task<IEnumerable<IDirectory>> GetDirectoriesAsync(string virtualPath = "", CancellationToken cancellationToken = default)
{
await GetDirectoryAsync(virtualPath, cancellationToken);
var path = GetPath(virtualPath);

if (!path.EndsWith("/"))
{
path += "/";
}
var path = GetPath(virtualPath).EnsureTrailingForwardSlash();

if (path == "/")
{
Expand Down Expand Up @@ -208,8 +192,7 @@ public override async Task CreateDirectoryAsync(string virtualPath, Cancellation
throw new DirectoryExistsException(GetPath(virtualPath), Prefix);
}

var path = GetPath(virtualPath);
path = path.EndsWith("/") ? path : path + "/";
var path = GetPath(virtualPath).EnsureTrailingForwardSlash();

try
{
Expand All @@ -226,8 +209,7 @@ public override async Task DeleteDirectoryAsync(string virtualPath, Cancellation
{
await GetDirectoryAsync(virtualPath, cancellationToken);

var path = GetPath(virtualPath);
path = path.EndsWith("/") ? path : path + "/";
var path = GetPath(virtualPath).EnsureTrailingForwardSlash();

try
{
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using SharpGrip.FileSystem.Configuration;

namespace SharpGrip.FileSystem.Adapters.AmazonS3
{
public class AmazonS3AdapterConfiguration : AdapterConfiguration
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,12 @@

namespace SharpGrip.FileSystem.Adapters.AzureBlobStorage
{
public class AzureBlobStorageAdapter : Adapter
public class AzureBlobStorageAdapter : Adapter<AzureBlobStorageAdapterConfiguration, string, string>
{
private readonly BlobContainerClient client;

public AzureBlobStorageAdapter(string prefix, string rootPath, BlobContainerClient client) : base(prefix, rootPath)
public AzureBlobStorageAdapter(string prefix, string rootPath, BlobContainerClient client, Action<AzureBlobStorageAdapterConfiguration>? configuration = null)
: base(prefix, rootPath, configuration)
{
this.client = client;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using SharpGrip.FileSystem.Configuration;

namespace SharpGrip.FileSystem.Adapters.AzureBlobStorage
{
public class AzureBlobStorageAdapterConfiguration : AdapterConfiguration
{
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@

namespace SharpGrip.FileSystem.Adapters.AzureFileStorage
{
public class AzureFileStorageAdapter : Adapter
public class AzureFileStorageAdapter : Adapter<AzureFileStorageAdapterConfiguration, string, string>
{
private readonly ShareClient client;

public AzureFileStorageAdapter(string prefix, string rootPath, ShareClient client) : base(prefix, rootPath)
public AzureFileStorageAdapter(string prefix, string rootPath, ShareClient client, Action<AzureFileStorageAdapterConfiguration>? configuration = null) : base(prefix, rootPath, configuration)
{
this.client = client;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using SharpGrip.FileSystem.Configuration;

namespace SharpGrip.FileSystem.Adapters.AzureFileStorage
{
public class AzureFileStorageAdapterConfiguration : AdapterConfiguration
{
}
}
4 changes: 2 additions & 2 deletions FileSystem.Adapters.Dropbox/src/DropboxAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@

namespace SharpGrip.FileSystem.Adapters.Dropbox
{
public class DropboxAdapter : Adapter
public class DropboxAdapter : Adapter<DropboxAdapterConfiguration, string, string>
{
private readonly DropboxClient client;

public DropboxAdapter(string prefix, string rootPath, DropboxClient client) : base(prefix, rootPath)
public DropboxAdapter(string prefix, string rootPath, DropboxClient client, Action<DropboxAdapterConfiguration>? configuration = null) : base(prefix, rootPath, configuration)
{
this.client = client;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using SharpGrip.FileSystem.Configuration;

namespace SharpGrip.FileSystem.Adapters.Dropbox
{
public class DropboxAdapterConfiguration : AdapterConfiguration
{
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<RootNamespace>SharpGrip.FileSystem.Adapters.GoogleDrive</RootNamespace>
</PropertyGroup>

<PropertyGroup>
<AssemblyName>SharpGrip.FileSystem.Adapters.GoogleDrive</AssemblyName>
<PackageId>SharpGrip.FileSystem.Adapters.GoogleDrive</PackageId>
<Title>SharpGrip FileSystem Google Drive adapter</Title>
<Description>The SharpGrip FileSystem Google Drive adapter.</Description>
<PackageTags>sharpgrip;file-system;google-drive</PackageTags>
</PropertyGroup>

<ItemGroup>
<None Include="..\README.md" Pack="true" PackagePath="\" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Google.Apis.Drive.v3" Version="1.62.0.3155" />
</ItemGroup>

<ItemGroup>
<ProjectReference Include="..\FileSystem\FileSystem.csproj"/>
</ItemGroup>

</Project>
Loading