Skip to content

Commit 811f592

Browse files
authored
Breaking Change: Update dependencies (#3)
* breaking changes: Bump version to v2.0.0 breaking change(VirtualFileSystem): Update dependencies * Microsoft.Extensions.FileProviders.Composite v6 => v7.0.0 * Microsoft.Extensions.FileProviders.Embedded v6 => v7.0.0 * Microsoft.Extensions.FileProviders.Physical" v6 => v7.0.0 * Microsoft.Extensions.Options v6 => v7.0.0 chore: Update .editorconfig breaking change(VirtualFileSystem.Tests): Update dependencies * Microsoft.Extensions.DependencyInjection v6 => v7.0.0 * Microsoft.Extensions.Logging.Abstractions v6 => v7.0.0 * Microsoft.NET.Test.Sdk v17.2.0 => v17.4.1 * NUnit3TestAdapter v4.2.1. => 4.3.1 chore: Update GitHub action chore: disable warnings CS8766, CS1591 chore: Refacturing using latest language featrues * chore: Update depreciated GitHub actions * use actions/checkout@v3 * use actions/setup-dotnet@v2 * chore: Create artifacts with GitHub action
1 parent 4ec859e commit 811f592

File tree

13 files changed

+101
-57
lines changed

13 files changed

+101
-57
lines changed

.github/workflows/dotnet.yml

Lines changed: 32 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,50 @@ name: .NET
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ main, 'version/**', 'pr/**', 'pr-**' ]
6+
paths-ignore:
7+
- '**/*.md'
68
pull_request:
7-
branches: [ main ]
9+
branches: [ main, 'version/**', 'pr/**', 'pr-**' ]
10+
types: [opened, synchronize, reopened]
11+
paths-ignore:
12+
- '**/*.md'
813

914
jobs:
1015
build:
11-
12-
runs-on: ubuntu-latest
16+
name: Build
17+
runs-on: ${{ matrix.os }}
18+
env:
19+
version: '2.0.0'
20+
versionFile: '2.0.0'
21+
packDotNetVersion: '6'
1322
strategy:
1423
matrix:
15-
dotnet-version: [ '3.1.x', '5.0.x' ]
24+
os: [ ubuntu-latest ]
25+
dotnet-version: [ '3.x', '6.x' ]
1626

1727
steps:
18-
- uses: actions/checkout@v2
28+
- name: Checkout
29+
uses: actions/checkout@v3
1930
- name: Setup .NET
20-
uses: actions/setup-dotnet@v1
31+
uses: actions/setup-dotnet@v3
32+
with:
33+
dotnet-version: ${{ matrix.dotnet-version }}
2134
- name: Restore dependencies
2235
run: dotnet restore ./Src/VirtualFileSystem.sln
2336
- name: Build
2437
run: dotnet build --no-restore ./Src/VirtualFileSystem.sln
2538
- name: Test
2639
run: dotnet test --no-build --verbosity normal ./Src/VirtualFileSystem.sln
40+
- name: Pack
41+
if: startsWith(matrix.dotnet-version, env.packDotNetVersion)
42+
run: |
43+
echo "Packing Version: ${{ env.version }}, File Version: ${{ env.versionFile }}"
44+
dotnet build ./Src/VirtualFileSystem.sln /verbosity:minimal --configuration release /p:IncludeSymbols=true /p:SymbolPackageFormat=snupkg /p:ContinuousIntegrationBuild=true /p:PackageOutputPath=${{ github.workspace }}/artifacts/ /p:Version=${{ env.version }} /p:FileVersion=${{ env.versionFile }}
45+
dotnet pack ./Src/VirtualFileSystem.sln /verbosity:minimal --configuration release
46+
- name: Upload Artifacts
47+
uses: actions/upload-artifact@v3
48+
if: startsWith(matrix.dotnet-version, env.packDotNetVersion)
49+
with:
50+
name: Packages_${{ env.version }}
51+
path: ${{ github.workspace }}/artifacts/

COPYRIGHT.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
# Copyright
22

