Отчистка кода

This commit is contained in:
2025-04-24 17:58:58 +04:00
parent 31ad99ade5
commit cc7e97b6ff
20 changed files with 1972 additions and 1562 deletions
+15 -8
View File
@@ -1,15 +1,13 @@
using Microsoft.EntityFrameworkCore;
using System.ComponentModel;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using Pf2eModel;
using Pf2eModel.Model;
using Pf2eModel.Model.Base;
using Pf2eModel.Model.Base.Source;
using Pf2eModel.Model.Common.I18n;
using Pf2eModel.Model.Structure;
using System.ComponentModel;
namespace Pf2eViewer;
internal class EntityConverter : JsonConverter
{
private readonly Pf2eDbContext _context = new();
@@ -71,7 +69,9 @@ internal class EntityConverter : JsonConverter
private void ProcessTrait(Dictionary<string, object?> dictionary, Trait trait)
{
LocaleString name = trait.Entity?.Name ?? _context.Entities.Where(e => e.Id == trait.Id).Select(e => e.Name).FirstOrDefault()!;
LocaleString name =
trait.Entity?.Name
?? _context.Entities.Where(e => e.Id == trait.Id).Select(e => e.Name).FirstOrDefault()!;
dictionary.Remove("Entity");
dictionary.Remove("Entities");
@@ -82,11 +82,18 @@ internal class EntityConverter : JsonConverter
{
dictionary.Remove("Description");
}
public override bool CanRead => false;
public override object? ReadJson(JsonReader reader, Type objectType, object? existingValue, JsonSerializer serializer)
public override object? ReadJson(
JsonReader reader,
Type objectType,
object? existingValue,
JsonSerializer serializer
)
{
throw new NotImplementedException("Unnecessary because CanRead is false. The type will skip the converter.");
throw new NotImplementedException(
"Unnecessary because CanRead is false. The type will skip the converter."
);
}
}