chore: cleanup usings and run dotnet format

This commit is contained in:
Stevan Freeborn
2024-04-12 19:33:56 -05:00
parent 95d4888876
commit ba65401c88
9 changed files with 27 additions and 30 deletions
+4
View File
@@ -1,5 +1,9 @@
global using System.IO.Abstractions;
global using System.ServiceModel.Syndication;
global using System.Text;
global using System.Text.Json;
global using System.Xml;
global using System.Xml.Linq;
global using Blog.Components;
global using Blog.Posts;
+7 -7
View File
@@ -16,7 +16,7 @@ class FilePostService(
.UseAdvancedExtensions()
.UsePrism()
.Build();
private const string MetaFence = "meta";
private const string IndexFile = "index.md";
@@ -68,12 +68,12 @@ class FilePostService(
try
{
var indexFilePath = _fileSystem.Path.Combine(subDirectory, IndexFile);
if (_fileSystem.File.Exists(indexFilePath) is false)
{
continue;
}
var postText = await _fileSystem.File.ReadAllTextAsync(indexFilePath);
var (metaContent, document) = ParsePost(postText);
@@ -108,7 +108,7 @@ class FilePostService(
public async Task<PostWithContent?> GetPostAsync(string slug)
{
try
try
{
var postPath = _fileSystem.Path.Combine(_options.PostsDirectory, slug, IndexFile);
@@ -133,10 +133,10 @@ class FilePostService(
return null;
}
var postWithContent = post with
{
var postWithContent = post with
{
Slug = slug,
Content = document.ToHtml(MarkdownPipeline)
Content = document.ToHtml(MarkdownPipeline)
};
return postWithContent;
+2 -7
View File
@@ -1,8 +1,3 @@
using System.ServiceModel.Syndication;
using System.Text;
using System.Xml;
using System.Xml.Linq;
var builder = WebApplication.CreateBuilder(args);
builder.Services.ConfigureOptions<FilePostServiceOptionsSetup>();
@@ -29,11 +24,11 @@ app.UseAntiforgery();
app.UseStatusCodePagesWithRedirects("/Error/{0}");
app
.MapGet("/rss", async (HttpContext context, IPostService postService) =>
.MapGet("/rss", async (HttpContext context, IPostService postService) =>
{
var req = context.Request;
var url = $"{req.Scheme}://{req.Host}{req.PathBase}";
var posts = await postService.GetPostsAsync();
var items = posts.Select(post =>