3-
© 2013 - 2020 [Volosoft](https://volosoft.com/) Open source license with [LGPLv3.0](LICENSE.md)
3+
© 2013 - 2023 [Volosoft](https://volosoft.com/) Open source license with [LGPLv3.0](LICENSE.md)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,19 +6,19 @@
66

77
The Virtual File System makes it possible to manage files that do not exist on a physical file system (e.g. disk).
88

9-
* The ```VirtualFileSystem``` can be extended by additional ```IVirtualFileProvider```s.
10-
* Out-of-the-box, ```Microsoft.Extensions.FileProviders.Composite```, ```Microsoft.Extensions.FileProviders.Embedded``` and ```Microsoft.Extensions.FileProviders.Physical``` are integrated.
9+
* The `VirtualFileSystem` can be extended by additional `IVirtualFileProvider`s.
10+
* Out-of-the-box, `Microsoft.Extensions.FileProviders.Composite`, `Microsoft.Extensions.FileProviders.Embedded` and `Microsoft.Extensions.FileProviders.Physical` are integrated.
1111
* Virtual files can be used just like static files in an application.
1212
* JavaScript, CSS, image files and all other file types can be embedded into assemblies and used just like the static files.
1313
* An application (or library) can override an embedded file just by placing a static file with the same name and extension into the same folder of the virtual file system.
1414

1515

16-
The library is a modified version of [Volo.Abp.VirtualFileSystem](https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.VirtualFileSystem) 4.1
17-
Modifications to the source code were made by axuno in 2020/21. Changes focused on:
16+
The library is a modified version of [Volo.Abp.VirtualFileSystem](https://github.com/abpframework/abp/tree/dev/framework/src/Volo.Abp.VirtualFileSystem) 7.0
17+
Modifications to the source code were made by axuno in 2020-23. Changes focused on:
1818

1919
* Decouple Volo.Abp.VirtualFileSystem from all dependencies of the Abp Framework
2020
* Use Microsoft DependencyInjection instead of [AutoFac](https://autofac.org/)
21-
* Add a workaround, so that ```VirtualFileProvider``` will also find existing directories returned from ```PhysicalFileProvider```. This means, that ```VirtualFileProvider``` behaves the same, never mind whether files are retrieved using ```EmbeddedFileProvider``` or ```PhysicalFileProvider```.
21+
* Add a workaround, so that `VirtualFileProvider` will also find existing directories returned from `PhysicalFileProvider`. This means, that `VirtualFileProvider` behaves the same, never mind whether files are retrieved using `EmbeddedFileProvider` or `PhysicalFileProvider`.
2222
* Change of namespaces
2323

2424
### Get started

Src/.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ dotnet_style_qualification_for_property = false:suggestion
147147
csharp_indent_labels = one_less_than_current
148148
csharp_using_directive_placement = outside_namespace:silent
149149
csharp_prefer_simple_using_statement = true:suggestion
150-
csharp_style_namespace_declarations = block_scoped:silent
150+
csharp_style_namespace_declarations = file_scoped:silent
151151
csharp_style_expression_bodied_operators = false:silent
152152
csharp_style_expression_bodied_indexers = true:silent
153153
csharp_style_expression_bodied_lambdas = true:silent

Src/Axuno.VirtualFileSystem.Tests/Axuno.VirtualFileSystem.Tests.csproj

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44
<OutputType>Exe</OutputType>
55
<TargetFrameworks>net60</TargetFrameworks>
66
<SignAssembly>true</SignAssembly>
7-
<Nullable>enable</Nullable>
8-
<LangVersion>latest</LangVersion>
97
<AssemblyOriginatorKeyFile>..\Axuno.VirtualFileSystem\Axuno.VirtualFileSystem.snk</AssemblyOriginatorKeyFile>
108
</PropertyGroup>
119

@@ -23,11 +21,11 @@
2321
</ItemGroup>
2422

2523
<ItemGroup>
26-
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
27-
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="6.0.1" />
28-
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
24+
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="7.0.0" />
25+
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="7.0.0" />
26+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
2927
<PackageReference Include="NUnit" Version="3.13.3" />
30-
<PackageReference Include="NUnit3TestAdapter" Version="4.2.1" />
28+
<PackageReference Include="NUnit3TestAdapter" Version="4.3.1" />
3129
</ItemGroup>
3230

3331
<ItemGroup>

Src/Axuno.VirtualFileSystem/Axuno.VirtualFileSystem.csproj

Lines changed: 10 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,26 @@
33
<PropertyGroup>
44
<TargetFrameworks>netstandard2.1;net60</TargetFrameworks>
55
<Nullable>enable</Nullable>
6-
<LangVersion>latest</LangVersion>
6+
<NoWarn>$(NoWarn);1591</NoWarn>
77
<SignAssembly>true</SignAssembly>
88
<!-- sn -k Axuno.VirtualFileSystem.snk -->
99
<AssemblyOriginatorKeyFile>Axuno.VirtualFileSystem.snk</AssemblyOriginatorKeyFile>
10-
<Version>1.0.1</Version>
11-
<Authors>axuno gGmbH</Authors>
12-
<Company>axuno gGmbH</Company>
1310
<PackageLicenseExpression>LGPL-3.0-only</PackageLicenseExpression>
14-
<PackageIcon>VirtualFileSystem.png</PackageIcon>
1511
<RepositoryUrl>https://github.com/axuno/Axuno.VirtualFileSystem</RepositoryUrl>
1612
<RepositoryType>Git</RepositoryType>
13+
<PublishRepositoryUrl>true</PublishRepositoryUrl>
14+
<PackageIcon>VirtualFileSystem.png</PackageIcon>
1715
<PackageTags>virtual file system netstandard c#</PackageTags>
18-
<PackageReleaseNotes>Fixed possible null reference issues
19-
Bumped to v1.0.1</PackageReleaseNotes>
20-
<Copyright>© 2013 - 2021 Volosoft. Open source license with LGPLv3.0</Copyright>
16+
<PackageReleaseNotes>Bumped to v2.0.0
17+
Breaking changes caused by updated dependencies</PackageReleaseNotes>
2118
<Description>The Virtual File System makes it possible to manage files that do not exist on a physical file system (e.g. disk).
2219

2320
* The VirtualFileSystem can be extended by additional IVirtualFileProviders.
2421
* Out-of-the-box, Microsoft.Extensions.FileProviders.Composite, Microsoft.Extensions.FileProviders.Embedded and Microsoft.Extensions.FileProviders.Physical are integrated.
2522
* Virtual files can be used just like static files in an application.
2623
* JavaScript, CSS, image files and all other file types can be embedded into assemblies and used just like the static files.
2724

28-
The library is a modified version of Volo.Abp.VirtualFileSystem 4.2</Description>
25+
The library is a modified version of Volo.Abp.VirtualFileSystem 7.0</Description>
2926
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
3027
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
3128
</PropertyGroup>
@@ -47,10 +44,10 @@ The library is a modified version of Volo.Abp.VirtualFileSystem 4.2</Description
4744
</PropertyGroup>
4845

4946
<ItemGroup>
50-
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="6.0.0" />
51-
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="6.0.5" />
52-
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="6.0.0" />
53-
<PackageReference Include="Microsoft.Extensions.Options" Version="6.0.0" />
47+
<PackageReference Include="Microsoft.Extensions.FileProviders.Composite" Version="7.0.0" />
48+
<PackageReference Include="Microsoft.Extensions.FileProviders.Embedded" Version="7.0.1" />
49+
<PackageReference Include="Microsoft.Extensions.FileProviders.Physical" Version="7.0.0" />
50+
<PackageReference Include="Microsoft.Extensions.Options" Version="7.0.0" />
5451
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.1.1">
5552
<PrivateAssets>all</PrivateAssets>
5653
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>

Src/Axuno.VirtualFileSystem/DictionaryBasedFileProvider.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ public virtual IFileInfo GetFileInfo(string subPath)
1212
{
1313
if (subPath == null)
1414
{
15-
return new NotFoundFileInfo(subPath);
15+
return new NotFoundFileInfo(subPath ?? "(null)");
1616
}
1717

1818
var file = Files.GetOrDefault(NormalizePath(subPath));
@@ -44,8 +44,8 @@ public virtual IDirectoryContents GetDirectoryContents(string subPath)
4444
continue;
4545
}
4646

47-
var relativePath = fullPath.Substring(directoryPath.Length);
48-
if (relativePath.Contains("/"))
47+
var relativePath = fullPath[directoryPath.Length..];
48+
if (relativePath.Contains('/'))
4949
{
5050
continue;
5151
}

Src/Axuno.VirtualFileSystem/Embedded/EmbeddedFileProvider.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public void AddFiles(Dictionary<string, IFileInfo> files)
4141

4242
var fullPath = ConvertToRelativePath(resourcePath).EnsureStartsWith('/');
4343

44-
if (fullPath.Contains("/"))
44+
if (fullPath.Contains('/'))
4545
{
46-
AddDirectoriesRecursively(files, fullPath.Substring(0, fullPath.LastIndexOf('/')), lastModificationTime);
46+
AddDirectoriesRecursively(files, fullPath[..fullPath.LastIndexOf('/')], lastModificationTime);
4747
}
4848

4949
files[fullPath] = new EmbeddedResourceFileInfo(
@@ -69,9 +69,9 @@ private static void AddDirectoriesRecursively(Dictionary<string, IFileInfo> file
6969
lastModificationTime
7070
);
7171

72-
if (directoryPath.Contains("/"))
72+
if (directoryPath.Contains('/'))
7373
{
74-
AddDirectoriesRecursively(files, directoryPath.Substring(0, directoryPath.LastIndexOf('/')), lastModificationTime);
74+
AddDirectoriesRecursively(files, directoryPath[..directoryPath.LastIndexOf('/')], lastModificationTime);
7575
}
7676
}
7777

@@ -100,7 +100,7 @@ private string ConvertToRelativePath(string resourceName)
100100
{
101101
if (!BaseNamespace.IsNullOrEmpty())
102102
{
103-
resourceName = resourceName.Substring(BaseNamespace.Length + 1);
103+
resourceName = resourceName[(BaseNamespace.Length + 1)..];
104104
}
105105

106106
var pathParts = resourceName.Split('.');
@@ -110,19 +110,19 @@ private string ConvertToRelativePath(string resourceName)
110110
}
111111

112112
var folder = string.Join("/", pathParts.Take(pathParts.Length - 2));
113-
var fileName = pathParts[pathParts.Length - 2] + "." + pathParts[pathParts.Length - 1];
113+
var fileName = pathParts[^2] + "." + pathParts[^1];
114114

115115
return folder + "/" + fileName;
116116
}
117117

118118
private static string CalculateFileName(string filePath)
119119
{
120-
if (!filePath.Contains("/"))
120+
if (!filePath.Contains('/'))
121121
{
122122
return filePath;
123123
}
124124

125-
return filePath.Substring(filePath.LastIndexOf("/", StringComparison.Ordinal) + 1);
125+
return filePath[(filePath.LastIndexOf("/", StringComparison.Ordinal) + 1)..];
126126
}
127127

128128
protected override string NormalizePath(string subpath)
@@ -136,4 +136,4 @@ private Dictionary<string, IFileInfo> CreateFiles()
136136
AddFiles(files);
137137
return files;
138138
}
139-
}
139+
}

