Skip to content

Commit 045c28c

Browse files
Merge pull request #900 from michelebastione/net10-refactoring
Updating projects and modernizing samples
2 parents c09cb8c + 018c856 commit 045c28c

File tree

962 files changed

+1300
-1413
lines changed

Some content is hidden

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

962 files changed

+1300
-1413
lines changed

.editorconfig

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,18 +15,5 @@ dotnet_style_qualification_for_method = false
1515
# IDE0065: Misplaced using directive
1616
csharp_using_directive_placement = outside_namespace
1717

18-
# CA1835: Prefer the memory-based overloads of ReadAsync/WriteAsync methods in stream-based classes
19-
dotnet_diagnostic.CA1835.severity = error
20-
21-
# CA1849: Call async methods when in an async method
22-
dotnet_diagnostic.CA1849.severity = error
23-
24-
dotnet_diagnostic.CA2000.severity = error
25-
26-
# CA2007: Do not directly await a Task
27-
dotnet_diagnostic.CA2007.severity = error
28-
29-
# CA2016: Forward the CancellationToken parameter to methods that take one
30-
dotnet_diagnostic.CA2016.severity = error
31-
18+
# IDE0161: Use file-scoped namespace
3219
csharp_style_namespace_declarations = file_scoped:silent

.github/workflows/benchmark.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,15 +18,15 @@ jobs:
1818
- name: Setup .NET
1919
uses: actions/setup-dotnet@v4
2020
with:
21-
dotnet-version: 9.0.x
21+
dotnet-version: 10.0.x
2222
- name: Restore dependencies
2323
run: dotnet restore
2424
working-directory: ./benchmarks/MiniExcel.Benchmarks
2525
- name: Build
2626
run: dotnet build --no-restore
2727
working-directory: ./benchmarks/MiniExcel.Benchmarks
2828
- name: Benchmark
29-
run: dotnet run -c Release -f net9.0
29+
run: dotnet run -c Release -f net10.0
3030
working-directory: ./benchmarks/MiniExcel.Benchmarks
3131
env:
3232
BenchmarkMode: Automatic
@@ -48,15 +48,15 @@ jobs:
4848
- name: Setup .NET
4949
uses: actions/setup-dotnet@v4
5050
with:
51-
dotnet-version: 9.0.x
51+
dotnet-version: 10.0.x
5252
- name: Restore dependencies
5353
run: dotnet restore
5454
working-directory: ./benchmarks/MiniExcel.Benchmarks
5555
- name: Build
5656
run: dotnet build --no-restore
5757
working-directory: ./benchmarks/MiniExcel.Benchmarks
5858
- name: Benchmark
59-
run: dotnet run -c Release -f net9.0
59+
run: dotnet run -c Release -f net10.0
6060
working-directory: ./benchmarks/MiniExcel.Benchmarks
6161
env:
6262
BenchmarkMode: Automatic
@@ -78,15 +78,15 @@ jobs:
7878
- name: Setup .NET
7979
uses: actions/setup-dotnet@v4
8080
with:
81-
dotnet-version: 9.0.x
81+
dotnet-version: 10.0.x
8282
- name: Restore dependencies
8383
run: dotnet restore
8484
working-directory: ./benchmarks/MiniExcel.Benchmarks
8585
- name: Build
8686
run: dotnet build --no-restore
8787
working-directory: ./benchmarks/MiniExcel.Benchmarks
8888
- name: Benchmark
89-
run: dotnet run -c Release -f net9.0
89+
run: dotnet run -c Release -f net10.0
9090
working-directory: ./benchmarks/MiniExcel.Benchmarks
9191
env:
9292
BenchmarkMode: Automatic

.github/workflows/codeql-analysis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
- name: Setup .NET
4444
uses: actions/setup-dotnet@v4
4545
with:
46-
dotnet-version: 8.0.x
46+
dotnet-version: 10.0.x
4747

4848
- name: Restore dependencies
4949
run: dotnet restore
@@ -72,7 +72,7 @@ jobs:
7272
# uses a compiled language
7373

7474
- name: Manual build
75-
run: dotnet build MiniExcel.slnx --no-restore --configuration Release
75+
run: dotnet build MiniExcel.slnx -c Release -f net10.0
7676

7777
- name: Perform CodeQL Analysis
7878
uses: github/codeql-action/analyze@v3

