Upgrade to .net9

This commit is contained in:
dennisarfan 2025-07-31 06:19:32 +07:00
parent eb97cfb57c
commit a1cb6592eb
15 changed files with 395 additions and 54 deletions

View file

@ -24,7 +24,7 @@ public static class ImageController
await tileManager
.CreateSection(dto)
.WriteToStream(response.Body, dto.OutputScale);
.DangerousWriteToPipe(response.BodyWriter, dto.OutputScale);
await response.CompleteAsync();
}
@ -47,7 +47,7 @@ public static class ImageController
var scale = float.Clamp(480f / int.Max(section.Width, section.Height), 0.01f, 1f);
Console.WriteLine($"Generate random image for {coordinatePair} scale: {scale}");
await section.WriteToStream(response.Body, scale);
await section.DangerousWriteToPipe(response.BodyWriter, scale);
await response.CompleteAsync();
}
}

View file

@ -1,11 +1,12 @@
<Project Sdk="Microsoft.NET.Sdk.Web">
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetFramework>net9.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>StitchATon2.App</RootNamespace>
<PublishAot>true</PublishAot>
</PropertyGroup>
<ItemGroup>

View file

@ -1,3 +1,4 @@
using System.IO.Pipelines;
using StitchATon2.App.Models;
using StitchATon2.Domain;
using StitchATon2.Domain.ImageCreators;
@ -19,4 +20,10 @@ public static class Utils
var imageCreator = new ImageCreator(section);
await imageCreator.WriteToStream(stream, scale!.Value);
}
public static async Task DangerousWriteToPipe(this GridSection section, PipeWriter pipeWriter, float? scale)
{
var imageCreator = new DangerousImageCreator(section);
await imageCreator.WriteToPipe(pipeWriter, scale!.Value);
}
}