Финализация рефакторинга

This commit is contained in:
2025-10-04 22:52:15 +04:00
parent 7dec66984b
commit 5ded786397
18 changed files with 55 additions and 95 deletions
@@ -108,7 +108,7 @@ public class RuleTocCollection
/// <summary> /// <summary>
/// Класс представляет собой книгу, содержащую правила. /// Класс представляет собой книгу, содержащую правила.
/// </summary> /// </summary>
internal class RuleTocBook(Source source) public class RuleTocBook(Source source)
{ {
/// <summary> /// <summary>
/// Идентификатор источника. /// Идентификатор источника.
@@ -222,7 +222,7 @@ internal class RuleTocBook(Source source)
/// <summary> /// <summary>
/// Класс представляет собой элемент дерева правил. /// Класс представляет собой элемент дерева правил.
/// </summary> /// </summary>
internal class RuleTocItem(string name, RuleTocItem? parent) public class RuleTocItem(string name, RuleTocItem? parent)
{ {
public string? Id { get; set; } = null; public string? Id { get; set; } = null;
@@ -3,6 +3,7 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq; using Newtonsoft.Json.Linq;
using Pf2e.Common;
using Pf2e.Database; using Pf2e.Database;
using Pf2e.Database.Model; using Pf2e.Database.Model;
using Pf2e.Database.Model.Base; using Pf2e.Database.Model.Base;
-53
View File
@@ -1,53 +0,0 @@
using System;
using System.Windows;
using Microsoft.Extensions.DependencyInjection;
using Pf2e.Scrapper.Importers.Implementations.Aonprd;
using Pf2e.Scrapper.Importers.Implementations.FoundryEn;
using Pf2e.Scrapper.WPF;
namespace Pf2e.Scrapper;
public static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
public static void Main()
{
// To customize application configuration such as set high DPI settings or default font,
// see https://aka.ms/applicationconfiguration.
ApplicationConfiguration.Initialize();
// Application.SetHighDpiMode(HighDpiMode.SystemAware);
/*
#pragma warning disable WFO5001
Application.SetColorMode(SystemColorMode.System);
#pragma warning restore WFO5001
*/
IServiceCollection services = RegisterServices();
IServiceProvider serviceProvider = services.BuildServiceProvider();
ImportApplication app = ActivatorUtilities.CreateInstance<ImportApplication>(
serviceProvider
);
app.Run();
// Application.Run(app);
}
private static IServiceCollection RegisterServices()
{
IServiceCollection services = new ServiceCollection();
services.RegisterWpfServices();
ImportApplication.RegisterServices(services);
AonprdImporter.RegisterServices(services);
FoundryEnImporter.RegisterServices(services);
return services;
}
}
+1 -2
View File
@@ -1,8 +1,7 @@
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Windows; using System.Windows;
using Pf2e.Database; using Pf2e.Database;
using Pf2e.Database.Model.Enum; using Pf2e.WPF.EntityViewer.ViewModel;
using Pf2e.Scrapper.WPF.EntityViewer.ViewModel;
namespace Pf2e.WPF.EntityViewer; namespace Pf2e.WPF.EntityViewer;
@@ -5,6 +5,7 @@ using Pf2e.Database;
using Pf2e.Database.Model.Base; using Pf2e.Database.Model.Base;
using Pf2e.Database.Model.Enum; using Pf2e.Database.Model.Enum;
using Pf2e.Scrapper.WPF.EntityViewer.Stores; using Pf2e.Scrapper.WPF.EntityViewer.Stores;
using Pf2e.WPF.EntityViewer.Stores;
namespace Pf2e.WPF.EntityViewer.ViewModel; namespace Pf2e.WPF.EntityViewer.ViewModel;
@@ -6,6 +6,7 @@ using Pf2e.Database;
using Pf2e.Database.Model.Base; using Pf2e.Database.Model.Base;
using Pf2e.Database.Model.Enum; using Pf2e.Database.Model.Enum;
using Pf2e.Scrapper.WPF.EntityViewer.Stores; using Pf2e.Scrapper.WPF.EntityViewer.Stores;
using Pf2e.WPF.EntityViewer.Stores;
namespace Pf2e.WPF.EntityViewer.ViewModel; namespace Pf2e.WPF.EntityViewer.ViewModel;
@@ -1,10 +1,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Collections.ObjectModel; using System.Collections.ObjectModel;
using System.Linq; using System.Linq;
using Pf2e.Common;
using Pf2e.Database; using Pf2e.Database;
using Pf2e.Scrapper.Helpers; using Pf2e.Scrapper.Helpers;
using Pf2e.Scrapper.WPF.EntityViewer.EntityViewStructure; using Pf2e.Scrapper.WPF.EntityViewer.EntityViewStructure;
using Pf2e.Scrapper.WPF.EntityViewer.Stores; using Pf2e.Scrapper.WPF.EntityViewer.Stores;
using Pf2e.WPF.EntityViewer.EntityViewStructure;
using Pf2e.WPF.EntityViewer.Stores;
namespace Pf2e.WPF.EntityViewer.ViewModel; namespace Pf2e.WPF.EntityViewer.ViewModel;
@@ -3,12 +3,16 @@ using System.ComponentModel;
using System.Windows; using System.Windows;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Pf2e.Database; using Pf2e.Database;
using Pf2e.Scrapper;
using Pf2e.Scrapper.Helpers; using Pf2e.Scrapper.Helpers;
using Pf2e.Scrapper.Processors; using Pf2e.Scrapper.Processors;
using Pf2e.Scrapper.Processors.Collection; using Pf2e.Scrapper.Processors.Collection;
using Pf2e.WPF.EntityViewer;
using Pf2e.WPF.Progress;
using Pf2e.WPF.Start;
using Slugify; using Slugify;
namespace Pf2e.Scrapper; namespace Pf2e.WPF;
public sealed class ImportApplication : Application public sealed class ImportApplication : Application
{ {
+3 -3
View File
@@ -30,13 +30,13 @@
<Compile Update="EntityViewer\EntityForm.xaml.cs"> <Compile Update="EntityViewer\EntityForm.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="ProgressForm\ProgressForm.xaml.cs"> <Compile Update="Progress\ProgressForm.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="StartForm\Components\ProcessorCollectionControl.xaml.cs"> <Compile Update="Start\Components\ProcessorCollectionControl.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
<Compile Update="StartForm\StartForm.xaml.cs"> <Compile Update="Start\StartForm.xaml.cs">
<SubType>Code</SubType> <SubType>Code</SubType>
</Compile> </Compile>
</ItemGroup> </ItemGroup>
+2 -1
View File
@@ -4,8 +4,9 @@ using Microsoft.Extensions.DependencyInjection;
using Pf2e.Scrapper.Importers.Implementations.Aonprd; using Pf2e.Scrapper.Importers.Implementations.Aonprd;
using Pf2e.Scrapper.Importers.Implementations.FoundryEn; using Pf2e.Scrapper.Importers.Implementations.FoundryEn;
using Pf2e.Scrapper.WPF; using Pf2e.Scrapper.WPF;
using Pf2e.WPF;
namespace Pf2e.Scrapper; namespace Pf2e.WPF;
public static class Program public static class Program
{ {
@@ -1,5 +1,5 @@
<Window <Window
x:Class="Pf2e.WPF.ProgressForm.ProgressForm" x:Class="Pf2e.WPF.Progress.ProgressForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -5,7 +5,7 @@ using System.Windows;
using LinqToDB.Tools; using LinqToDB.Tools;
using Pf2e.Scrapper.Helpers; using Pf2e.Scrapper.Helpers;
namespace Pf2e.WPF.ProgressForm; namespace Pf2e.WPF.Progress;
/// <summary> /// <summary>
/// Логика взаимодействия для ProgressFormWpf.xaml /// Логика взаимодействия для ProgressFormWpf.xaml
@@ -1,5 +1,5 @@
<UserControl <UserControl
x:Class="Pf2e.Scrapper.WPF.StartForm.Components.ProcessorCollectionControl" x:Class="Pf2e.WPF.Start.Components.ProcessorCollectionControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
@@ -4,10 +4,11 @@ using System.ComponentModel;
using System.Linq; using System.Linq;
using System.Windows; using System.Windows;
using Pf2e.Scrapper.Processors.Attributes; using Pf2e.Scrapper.Processors.Attributes;
using Pf2e.Scrapper.Processors.Attributes.Enum;
using Pf2e.Scrapper.Processors.Collection; using Pf2e.Scrapper.Processors.Collection;
using CheckBox = System.Windows.Controls.CheckBox; using CheckBox = System.Windows.Controls.CheckBox;
namespace Pf2e.Scrapper.WPF.StartForm.Components; namespace Pf2e.WPF.Start.Components;
/// <summary> /// <summary>
/// Логика взаимодействия для ProcessorCollectionControl.xaml /// Логика взаимодействия для ProcessorCollectionControl.xaml
@@ -1,8 +1,8 @@
<Window <Window
x:Class="Pf2e.WPF.StartForm.StartForm" x:Class="Pf2e.WPF.Start.StartForm"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:comp="clr-namespace:Pf2e.WPF.StartForm.Components" xmlns:comp="clr-namespace:Pf2e.WPF.Start.Components"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
Title="StartForm" Title="StartForm"
@@ -2,7 +2,7 @@
using Pf2e.Scrapper; using Pf2e.Scrapper;
using Pf2e.Scrapper.Processors.Collection; using Pf2e.Scrapper.Processors.Collection;
namespace Pf2e.WPF.StartForm; namespace Pf2e.WPF.Start;
/// <summary> /// <summary>
/// Класс начальной формы приложения. /// Класс начальной формы приложения.
+2
View File
@@ -1,6 +1,8 @@
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Pf2e.Scrapper.WPF.EntityViewer.Stores; using Pf2e.Scrapper.WPF.EntityViewer.Stores;
using Pf2e.Scrapper.WPF.EntityViewer.ViewModel; using Pf2e.Scrapper.WPF.EntityViewer.ViewModel;
using Pf2e.WPF.EntityViewer.Stores;
using Pf2e.WPF.EntityViewer.ViewModel;
namespace Pf2e.WPF; namespace Pf2e.WPF;
+26 -26
View File
@@ -12,34 +12,34 @@
<hr /> <hr />
<dl class="row"> <dl class="row">
<dt class="col-sm-2"> <dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Class.Entity) @Html.DisplayNameFor(model => model.Entity.Entity)
</dt> </dt>
<dd class="col-sm-10"> <dd class="col-sm-10">
@Html.DisplayFor(model => model.Class.Entity.Description) @Html.DisplayFor(model => model.Entity.Entity.Description)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Class.Hp)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Class.Hp)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Class.Spellcasting)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Class.Spellcasting)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Class.Tradition)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Class.Tradition)
</dd>
<dt class="col-sm-2">
@Html.DisplayNameFor(model => model.Class.AdditionalTrainedSkills)
</dt>
<dd class="col-sm-10">
@Html.DisplayFor(model => model.Class.AdditionalTrainedSkills)
</dd> </dd>
@* <dt class="col-sm-2"> *@
@* @Html.DisplayNameFor(model => model.Entity.Hp) *@
@* </dt> *@
@* <dd class="col-sm-10"> *@
@* @Html.DisplayFor(model => model.Entity.Hp) *@
@* </dd> *@
@* <dt class="col-sm-2"> *@
@* @Html.DisplayNameFor(model => model.Entity.Spellcasting) *@
@* </dt> *@
@* <dd class="col-sm-10"> *@
@* @Html.DisplayFor(model => model.Entity.Spellcasting) *@
@* </dd> *@
@* <dt class="col-sm-2"> *@
@* @Html.DisplayNameFor(model => model.Entity.Tradition) *@
@* </dt> *@
@* <dd class="col-sm-10"> *@
@* @Html.DisplayFor(model => model.Entity.Tradition) *@
@* </dd> *@
@* <dt class="col-sm-2"> *@
@* @Html.DisplayNameFor(model => model.Entity.AdditionalTrainedSkills) *@
@* </dt> *@
@* <dd class="col-sm-10"> *@
@* @Html.DisplayFor(model => model.Entity.AdditionalTrainedSkills) *@
@* </dd> *@
</dl> </dl>
</div> </div>