MiniExcel.slnx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<Project Path="benchmarks\MiniExcel.Benchmarks\MiniExcel.Benchmarks.csproj" />
44
</Folder>
55
<Folder Name="/Docs and settings/">
6+
<File Path=".editorconfig" />
67
<File Path=".gitattributes" />
78
<File Path=".gitignore" />
89
<File Path="appveyor.yml" />
@@ -13,9 +14,7 @@
1314
<File Path="README.zh-CN.md" />
1415
<File Path=".github\workflows\benchmark.yml" />
1516
<File Path=".github\workflows\codeql-analysis.yml" />
16-
<File Path="src\Directory.Build.props" />
1717
<File Path="README-V2.md" />
18-
<File Path="src\Directory.Packages.props" />
1918
<File Path="miniexcel.publickey" />
2019
<File Path="src\icon.png" />
2120
<File Path="V2-Upgrade-Notes.md" />
@@ -26,9 +25,11 @@
2625
<File Path="docs\README.zh-Hant.md" />
2726
</Folder>
2827
<Folder Name="/src/">
28+
<File Path="src\Directory.Build.props" />
29+
<File Path="src\Directory.Packages.props" />
2930
<Project Path="src\MiniExcel.Core\MiniExcel.Core.csproj" />
3031
<Project Path="src\MiniExcel.Csv\MiniExcel.Csv.csproj" />
31-
<Project Path="src\MiniExcel\MiniExcel.csproj" Type="Classic C#" />
32+
<Project Path="src\MiniExcel\MiniExcel.csproj" />
3233
</Folder>
3334
<Folder Name="/tests/">
3435
<Project Path="tests/MiniExcel.Csv.Tests/MiniExcel.Csv.Tests.csproj" />

benchmarks/MiniExcel.Benchmarks/MiniExcel.Benchmarks.csproj

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
<PropertyGroup>
44
<OutputType>Exe</OutputType>
5-
<TargetFrameworks>net8.0;net9.0</TargetFrameworks>
5+
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
66
<Nullable>enable</Nullable>
77
<ImplicitUsings>enable</ImplicitUsings>
88
<LangVersion>latest</LangVersion>
@@ -11,13 +11,13 @@
1111
</PropertyGroup>
1212

1313
<ItemGroup>
14-
<PackageReference Include="BenchmarkDotNet" Version="0.15.0" />
14+
<PackageReference Include="BenchmarkDotNet" Version="0.15.6" />
1515
<PackageReference Include="ClosedXML" Version="0.105.0" />
1616
<PackageReference Include="ClosedXML.Report" Version="0.2.12" />
1717
<PackageReference Include="DocumentFormat.OpenXml" Version="3.3.0" />
1818
<PackageReference Include="EPPlus" Version="7.7.2" />
1919
<PackageReference Include="ExcelDataReader" Version="3.7.0" />
20-
<PackageReference Include="NPOI" Version="2.7.3" />
20+
<PackageReference Include="NPOI" Version="2.7.5" />
2121
</ItemGroup>
2222

