Skip to content

Commit 4e73fba

Browse files
committed
Initial commit
0 parents  commit 4e73fba

12 files changed

Lines changed: 746 additions & 0 deletions

.gitignore

Lines changed: 484 additions & 0 deletions
Large diffs are not rendered by default.

App.razor

Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
@using System.Text
2+
@using System.IO.Compression
3+
@inject HttpClient HttpClient
4+
5+
<div>
6+
<p>
7+
@System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription |
8+
@this.RendererInfo.Name
9+
</p>
10+
11+
<button @onclick="OnClickButton">
12+
Extract the sample zip file
13+
</button>
14+
15+
@if (_fileEntries.Any())
16+
{
17+
<hr />
18+
19+
@foreach (var fileEntry in _fileEntries)
20+
{
21+
<div>
22+
<h3>@fileEntry.Name</h3>
23+
<pre>@fileEntry.Content</pre>
24+
</div>
25+
}
26+
}
27+
</div>
28+
29+
@code {
30+
31+
public record FileEntry(string Name, string Content);
32+
33+
private readonly List<FileEntry> _fileEntries = [];
34+
35+
private async Task OnClickButton()
36+
{
37+
_fileEntries.Clear();
38+
39+
var zipFileBytes = await HttpClient.GetByteArrayAsync("sample.zip");
40+
using var zipFileStream = new MemoryStream(zipFileBytes);
41+
using var zipArchive = new ZipArchive(zipFileStream, ZipArchiveMode.Read);
42+
43+
foreach (var entry in zipArchive.Entries)
44+
{
45+
using var entryStream = entry.Open();
46+
using var streamReader = new StreamReader(entryStream, Encoding.UTF8);
47+
var entryContent = await streamReader.ReadToEndAsync();
48+
49+
_fileEntries.Add(new FileEntry(entry.Name, entryContent.Substring(0, Math.Min(entryContent.Length, 200))));
50+
}
51+
}
52+
}

App.razor.css

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pre {
2+
white-space: normal;
3+
}

BlazorWasmApp1.csproj

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<Project Sdk="Microsoft.NET.Sdk.BlazorWebAssembly">
2+
3+
<PropertyGroup>
4+
<TargetFrameworks>net9.0;net10.0</TargetFrameworks>
5+
<Nullable>enable</Nullable>
6+
<ImplicitUsings>enable</ImplicitUsings>
7+
</PropertyGroup>
8+
9+
<ItemGroup Condition=" '$(TargetFramework)' == 'net9.0' ">
10+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="9.0.9" />
11+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="9.0.9" PrivateAssets="all" />
12+
</ItemGroup>
13+
14+
<ItemGroup Condition=" '$(TargetFramework)' == 'net10.0' ">
15+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly" Version="10.0.0-rc.1.*" />
16+
<PackageReference Include="Microsoft.AspNetCore.Components.WebAssembly.DevServer" Version="10.0.0-rc.1.*" PrivateAssets="all" />
17+
</ItemGroup>
18+
19+
</Project>

BlazorWasmApp1.sln

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
Microsoft Visual Studio Solution File, Format Version 12.00
2+
# Visual Studio Version 17
3+
VisualStudioVersion = 17.4.32804.182
4+
MinimumVisualStudioVersion = 16.0.0.0
5+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "BlazorWasmApp1", "BlazorWasmApp1.csproj", "{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}"
6+
EndProject
7+
Global
8+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
9+
Debug|Any CPU = Debug|Any CPU
10+
Debug|x64 = Debug|x64
11+
Debug|x86 = Debug|x86
12+
Release|Any CPU = Release|Any CPU
13+
Release|x64 = Release|x64
14+
Release|x86 = Release|x86
15+
EndGlobalSection
16+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
17+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
18+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Debug|Any CPU.Build.0 = Debug|Any CPU
19+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Debug|x64.ActiveCfg = Debug|Any CPU
20+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Debug|x64.Build.0 = Debug|Any CPU
21+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Debug|x86.ActiveCfg = Debug|Any CPU
22+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Debug|x86.Build.0 = Debug|Any CPU
23+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Release|Any CPU.ActiveCfg = Release|Any CPU
24+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Release|Any CPU.Build.0 = Release|Any CPU
25+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Release|x64.ActiveCfg = Release|Any CPU
26+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Release|x64.Build.0 = Release|Any CPU
27+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Release|x86.ActiveCfg = Release|Any CPU
28+
{CB1B6F46-2C1F-4ED2-8B0E-B9C362877CA5}.Release|x86.Build.0 = Release|Any CPU
29+
EndGlobalSection
30+
GlobalSection(SolutionProperties) = preSolution
31+
HideSolutionNode = FALSE
32+
EndGlobalSection
33+
GlobalSection(ExtensibilityGlobals) = postSolution
34+
SolutionGuid = {D1D038B6-68B2-4552-9880-77695CBDB453}
35+
EndGlobalSection
36+
EndGlobal

