bump: net8.0 -> net9.0
All checks were successful
Build blog docker image / Build-Blog-Image (push) Successful in 3m23s

This commit is contained in:
2024-12-06 15:38:35 +08:00
parent 309db7e5f1
commit 05d40ce3b6
5 changed files with 14 additions and 14 deletions

View File

@@ -133,13 +133,12 @@ public partial class EssayScanService(
private static Task<ImageScanResult> ScanUnusedImagesInternal(IEnumerable<BlogContent> contents,
DirectoryInfo root)
{
Regex imageRegex = ImageRegex();
ConcurrentBag<FileInfo> unusedImage = [];
ConcurrentBag<FileInfo> notFoundImage = [];
Parallel.ForEach(contents, content =>
{
MatchCollection result = imageRegex.Matches(content.FileContent);
MatchCollection result = ImagePattern.Matches(content.FileContent);
DirectoryInfo imageDirectory = new(Path.Combine(root.FullName, content.FileName));
Dictionary<string, bool> usedDictionary;
@@ -182,7 +181,7 @@ public partial class EssayScanService(
}
[GeneratedRegex(@"\!\[.*?\]\((.*?)\)")]
private static partial Regex ImageRegex();
private static partial Regex ImagePattern { get; }
private void ValidateDirectory(string root, out DirectoryInfo drafts, out DirectoryInfo posts)
{

View File

@@ -136,7 +136,8 @@ public partial class RendererService(
}
[GeneratedRegex(@"(?<!\\)[^\#\*_\-\+\`{}\[\]!~]+")]
private static partial Regex DescriptionPattern();
// private static partial Regex DescriptionPattern();
private static partial Regex DescriptionPattern { get; }
private string GetDescription(BlogContent content)
{
@@ -152,7 +153,7 @@ public partial class RendererService(
}
string rawContent = content.FileContent[..pos];
MatchCollection matches = DescriptionPattern().Matches(rawContent);
MatchCollection matches = DescriptionPattern.Matches(rawContent);
StringBuilder builder = new();
foreach (Match match in matches)