2323
<ItemGroup>
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
4+
<head>
5+
<meta charset="utf-8"/>
6+
<meta name="viewport" content="width=device-width, initial-scale=1.0"/>
7+
<base href="/"/>
8+
<ResourcePreloader/>
9+
<link rel="stylesheet" href="@Assets["lib/bootstrap/bootstrap.min.css"]"/>
10+
<link rel="stylesheet" href="@Assets["app.css"]"/>
11+
<link rel="stylesheet" href="@Assets["MiniExcel.Samples.Blazor.styles.css"]"/>
12+
<ImportMap/>
13+
<link rel="icon" type="image/png" href="favicon.png"/>
14+
<HeadOutlet @rendermode="InteractiveServer"/>
15+
</head>
16+
17+
<body>
18+
<Routes @rendermode="InteractiveServer"/>
19+
<ReconnectModal/>
20+
<script src="@Assets["_framework/blazor.web.js"]"></script>
21+
22+
<script>
23+
downloadFileFromStream = async (fileName, contentStreamReference) => {
24+
const arrayBuffer = await contentStreamReference.arrayBuffer();
25+
const blob = new Blob([arrayBuffer]);
26+
const url = URL.createObjectURL(blob);
27+
const anchorElement = document.createElement('a');
28+
anchorElement.href = url;
29+
anchorElement.download = fileName ?? '';
30+
anchorElement.click();
31+
anchorElement.remove();
32+
URL.revokeObjectURL(url);
33+
}
34+
</script>
35+
</body>
36+
37+
</html>
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
@inherits LayoutComponentBase
2+
3+
<div class="page">
4+
<div class="sidebar">
5+
<NavMenu/>
6+
</div>
7+
8+
<main>
9+
<article class="content px-4">
10+
@Body
11+
</article>
12+
</main>
13+
</div>
14+
15+
<div id="blazor-error-ui" data-nosnippet>
16+
An unhandled error has occurred.
17+
<a href="." class="reload">Reload</a>
18+
<span class="dismiss">🗙</span>
19+
</div>
Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
.page {
2+
position: relative;
3+
display: flex;
4+
flex-direction: column;
5+
}
6+
7+
main {
8+
flex: 1;
9+
}
10+
11+
.sidebar {
12+
background-image: linear-gradient(180deg, rgb(5, 39, 103) 0%, #3a0647 70%);
13+
}
14+
15+
.top-row {
16+
background-color: #f7f7f7;
17+
border-bottom: 1px solid #d6d5d5;
18+
justify-content: flex-end;
19+
height: 3.5rem;
20+
display: flex;
21+
align-items: center;
22+
}
23+
24+
.top-row ::deep a, .top-row ::deep .btn-link {
25+
white-space: nowrap;
26+
margin-left: 1.5rem;
27+
text-decoration: none;
28+
}
29+
30+
.top-row ::deep a:hover, .top-row ::deep .btn-link:hover {
31+
text-decoration: underline;
32+
}
33+
34+
.top-row ::deep a:first-child {
35+
overflow: hidden;
36+
text-overflow: ellipsis;
37+
}
38+
39+
@media (max-width: 640.98px) {
40+
.top-row {
41+
justify-content: space-between;
42+
}
43+
44+
.top-row ::deep a, .top-row ::deep .btn-link {
45+
margin-left: 0;
46+
}
47+
}
48+
49+
@media (min-width: 641px) {
50+
.page {
51+
flex-direction: row;
52+
}
53+
54+
.sidebar {
55+
width: 250px;
56+
height: 100vh;
57+
position: sticky;
58+
top: 0;
59+
}
60+
61+
.top-row {
62+
position: sticky;
63+
top: 0;
64+
z-index: 1;
65+
}
66+
67+
.top-row.auth ::deep a:first-child {
68+
flex: 1;
69+
text-align: right;
70+
width: 0;
71+
}
72+
73+
.top-row, article {
74+
padding-left: 2rem !important;
75+
padding-right: 1.5rem !important;
76+
}
77+
}
78+
79+
#blazor-error-ui {
80+
color-scheme: light only;
81+
background: lightyellow;
82+
bottom: 0;
83+
box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
84+
box-sizing: border-box;
85+
display: none;
86+
left: 0;
87+
padding: 0.6rem 1.25rem 0.7rem 1.25rem;
88+
position: fixed;
89+
width: 100%;
90+
z-index: 1000;
91+
}
92+
93+
#blazor-error-ui .dismiss {
94+
cursor: pointer;
95+
position: absolute;
96+
right: 0.75rem;
97+
top: 0.5rem;
98+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<div class="top-row ps-3 navbar navbar-dark">
2+
<div class="container-fluid">
3+
<a class="navbar-brand" href="">MiniExcel Blazor Demo</a>
4+
</div>
5+
</div>
6+
7+
<input type="checkbox" title="Navigation menu" class="navbar-toggler"/>
8+
9+
<div class="nav-scrollable" onclick="document.querySelector('.navbar-toggler').click()">
10+
<nav class="nav flex-column">
11+
<div class="nav-item px-3">
12+
<NavLink class="nav-link" href="" Match="NavLinkMatch.All">
13+
<span class="bi bi-house-door-fill-nav-menu" aria-hidden="true"></span> Home
14+
</NavLink>
15+
</div>
16+
17+
<div class="nav-item px-3">
18+
<NavLink class="nav-link" href="upload">
19+
<span class="bi bi-plus-square-fill-nav-menu" aria-hidden="true"></span> Upload
20+
</NavLink>
21+
</div>
22+
</nav>
23+
</div>

0 commit comments

Comments
 (0)