Program.cs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
using BlazorWasmApp1;
2+
using Microsoft.AspNetCore.Components.Web;
3+
using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
4+
5+
var builder = WebAssemblyHostBuilder.CreateDefault(args);
6+
builder.RootComponents.Add<App>("#app");
7+
builder.RootComponents.Add<HeadOutlet>("head::after");
8+
9+
builder.Services.AddScoped(sp => new HttpClient { BaseAddress = new Uri(builder.HostEnvironment.BaseAddress) });
10+
11+
await builder.Build().RunAsync();

Properties/launchSettings.json

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
{
2+
"iisSettings": {
3+
"windowsAuthentication": false,
4+
"anonymousAuthentication": true,
5+
"iisExpress": {
6+
"applicationUrl": "http://localhost:57563/",
7+
"sslPort": 44310
8+
}
9+
},
10+
"profiles": {
11+
"http": {
12+
"commandName": "Project",
13+
"dotnetRunMessages": true,
14+
"launchBrowser": true,
15+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
16+
"applicationUrl": "http://localhost:5113",
17+
"environmentVariables": {
18+
"ASPNETCORE_ENVIRONMENT": "Development"
19+
}
20+
},
21+
"https": {
22+
"commandName": "Project",
23+
"dotnetRunMessages": true,
24+
"launchBrowser": true,
25+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
26+
"applicationUrl": "https://localhost:7239;http://localhost:5113",
27+
"environmentVariables": {
28+
"ASPNETCORE_ENVIRONMENT": "Development"
29+
}
30+
},
31+
"IIS Express": {
32+
"commandName": "IISExpress",
33+
"launchBrowser": true,
34+
"inspectUri": "{wsProtocol}://{url.hostname}:{url.port}/_framework/debug/ws-proxy?browser={browserInspectUri}",
35+
"environmentVariables": {
36+
"ASPNETCORE_ENVIRONMENT": "Development"
37+
}
38+
}
39+
}
40+
}

_Imports.razor

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
@using System.Net.Http
2+
@using System.Net.Http.Json
3+
@using Microsoft.AspNetCore.Components.Forms
4+
@using Microsoft.AspNetCore.Components.Routing
5+
@using Microsoft.AspNetCore.Components.Web
6+
@using Microsoft.AspNetCore.Components.Web.Virtualization
7+
@using Microsoft.AspNetCore.Components.WebAssembly.Http
8+
@using Microsoft.JSInterop
9+
@using BlazorWasmApp1

wwwroot/css/blazor-ui.css

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
#blazor-error-ui {
2+
background: #ffffe0;
3+
bottom: 0;
4+
box-shadow: 0 -1px 2px rgba(0, 0, 0, .2);
5+
display: none;
6+
left: 0;
7+
padding: .6rem 1.25rem .7rem 1.25rem;
8+
position: fixed;
9+
right: 0;
10+
z-index: 1000
11+
}
12+
13+
#blazor-error-ui .dismiss {
14+
cursor: pointer;
15+
position: absolute;
16+
right: .75rem;
17+
top: .5rem
18+
}
19+
20+
.blazor-error-boundary {
21+
background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
22+
padding: 1rem 1rem 1rem 3.7rem;
23+
color: white;
24+
}
25+
26+
.blazor-error-boundary::after {
27+
content: "An error has occurred."
28+
}
29+
30+
.loading-progress {
31+
position: relative;
32+
display: block;
33+
width: 8rem;
34+
height: 8rem;
35+
margin: 20vh auto 1rem auto;
36+
}
37+
38+
.loading-progress circle {
39+
fill: none;
40+
stroke: #e0e0e0;
41+
stroke-width: 0.6rem;
42+
transform-origin: 50% 50%;
43+
transform: rotate(-90deg);
44+
}
45+
46+
.loading-progress circle:last-child {
47+
stroke: #1b6ec2;
48+
stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
49+
transition: stroke-dasharray 0.05s ease-in-out;
50+
}
51+
52+
.loading-progress-text {
53+
position: absolute;
54+
text-align: center;
55+
font-weight: bold;
56+
inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
57+
}
58+
59+
.loading-progress-text:after {
60+
content: var(--blazor-load-percentage-text, "Loading");
61+
}

wwwroot/favicon.ico

8.85 KB
Binary file not shown.

0 commit comments

Comments
 (0)