Src/Axuno.VirtualFileSystem/Embedded/EmbeddedResourceFileInfo.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,10 +67,12 @@ public long Length
6767
private readonly string _resourcePath;
6868

6969
/// <inheritdoc />
70+
#pragma warning disable CS8766
7071
public Stream? CreateReadStream()
7172
{
73+
#pragma warning restore CS8766
7274
var stream = _assembly.GetManifestResourceStream(_resourcePath);
73-
75+
7476
if (!_length.HasValue && stream != null)
7577
{
7678
_length = stream.Length;
@@ -81,6 +83,6 @@ public long Length
8183

8284
public override string ToString()
8385
{
84-
return $"[EmbeddedResourceFileInfo] {Name} ({this.VirtualPath})";
86+
return $"[EmbeddedResourceFileInfo] {Name} ({VirtualPath})";
8587
}
86-
}
88+
}

Src/Axuno.VirtualFileSystem/StringExtensions.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ public static string Left(this string str, int len)
7171
throw new ArgumentException("len argument can not be bigger than given string's length!");
7272
}
7373

74-
return str.Substring(0, len);
74+
return str[..len];
7575
}
7676

7777
/// <summary>
@@ -191,7 +191,7 @@ public static string ReplaceFirst(this string str, string search, string replace
191191
return str;
192192
}
193193

194-
return str.Substring(0, pos) + replace + str[(pos + search.Length)..];
194+
return str[..pos] + replace + str[(pos + search.Length)..];
195195
}
196196

197197
/// <summary>
@@ -399,7 +399,9 @@ public static T ToEnum<T>(this string value, bool ignoreCase)
399399

400400
public static string ToMd5(this string str)
401401
{
402+
#pragma warning disable CA5351
402403
using var md5 = MD5.Create();
404+
#pragma warning restore CA5351
403405
var inputBytes = Encoding.UTF8.GetBytes(str);
404406
var hashBytes = md5.ComputeHash(inputBytes);
405407

@@ -531,4 +533,4 @@ public static string CheckNotNull(string value, string parameterName, int maxLen
531533

532534
return value;
533535
}
534-
}
536+
}

0 commit comments

Comments
 (0)