diff --git a/Pf2eDataScrapper/App/ProcessorAttribute.cs b/Pf2eDataScrapper/App/ProcessorAttribute.cs index 3497ce6..9cc8fc1 100644 --- a/Pf2eDataScrapper/App/ProcessorAttribute.cs +++ b/Pf2eDataScrapper/App/ProcessorAttribute.cs @@ -1,4 +1,7 @@ -namespace Pf2eDataScrapper.App; +using System; +using System.Collections.Generic; + +namespace Pf2eDataScrapper.App; /// /// Общий аттрибут обработчика. diff --git a/Pf2eDataScrapper/App/ProcessorCollection.cs b/Pf2eDataScrapper/App/ProcessorCollection.cs index 56d21db..57a5d71 100644 --- a/Pf2eDataScrapper/App/ProcessorCollection.cs +++ b/Pf2eDataScrapper/App/ProcessorCollection.cs @@ -1,4 +1,7 @@ -using System.Reflection; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Reflection; using Pf2eDataScrapper.Processors; namespace Pf2eDataScrapper.App; diff --git a/Pf2eDataScrapper/ApplicationSettings.cs b/Pf2eDataScrapper/ApplicationSettings.cs index 6a0320f..dd191ad 100644 --- a/Pf2eDataScrapper/ApplicationSettings.cs +++ b/Pf2eDataScrapper/ApplicationSettings.cs @@ -1,4 +1,5 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.IO; using dotenv.net; using dotenv.net.Utilities; diff --git a/Pf2eDataScrapper/Forms/Controls/CoreBindingNavigator.cs b/Pf2eDataScrapper/Forms/Controls/CoreBindingNavigator.cs deleted file mode 100644 index e0d4f03..0000000 --- a/Pf2eDataScrapper/Forms/Controls/CoreBindingNavigator.cs +++ /dev/null @@ -1,22 +0,0 @@ -namespace Pf2eDataScrapper.Forms.Controls; - -/// -/// Элемент управления прокрутки страниц -/// -internal sealed class CoreBindingNavigator : BindingNavigator -{ - public CoreBindingNavigator() - { - AddStandardItems(); - - if (DeleteItem != null) - { - DeleteItem.Visible = false; - } - - if (AddNewItem != null) - { - AddNewItem.Visible = false; - } - } -} diff --git a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseQueryPerformer.cs b/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseQueryPerformer.cs deleted file mode 100644 index b6d8d2a..0000000 --- a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseQueryPerformer.cs +++ /dev/null @@ -1,130 +0,0 @@ -using System.Collections.Concurrent; -using Pf2eModel; -using Pf2eModel.Model.Base; -using Pf2eModel.Model.Enum; - -namespace Pf2eDataScrapper.Forms.Controls.DatabaseViewer; - -/// -/// Класс, выполняющий страничные запросы к базе данных. -/// -internal class DatabaseQueryPerformer -{ - /// - /// Тип сущностей, которую необходимо получить. - /// - public required EntityType Type; - - /// - /// Номер страницы, которую необходимо получить. - /// - public required int Page; - - /// - /// Количество элементов на странице. - /// - public required int PerPage; - - /// - /// Поисковая строка, по которой будет производиться фильтрация. - /// - public required string Search = ""; - - /// - /// Поток, в котором будет выполняться запрос к базе данных. - /// - private readonly Thread _queryThread; - - /// - /// Конструктор класса, который инициализирует поток для выполнения запроса к базе данных. - /// - public DatabaseQueryPerformer() - { - _queryThread = new(PerformQuery); - } - - /// - /// Запускает поток для выполнения запроса к базе данных. - /// - public void Query() - { - _queryThread.Start(); - } - - /// - /// Прерывает выполнение потока, если он ещё не завершён. - /// - public void Abort() - { - _queryThread.Interrupt(); - } - - /// - /// Выполняет запрос к базе данных и обрабатывает результаты. - /// - private void PerformQuery() - { - try - { - Pf2eDbContext dbContext = new(); - - IQueryable query = - Search == "" - ? dbContext.Entities.Where(e => e.Type == Type) - : - // ReSharper disable once EntityFramework.UnsupportedServerSideFunctionCall - dbContext.Entities.Where(e => - e.Type == Type && Pf2eDbContext.LocaleSearch(e.Name, Search) - ); - - int count = query.Count(); - - List entities = query - .OrderBy(e => e.Id) - .Skip((Page - 1) * PerPage) - .Take(PerPage) - .ToList(); - - DatabaseQueryResult result = new(count, entities); - - OnQueryCompleted?.Invoke(this, result); - } - catch (ThreadInterruptedException) - { - // Ignore - } - } - - /// - /// Делегат, который будет вызван по завершении выполнения запроса к базе данных. - /// - /// Объект класса, выполневшего запрос. - /// Результат запроса. - public delegate void DatabaseQueryPerformerDelegate( - DatabaseQueryPerformer sender, - DatabaseQueryResult result - ); - - /// - /// Событие, которое будет вызвано по завершении выполнения запроса к базе данных. - /// - public event DatabaseQueryPerformerDelegate? OnQueryCompleted; -} - -/// -/// Класс, который содержит результат выполнения запроса к базе данных. -/// -/// Общее количество найденных сущностей. -/// Набор найденных сущностей. -internal class DatabaseQueryResult(int count, ICollection entities) -{ - /// - /// Общее количество найденных сущностей. - /// - public int Count { get; } = count; - - /// - /// Набор найденных сущностей. - /// - public ConcurrentBag Entities { get; } = new(entities); -} diff --git a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.Designer.cs b/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.Designer.cs deleted file mode 100644 index 374dca0..0000000 --- a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.Designer.cs +++ /dev/null @@ -1,148 +0,0 @@ -namespace Pf2eDataScrapper.Forms.Controls.DatabaseViewer; - -partial class DatabaseViewerControl -{ - /// - /// Обязательная переменная конструктора. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Освободить все используемые ресурсы. - /// - /// истинно, если управляемый ресурс должен быть удален; иначе ложно. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Код, автоматически созданный конструктором компонентов - - /// - /// Требуемый метод для поддержки конструктора — не изменяйте - /// содержимое этого метода с помощью редактора кода. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - BindingNavigator = new CoreBindingNavigator(); - SearchTextBox = new TextBox(); - DataGridView = new DataGridView(); - DbBindingSource = new BindingSource(components); - PagesBindingSource = new BindingSource(components); - Id = new DataGridViewTextBoxColumn(); - EntityName = new DataGridViewTextBoxColumn(); - Rarity = new DataGridViewTextBoxColumn(); - (BindingNavigator).BeginInit(); - ((System.ComponentModel.ISupportInitialize)DataGridView).BeginInit(); - ((System.ComponentModel.ISupportInitialize)DbBindingSource).BeginInit(); - ((System.ComponentModel.ISupportInitialize)PagesBindingSource).BeginInit(); - SuspendLayout(); - // - // BindingNavigator - // - BindingNavigator.AddNewItem = null; - BindingNavigator.DeleteItem = null; - BindingNavigator.ImeMode = ImeMode.NoControl; - BindingNavigator.LayoutStyle = ToolStripLayoutStyle.HorizontalStackWithOverflow; - BindingNavigator.Location = new Point(0, 0); - BindingNavigator.Name = "BindingNavigator"; - BindingNavigator.Size = new Size(345, 25); - BindingNavigator.Stretch = true; - BindingNavigator.TabIndex = 1; - BindingNavigator.Text = "coreBindingNavigator1"; - BindingNavigator.RefreshItems += BindingNavigator_RefreshItems; - // - // SearchTextBox - // - SearchTextBox.Dock = DockStyle.Top; - SearchTextBox.Location = new Point(0, 25); - SearchTextBox.Name = "SearchTextBox"; - SearchTextBox.PlaceholderText = "Поиск"; - SearchTextBox.Size = new Size(345, 23); - SearchTextBox.TabIndex = 3; - SearchTextBox.TextChanged += SearchTextBox_TextChanged; - SearchTextBox.Leave += SearchTextBox_Leave; - // - // DataGridView - // - DataGridView.AllowUserToAddRows = false; - DataGridView.AllowUserToDeleteRows = false; - DataGridView.AutoGenerateColumns = false; - DataGridView.AutoSizeColumnsMode = DataGridViewAutoSizeColumnsMode.AllCellsExceptHeader; - DataGridView.AutoSizeRowsMode = DataGridViewAutoSizeRowsMode.AllCellsExceptHeaders; - DataGridView.ColumnHeadersHeightSizeMode = DataGridViewColumnHeadersHeightSizeMode.AutoSize; - DataGridView.Columns.AddRange(new DataGridViewColumn[] { Id, EntityName, Rarity }); - DataGridView.DataSource = DbBindingSource; - DataGridView.Dock = DockStyle.Fill; - DataGridView.Location = new Point(0, 48); - DataGridView.MultiSelect = false; - DataGridView.Name = "DataGridView"; - DataGridView.ReadOnly = true; - DataGridView.RowHeadersVisible = false; - DataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - DataGridView.Size = new Size(345, 345); - DataGridView.TabIndex = 4; - DataGridView.RowStateChanged += DataGridView_RowStateChanged; - // - // Id - // - Id.DataPropertyName = "Id"; - Id.HeaderText = "Id"; - Id.Name = "Id"; - Id.ReadOnly = true; - Id.Resizable = DataGridViewTriState.False; - Id.SortMode = DataGridViewColumnSortMode.NotSortable; - Id.Width = 5; - // - // EntityName - // - EntityName.AutoSizeMode = DataGridViewAutoSizeColumnMode.Fill; - EntityName.DataPropertyName = "Name"; - EntityName.HeaderText = "Name"; - EntityName.Name = "EntityName"; - EntityName.ReadOnly = true; - EntityName.Resizable = DataGridViewTriState.False; - EntityName.SortMode = DataGridViewColumnSortMode.NotSortable; - // - // Rarity - // - Rarity.DataPropertyName = "Rarity"; - Rarity.HeaderText = "Rarity"; - Rarity.Name = "Rarity"; - Rarity.ReadOnly = true; - Rarity.Resizable = DataGridViewTriState.False; - Rarity.SortMode = DataGridViewColumnSortMode.NotSortable; - Rarity.Width = 5; - // - // DatabaseViewerControl - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - Controls.Add(DataGridView); - Controls.Add(SearchTextBox); - Controls.Add(BindingNavigator); - Name = "DatabaseViewerControl"; - Size = new Size(345, 393); - (BindingNavigator).EndInit(); - ((System.ComponentModel.ISupportInitialize)DataGridView).EndInit(); - ((System.ComponentModel.ISupportInitialize)DbBindingSource).EndInit(); - ((System.ComponentModel.ISupportInitialize)PagesBindingSource).EndInit(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - private CoreBindingNavigator BindingNavigator; - private TextBox SearchTextBox; - private DataGridView DataGridView; - private BindingSource DbBindingSource; - private BindingSource PagesBindingSource; - private DataGridViewTextBoxColumn Id; - private DataGridViewTextBoxColumn EntityName; - private DataGridViewTextBoxColumn Rarity; -} diff --git a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.cs b/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.cs deleted file mode 100644 index f0dc02a..0000000 --- a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.cs +++ /dev/null @@ -1,391 +0,0 @@ -using System.ComponentModel; -using System.Diagnostics.CodeAnalysis; -using Pf2eDataScrapper.Helpers; -using Pf2eModel; -using Pf2eModel.Model.Base; -using Pf2eModel.Model.Common.I18n; -using Pf2eModel.Model.Enum; -using Timer = System.Windows.Forms.Timer; - -namespace Pf2eDataScrapper.Forms.Controls.DatabaseViewer; - -/// -/// Класс элемента управления, который отображает сущности в виде таблицы. -/// -public partial class DatabaseViewerControl : UserControl -{ - #region "Поля и свойства" - - /// - /// Контекст базы данных, который используется для получения сущностей. - /// - public readonly Pf2eDbContext Context = new(); - - /// - /// Количество элементов на странице. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public int PerPage - { - get => _perPage; - set - { - _perPage = value; - UpdateView(); - } - } - private int _perPage = 30; - - /// - /// Номер страницы, которую необходимо отобразить. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public int Page - { - get => _page; - set - { - _page = value; - UpdateView(); - } - } - private int _page = 1; - - /// - /// Тип сущности, которую необходимо отобразить. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public EntityType Type - { - get => _type; - set - { - _page = 1; - _type = value; - UpdateView(); - } - } - private EntityType _type; - - /// - /// Количество элементов, которые были получены из базы данных. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public int Count { get; private set; } - - /// - /// Номер последней страницы, которая может быть отображена. - /// - public int MaxPage => Convert.ToInt32(Math.Ceiling(1.0 * Count / PerPage)); - - /// - /// Выбранная в элементе управления сущность. - /// - [AllowNull] - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public EntityView CurrentEntity { get; private set; } - - /// - /// Флаг, указывающий, что элемент управления занят выполнением запроса к базе данных. - /// - private bool _isBusy; - - /// - /// Объект, который выполняет запрос к базе данных. - /// - private DatabaseQueryPerformer? _performer; - - /// - /// Таймер, который используется для задержки обработки события изменения текста в поле поиска. - /// - private Timer? _typingTimer; - - /// - /// Строка, которая хранит последнее значение, введенное в поле поиска. - /// - private string _lastSearch = ""; - - #endregion - - /// - /// Конструктор класса, который инициализирует элемент управления и связывает его с источником данных. - /// - public DatabaseViewerControl() - { - InitializeComponent(); - - BindingNavigator.BindingSource = DbBindingSource; - //DataGridView.AutoGenerateColumns = true; - DataGridView.SelectionMode = DataGridViewSelectionMode.FullRowSelect; - - _isBusy = false; - } - - #region "События элемента управления" - - /// - /// Обработчик события, который вызывается при изменении текущей страницы в элементе управления. - /// - /// Источник события. - /// Объект, содержащий данные события. - private void BindingNavigator_RefreshItems(object sender, EventArgs e) - { - if (_isBusy) - { - return; - } - - Page = (int)(BindingNavigator?.BindingSource?.Current ?? 1); - UpdateView(); - } - - /// - /// Обработчик события, который вызывается при изменении выделенной строки в элементе управления DataGridView. - /// - /// Источник события. - /// Объект, содержащий данные события. - private void DataGridView_RowStateChanged(object sender, DataGridViewRowStateChangedEventArgs e) - { - if (_isBusy) - { - return; - } - - UpdateEntity(); - } - - /// - /// Обработчик события, который вызывается когда поле поиска теряет фокус. - /// - /// Источник события. - /// Объект, содержащий данные события. - private void SearchTextBox_Leave(object sender, EventArgs e) - { - if (_isBusy || SearchTextBox.Text == _lastSearch) - { - return; - } - - UpdateView(); - } - - /// - /// Обработчик события, который вызывается при изменении текста в поле поиска. - /// - /// Источник события. - /// Объект, содержащий данные события. - private void SearchTextBox_TextChanged(object sender, EventArgs e) - { - if (_isBusy) - { - return; - } - - if (_typingTimer == null) - { - _typingTimer = new(); - _typingTimer.Interval = 3000; - _typingTimer.Tick += HandleTypingTimerTimeout; - } - _typingTimer.Stop(); // Resets the timer - _typingTimer.Tag = (sender as TextBox)!.Text; // This should be done with EventArgs - _typingTimer.Start(); - } - - /// - /// Обработчик события, который вызывается при истечении времени таймера ввода текста. - /// - /// Источник события. - /// Объект, содержащий данные события. - private void HandleTypingTimerTimeout(object? sender, EventArgs e) - { - if (_isBusy || sender is not Timer timer) - { - return; - } - - UpdateView(); - timer.Stop(); - } - - #endregion - - #region "Обновление данных" - - /// - /// Устанавливает статус занятости элемента управления. - /// - /// Новый статус занятости. - private void SetBusyStatus(bool busy) - { - if (InvokeRequired) - { - Invoke(SetBusyStatus, busy); - return; - } - - _isBusy = busy; - - BindingNavigator.Enabled = !busy; - DataGridView.Enabled = !busy; - SearchTextBox.Enabled = !busy; - - DataGridView.ColumnHeadersHeightSizeMode = !busy - ? DataGridViewColumnHeadersHeightSizeMode.AutoSize - : DataGridViewColumnHeadersHeightSizeMode.DisableResizing; - } - - /// - /// Обновляет данные в элементе управления. - /// - /// Проигнорировать флаг занятости. - public void UpdateView(bool force = false) - { - if (_isBusy && !force) - { - return; - } - - SetBusyStatus(true); - - _performer?.Abort(); - - _performer = new() - { - Type = Type, - Page = Page, - PerPage = PerPage, - Search = SearchTextBox.Text, - }; - - _performer.OnQueryCompleted += HandleQueryCompleted; - - _performer.Query(); - } - - /// - /// Обработчик события, который вызывается по завершении выполнения запроса к базе данных. - /// - /// Источник события. - /// Результат выполнения события - private void HandleQueryCompleted(DatabaseQueryPerformer sender, DatabaseQueryResult result) - { - if (sender != _performer) - { - return; - } - - Count = result.Count; - _lastSearch = SearchTextBox.Text; - - InvokeControl( - BindingNavigator, - b => - { - PagesBindingSource.DataSource = Enumerable.Range(1, MaxPage).ToList(); - b.BindingSource = PagesBindingSource; - } - ); - - InvokeControl( - DataGridView, - view => - { - view.DataSource = result - .Entities.Select(e => new EntityGridRow(e)) - .OrderBy(r => r.Id) - .ToList(); - - SetBusyStatus(false); - - if (view.Rows.Count > 0) - { - view.Rows[0].Selected = true; - UpdateEntity(); - } - } - ); - } - - /// - /// Вызывает действие на указанном элементе управления в нужном потоке , если это необходимо. - /// - /// - /// - /// - private void InvokeControl(T control, Action action) - where T : Control - { - if (control.InvokeRequired) - { - control.Invoke(action, control); - } - else - { - action(control); - } - } - - /// - /// Обновить сущность, которая была выбрана в элементе управления DataGridView. - /// - private void UpdateEntity() - { - if (DataGridView.SelectedRows.Count == 0) - { - return; - } - - EntityGridRow? data = (EntityGridRow?)DataGridView.SelectedRows[0].DataBoundItem; - - try - { - CurrentEntity = data is not null ? new(Context, Type, data.Id) : null; - } - catch (Exception) - { - // ignored - } - - EntityChange?.Invoke(CurrentEntity); - } - - #endregion - - #region Output events - - /// - /// Делегат, который будет вызван при изменении выбранной сущности. - /// - /// Новая выбранная сущность. - public delegate void EntityChangeHandler(EntityView newEntity); - - /// - /// Событие, которое вызывается при изменении выбранной сущности. - /// - public event EntityChangeHandler? EntityChange; - - #endregion - - /// - /// Класс, который представляет строку в таблице сущностей. - /// - /// Сущность, связанная со строкой - internal class EntityGridRow(Entity entity) - { - /// - /// Идентификатор сущности. - /// - public int Id { get; set; } = entity.Id; - - /// - /// Название сущности. - /// - public string Name { get; set; } = entity.Name[LocaleType.English]; - - /// - /// Редкость сущности. - /// - public EntityRarity Rarity { get; set; } = entity.Rarity; - } -} diff --git a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.resx b/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.resx deleted file mode 100644 index aea47c3..0000000 --- a/Pf2eDataScrapper/Forms/Controls/DatabaseViewer/DatabaseViewerControl.resx +++ /dev/null @@ -1,132 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - True - - - True - - - 17, 17 - - - 163, 17 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.Designer.cs b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.Designer.cs deleted file mode 100644 index e6444fd..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.Designer.cs +++ /dev/null @@ -1,60 +0,0 @@ -namespace Pf2eDataScrapper.Forms.Controls.EntityTreeViewer; - -sealed partial class EntityTreeViewerControl -{ - /// - /// Обязательная переменная конструктора. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Освободить все используемые ресурсы. - /// - /// истинно, если управляемый ресурс должен быть удален; иначе ложно. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Код, автоматически созданный конструктором компонентов - - /// - /// Требуемый метод для поддержки конструктора — не изменяйте - /// содержимое этого метода с помощью редактора кода. - /// - private void InitializeComponent() - { - ContentPanel = new PictureBox(); - ((System.ComponentModel.ISupportInitialize)ContentPanel).BeginInit(); - SuspendLayout(); - // - // ContentPanel - // - ContentPanel.Location = new Point(0, 0); - ContentPanel.Name = "ContentPanel"; - ContentPanel.Size = new Size(400, 500); - ContentPanel.TabIndex = 0; - ContentPanel.TabStop = false; - ContentPanel.MouseMove += ContentPanel_MouseMove; - // - // EntityTreeViewerControl - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - AutoScroll = true; - Controls.Add(ContentPanel); - Name = "EntityTreeViewerControl"; - Size = new Size(400, 500); - Resize += EntityTreeViewerControl_Resize; - ((System.ComponentModel.ISupportInitialize)ContentPanel).EndInit(); - ResumeLayout(false); - } - - #endregion - - public PictureBox ContentPanel; -} diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.cs b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.cs deleted file mode 100644 index e05d7b3..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.cs +++ /dev/null @@ -1,407 +0,0 @@ -using System.ComponentModel; -using Pf2eDataScrapper.Helpers; -using Pf2eDataScrapper.WPF.ViewModels.EntityViewStructure; - -namespace Pf2eDataScrapper.Forms.Controls.EntityTreeViewer; - -/// -/// Элемент управления для отображения структуры сущности. -/// -public sealed partial class EntityTreeViewerControl : UserControl -{ - #region "Поля элемента управления" - - /// - /// Высота строки поля структуры. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - [Category("Entity Render")] - [Description("The height of each item in the tree view.")] - public int ItemHeight - { - get => _itemHeight; - set - { - _itemHeight = value; - UpdateView(); - } - } - private int _itemHeight = 20; - - /// - /// Сущность, которая будет отображаться в элементе управления. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public EntityView? EntityView - { - get => _entityView; - set - { - _entityView = value; - UpdateData(); - } - } - private EntityView? _entityView; - - /// - /// Ширина отступа глубины. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - [Category("Entity Render")] - [Description("The size of tab.")] - public int DepthSize - { - get => _depthSize; - set - { - _depthSize = value; - UpdateView(); - } - } - private int _depthSize = 20; - - /// - /// Размер шрифта типа поля сущности. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - [Category("Entity Render")] - [Description("The size of tab.")] - public float TypeFontSize - { - get => _typeFontSize; - set - { - _typeFontSize = value; - UpdateView(); - } - } - private float _typeFontSize = 9.5f; - - /// - /// Размер кнопки плюс/минус. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - [Category("Entity Render")] - [Description("The size of plus/minus button.")] - public int ButtonSize - { - get => _buttonSize; - set - { - _buttonSize = value; - UpdateView(); - } - } - private int _buttonSize = 20; - - /// - /// Ширина имени поля сущности. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public int NameWidth { get; private set; } = 200; - - /// - /// Цвет фона строки поля при наведении на элемент управления. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Visible)] - [Category("Entity Render")] - [Description("Color on item hover.")] - public Color HoverColor - { - get => _hoverColor; - set - { - _hoverColor = value; - UpdateView(); - } - } - private Color _hoverColor = SystemColors.ControlDark; - - /// - /// Изображение, используемое для отображения содержимого элемента управления. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public Bitmap ContentImage { get; set; } - - #endregion - - #region "Вычисляемые поля" - - /// - /// Ширина области содержимого элемента управления. - /// - [Browsable(false)] - [EditorBrowsable(EditorBrowsableState.Never)] - public int ContentWidth => Width - SystemInformation.VerticalScrollBarWidth - 2; - - #endregion - - #region "Приватные поля" - - - /// - /// Коллекция полей структуры. - /// - private readonly List _rows = []; - - /// - /// Коллекция строк полей структуры, которые будут отображаться в элементе управления. - /// - private List _viewerRows = []; - - /// - /// Флаг, указывающий, что элемент управления в данный момент перерисовывается. - /// - private bool _rendering; - - #endregion - - /// - /// Конструктор класса . - /// - public EntityTreeViewerControl() - { - InitializeComponent(); - - ContentImage = new(ContentWidth, Height); - DoubleBuffered = true; - VerticalScroll.Visible = true; - HorizontalScroll.Visible = false; - - ContentPanel.MouseWheel += ContentPanel_MouseWheel; - } - - #region "Методы обновления" - - /// - /// Обновление данных в элементе управления. - /// - public void UpdateData() - { - if (EntityView?.Entity is null) - { - return; - } - - _rows.Clear(); - ContentPanel.Controls.Clear(); - - StructureBuilder builder = new(); - - _rows.Add(builder.Create("Entity", EntityView.Entity)); - - if (EntityView.SubEntity is not null) - { - string typeName = EntityView.SubEntity.GetType().Name; - - _rows.Add(builder.Create(typeName, EntityView.SubEntity)); - } - - _viewerRows = _rows - .SelectMany(r => r.GetRows(row => new EntityTreeViewerControlRow(this, row))) - .ToList(); - - UpdateRenders(); - } - - /// - /// Обновление отрисовок в элементе управления. - /// - public void UpdateRenders() - { - if (EntityView?.Entity is null) - { - return; - } - - int maxNameWidth = -1; - - foreach (EntityTreeViewerControlRow row in _viewerRows) - { - int nameWidth = row.NameWidth + row.Item.Depth * DepthSize; - maxNameWidth = Math.Max(maxNameWidth, nameWidth); - } - - NameWidth = maxNameWidth + 3; - - // Debug.WriteLine($@"Height Inner {ContentWidth} / Outer {Width}"); - // Debug.WriteLine($@"Name {NameWidth} / Full {ContentWidth}"); - - foreach (EntityTreeViewerControlRow row in _viewerRows) - { - row.UpdateCache(); - } - - UpdateView(); - } - - /// - /// Обновление отображения в элементе управления. - /// - public void UpdateView() - { - if (EntityView?.Entity is null) - { - return; - } - - _viewerRows.ForEach(row => row.UpdateButton()); - - List rows = _viewerRows.Where(r => r.Item.Visible).ToList(); - if (rows.Count == 0) - { - return; - } - - BuildLadder(rows); - - _rendering = true; - ContentImage = new(ContentWidth, rows.Count * ItemHeight); - Graphics g = Graphics.FromImage(ContentImage); - - int viewRow = 0; - foreach (EntityTreeViewerControlRow row in rows) - { - row.ViewIndex = viewRow++; - row.Invalidate(g); - } - - g.Save(); - - ContentPanel.Image = ContentImage; - ContentPanel.Width = ContentImage.Width; - ContentPanel.Height = ContentImage.Height; - - _rendering = false; - } - - #endregion - - #region "Вспомогательные методы" - - /// - /// Построение лестницы для строк полей структуры. - /// - /// Набор строк полей структуры. - private void BuildLadder(List rows) - { - List lastLadder = []; - - for (int i = rows.Count - 1; i >= 0; i--) - { - EntityTreeViewerControlRow row = rows[i]; - List ladder; - - if (row.Depth == 0) - { - ladder = []; - } - else if (row.Depth < lastLadder.Count) - { - ladder = - [ - .. lastLadder[..(row.Depth - 1)], - lastLadder[row.Depth - 1] == LadderType.Empty - ? LadderType.Last - : LadderType.Through, - ]; - } - else if (row.Depth == lastLadder.Count) - { - ladder = lastLadder; - } - else - { - ladder = - [ - .. lastLadder, - .. Enumerable.Repeat(LadderType.Empty, row.Depth - lastLadder.Count - 1), - LadderType.Last, - ]; - } - - row.Ladder = ladder; - - lastLadder = ladder - .Select(l => (l == LadderType.Last) ? LadderType.Through : l) - .ToList(); - } - } - - #endregion - - #region "События элемента управления" - - /// - /// Обработчик события изменения размера элемента управления. - /// - /// Источник события. - /// Объект события. - private void EntityTreeViewerControl_Resize(object sender, EventArgs e) - { - if (_rendering) - { - return; - } - - ContentPanel.Width = Width; - - UpdateRenders(); - } - - /// - /// Обработчик события прокрутки элемента управления. - /// - /// Источник события. - /// Объект события. - private void ContentPanel_MouseWheel(object? sender, MouseEventArgs e) - { - /* - int initValue = VerticalScroll.Value; - int delta = -e.Delta / 120; - - VerticalScroll.Value = Math.Clamp( - initValue + delta, - VerticalScrollBar.Minimum, - VerticalScrollBar.Maximum - VerticalScrollBar.LargeChange + 1 - ); - - if (VerticalScrollBar.Value != initValue) - { - ContentPanel.Invalidate(); - } - */ - } - - /// - /// Обработчик события движения мыши над элементом управления. - /// - /// Источник события. - /// Объект события. - private void ContentPanel_MouseMove(object sender, MouseEventArgs e) - { - PointF p = new(e.X, e.Y); - - foreach (EntityTreeViewerControlRow row in _viewerRows) - { - bool contained = row.Target.Contains(p); - - if (contained != row.Hovered) - { - Rectangle r = new(); - row.RealTarget.Intersect(r); - ContentPanel.Invalidate(r); - } - - row.Hovered = contained; - } - } - - #endregion -} diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.resx b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControlRow.cs b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControlRow.cs deleted file mode 100644 index f8c204f..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityTreeViewerControlRow.cs +++ /dev/null @@ -1,607 +0,0 @@ -using FontAwesome.Sharp; -using Pf2eDataScrapper.WPF.ViewModels.EntityViewStructure; -using Font = System.Drawing.Font; -using FontStyle = System.Drawing.FontStyle; -using Image = System.Drawing.Image; - -namespace Pf2eDataScrapper.Forms.Controls.EntityTreeViewer; - -/// -/// Элемент управления для отображения строки поля сущности. -/// -internal class EntityTreeViewerControlRow -{ - /// - /// Элемент управления, которому принадлежит эта строка. - /// - public readonly EntityTreeViewerControl ParentControl; - - /// - /// Отображаемая строка поля сущности. - /// - public readonly StructureField Item; - - #region "Поля строки" - - /// - /// Кэш изображения строки. - /// - public Image Cache - { - get - { - if (_cache == null) - { - UpdateCache(); - } - return _cache!; - } - set => _cache = value; - } - private Image? _cache; - - /// - /// Кэш изображения строки при наведении. - /// - public Image HoveredCache - { - get - { - if (_hoveredCache == null) - { - UpdateCache(); - } - return _hoveredCache!; - } - set => _hoveredCache = value; - } - private Image? _hoveredCache; - - /// - /// Список типов лестницы. - /// - public List Ladder - { - get => _ladder; - set - { - _ladder = value; - _cache = null; - } - } - private List _ladder = []; - - /// - /// Проверяет, находится ли курсор над строкой. - /// - public bool Hovered - { - get => _hovered; - set - { - if (value != _hovered) - { - _hovered = value; - Invalidate(); - } - } - } - private bool _hovered; - - /// - /// Индекс строки в представлении. - /// - public int ViewIndex { get; set; } // = -1; - - /// - /// Кнопка раскрытия/сворачивания. - /// - public IconButton? Button { get; set; } - - #endregion - - #region "Поля для рендеринга" - - /// - public Font Font - { - get => ParentControl.Font; - set => ParentControl.Font = value; - } - - /// - public Color ForeColor - { - get => ParentControl.ForeColor; - set => ParentControl.ForeColor = value; - } - - /// - public Color BackColor - { - get => ParentControl.BackColor; - set => ParentControl.BackColor = value; - } - - /// - public Color HoverColor - { - get => ParentControl.HoverColor; - set => ParentControl.HoverColor = value; - } - - /// - public int ItemHeight - { - get => ParentControl.ItemHeight; - set => ParentControl.ItemHeight = value; - } - - /// - public int DepthSize - { - get => ParentControl.DepthSize; - set => ParentControl.DepthSize = value; - } - - /// - public int ButtonSize - { - get => ParentControl.ButtonSize; - set => ParentControl.ButtonSize = value; - } - - /// - public float TypeFontSize - { - get => ParentControl.TypeFontSize; - set => ParentControl.TypeFontSize = value; - } - - #endregion - - #region "Вычисляемые поля" - - /// - /// Ширина строки. - /// - public int Width => ParentControl.ContentWidth; - - /// - /// Высота строки. - /// - public int Height => ItemHeight; - - /// - /// Флаг наличия кнопки. - /// - public bool HasButton => Item.FieldType == StructureFieldType.Complex; - - /// - /// Глубина отображения строки. - /// - public int Depth => Item.Depth; - - /// - /// Ширина имени в строке. - /// - public int NameWidth - { - get - { - Graphics g = Graphics.FromImage(Cache); - return Convert.ToInt32(g.MeasureString(Item.Name, Font).Width + DepthSize); - } - } - - /// - /// Строковое представление типа поля. - /// - public string TypeText - { - get - { - string result = Item.GetTypeString(); - if (result != "") - { - result = $@"({result})"; - } - return result; - } - } - - /// - /// Шрифт для отображения типа поля. - /// - public Font TypeFont => new(Font.FontFamily, TypeFontSize); - - /// - /// Строковое представление значения поля. - /// - public string ValueText => Item.GetValueString(); - - /// - /// Шрифт для отображения значения поля. - /// - public Font ValueFont => - new( - Font.FontFamily, - Font.Size, - Item.FieldType == StructureFieldType.Complex ? FontStyle.Italic : FontStyle.Regular - ); - - /// - /// Прямоугольник, занимаемый строкой в представлении. - /// - public RectangleF Target => new(0, ViewIndex * Height, Width, Height); - - /// - /// Прямоугольник, занимаемый строкой в родительском представлении. - /// - public RectangleF RealTarget => - new(0, ViewIndex * Height - ParentControl.VerticalScroll.Value, Width, Height); - - #endregion - - /// - /// Список данных для рендеринга строк. - /// - private readonly List _renderData = []; - - #region "Основные методы" - - /// - /// Создание элемента управления строки поля сущности. - /// - /// Родительский элемент управления. - /// Строка поля структуры объекта. - public EntityTreeViewerControlRow(EntityTreeViewerControl parent, StructureField item) - { - ParentControl = parent; - Item = item; - ApplyItem(); - UpdateCache(); - - UpdateButton(); - } - - /// - /// Применение свойств к элементу управления. - /// - private void ApplyItem() - { - _renderData.Clear(); - - _renderData.Add(new(Item.Name, Font, ForeColor)); - _renderData.Add(new(TypeText, TypeFont, GetValueColor())); - _renderData.Add( - new(ValueText.Replace("\r", "").Replace('\n', ' '), ValueFont, GetValueColor()) - ); - - if (HasButton) - { - Button = new() - { - Width = ButtonSize, - Height = ButtonSize, - IconSize = ButtonSize, - IconChar = IconChar.MinusSquare, - ImageAlign = ContentAlignment.MiddleCenter, - TextAlign = ContentAlignment.MiddleCenter, - Visible = false, - }; - - Button.Click += Button_Click; - - ParentControl.ContentPanel.Controls.Add(Button); - } - } - - /// - /// Обновление кэша изображения строки. - /// - public void UpdateCache() - { - Cache = RenderCache(BackColor); - HoveredCache = RenderCache(HoverColor); - } - - /// - /// Создание кэша изображения строки. - /// - /// Цвет заднего фона. - /// Кеш изображения строки. - private Image RenderCache(Color backColor) - { - Image cache = new Bitmap(Width, Height); - Graphics g = Graphics.FromImage(cache); - - g.FillRectangle(new SolidBrush(backColor), 0, 0, Width, Height); - - RenderLadder(g); - RenderContent(g); - - g.Save(); - return cache; - } - - /// - /// Запрос на перерисовку строки. - /// - /// Графический объект. - public void Invalidate(Graphics? g = null) - { - g ??= Graphics.FromImage(ParentControl.ContentImage); - - g.DrawImage(Hovered ? HoveredCache : Cache, Target); - - UpdateButton(); - } - - #endregion - - #region "Кнопка" - - /// - /// Обновление кнопки раскрытия/сворачивания. - /// - public void UpdateButton() - { - if (Button is null) - { - return; - } - - int cx = Convert.ToInt32((0.5 + Depth) * DepthSize - 0.5 * ButtonSize); - int cy = Convert.ToInt32((0.5 + ViewIndex) * ItemHeight - 0.5 * ButtonSize); - - Button.Left = cx; - Button.Top = cy; - - Button!.IconChar = ((StructureFieldComplex)Item).Collapsed - ? IconChar.PlusSquare - : IconChar.MinusSquare; - Button.Visible = Item.Visible; - } - - /// - /// Событие нажатия кнопки раскрытия/сворачивания. - /// - /// Источник события. - /// Событие нажатие кнопки - private void Button_Click(object? sender, EventArgs e) - { - if (Item is StructureFieldComplex complex) - { - complex.Collapsed = !complex.Collapsed; - ParentControl.UpdateView(); - } - } - - #endregion - - #region "Отрисовка" - - /// - /// Отрисовка лестницы. - /// - /// Графический объект. - private void RenderLadder(Graphics g) - { - int n = Depth; - int h = ItemHeight; - int w = DepthSize; - - if (_ladder.Count < Depth) - { - return; - } - - Pen pen = new(Color.FromArgb(127, ForeColor.R, ForeColor.G, ForeColor.B), 1); - pen.DashStyle = System.Drawing.Drawing2D.DashStyle.Dot; - - float cy = 0.5f * h; - - for (int i = 0; i < n; i++) - { - float cx = (i + 1.5f) * w; - - switch (_ladder[i]) - { - case LadderType.Last: - g.DrawLine(pen, cx, 0, cx, cy); - break; - case LadderType.Through: - g.DrawLine(pen, cx, 0, cx, h); - break; - case LadderType.Empty: - default: - break; - } - - if (i == n - 1) - { - g.DrawLine(pen, cx, cy, (i + 2) * w, cy); - } - } - } - - /// - /// Отрисовка содержимого строки. - /// - /// Графический объект. - private void RenderContent(Graphics g) - { - float[] xs = - [ - DepthSize * (Item.Depth + 1), - ParentControl.NameWidth, - ParentControl.NameWidth + g.MeasureString(TypeText, TypeFont).Width + 3, - Width, - ]; - - Pen _ = new(Color.Aqua, 1); - - for (int i = 0; i < 3; i++) - { - StringRenderData item = _renderData[i]; - - item.Left = xs[i]; - item.Width = xs[i + 1] - xs[i]; - item.Height = ItemHeight; - - // g.DrawRectangle(p, item.Rect); - item.Draw(g); - } - } - - #endregion - - #region Функции-помощники в отрисовке - - /// - /// Смешивание цвета с цветом текста. - /// - /// Цвет оттенка. - /// Степень смешения. - /// Смешенный цвет. - private Color BlendColor(Color color, double rate = 0.5) - { - return BlendColor(ForeColor, color, rate); - } - - /// - /// Смешивание цветов. - /// - /// Первый смешиваемый цвет. - /// Второй смешиваемый цвет. - /// Степень смешения. - /// Смешенный цвет. - private Color BlendColor(Color color1, Color color2, double rate) - { - return Color.FromArgb( - Mix(color1.A, color2.A), - Mix(color1.R, color2.R), - Mix(color1.G, color2.G), - Mix(color1.B, color2.B) - ); - - int Mix(int a, int b) => Convert.ToInt32(Math.Round(a * rate + b * (1 - rate))); - } - - /// - /// Получение цвета текста по типу значения поля. - /// - /// Цвет текста. - public Color GetValueColor() - { - return Item switch - { - StructureFieldPrimitive primitive => Type.GetTypeCode(primitive.Type) switch - { - TypeCode.Boolean => BlendColor(Color.DarkGoldenrod), - TypeCode.Int32 => BlendColor(Color.Blue), - TypeCode.Double => BlendColor(Color.Aqua), - TypeCode.String => BlendColor(Color.Green), - _ => ForeColor, - }, - StructureFieldEnum => BlendColor(Color.Red), - StructureFieldNull => BlendColor(BackColor), - _ => ForeColor, - }; - } - - #endregion - - /// - /// Класс для хранения данных рендеринга строки. - /// - /// Текст отображаемой строки. - /// Шрифт отображаемой строки. - /// Цвет отображаемой строки. - private class StringRenderData(string text, Font font, Color color) - { - /// - /// Текст отображаемой строки. - /// - public string Text { get; } = text; - - /// - /// Шрифт отображаемой строки. - /// - public Font Font { get; } = font; - - /// - /// Цвет отображаемой строки. - /// - public Color Color { get; } = color; - - /// - /// Левый край отображаемой строки. - /// - public float Left { get; set; } - - /// - /// Ширина отображаемой строки. - /// - public float Width { get; set; } - - /// - /// Высота отображаемой строки. - /// - public float Height { get; set; } - - /// - /// Прямоугольник, занимаемый строкой. - /// - public RectangleF Rect => new(Left, 0, Width, Height); - - /// - /// Уместить строку в занимаемый прямоугольник. - /// - /// Элемент графики. - /// Занимаемый прямоугольник - /// Строка, на которую будет заканчиваться значнеие при переполнении. - /// - private string Fit(Graphics g, RectangleF rect, string filler = "…") - { - if (Text.Length == 0 || g.MeasureString(Text, Font).Width <= rect.Width) - { - return Text; - } - - string txt = Text.Length > 100 ? Text[..100] : Text; - - int i = txt.Length; - - while (g.MeasureString(txt + filler, Font).Width > rect.Width) - { - txt = txt[..--i]; - if (i == 0) - break; - } - - return txt + filler; - } - - /// - /// Отрисовка строки. - /// - /// Элемент графики. - public void Draw(Graphics g) - { - g.DrawString( - Fit(g, Rect), - Font, - new SolidBrush(Color), - Rect, - new StringFormat - { - Alignment = StringAlignment.Near, - LineAlignment = StringAlignment.Center, - FormatFlags = StringFormatFlags.NoWrap, - } - ); - } - } -} diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.Designer.cs b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.Designer.cs deleted file mode 100644 index 6ac4ecf..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.Designer.cs +++ /dev/null @@ -1,36 +0,0 @@ -namespace Pf2eDataScrapper.Forms.Controls.EntityTreeViewer; - -partial class EntityViewerControl -{ - /// - /// Обязательная переменная конструктора. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Освободить все используемые ресурсы. - /// - /// истинно, если управляемый ресурс должен быть удален; иначе ложно. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Код, автоматически созданный конструктором компонентов - - /// - /// Требуемый метод для поддержки конструктора — не изменяйте - /// содержимое этого метода с помощью редактора кода. - /// - private void InitializeComponent() - { - components = new System.ComponentModel.Container(); - this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - } - - #endregion -} diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.cs b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.cs deleted file mode 100644 index c9cab89..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.cs +++ /dev/null @@ -1,18 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Data; -using System.Drawing; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using System.Windows.Forms; - -namespace Pf2eDataScrapper.Forms.Controls.EntityTreeViewer; -public partial class EntityViewerControl : UserControl -{ - public EntityViewerControl() - { - InitializeComponent(); - } -} diff --git a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.resx b/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.resx deleted file mode 100644 index 1af7de1..0000000 --- a/Pf2eDataScrapper/Forms/Controls/EntityTreeViewer/EntityViewerControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.Designer.cs b/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.Designer.cs deleted file mode 100644 index bc10be6..0000000 --- a/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.Designer.cs +++ /dev/null @@ -1,60 +0,0 @@ -namespace Pf2eDataScrapper.Forms.Controls; - -partial class ProcessorCollectionControl -{ - /// - /// Обязательная переменная конструктора. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Освободить все используемые ресурсы. - /// - /// истинно, если управляемый ресурс должен быть удален; иначе ложно. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Код, автоматически созданный конструктором компонентов - - /// - /// Требуемый метод для поддержки конструктора — не изменяйте - /// содержимое этого метода с помощью редактора кода. - /// - private void InitializeComponent() - { - RootFlowLayoutPanel = new FlowLayoutPanel(); - SuspendLayout(); - // - // RootFlowLayoutPanel - // - RootFlowLayoutPanel.AutoScroll = true; - RootFlowLayoutPanel.BackColor = SystemColors.Window; - RootFlowLayoutPanel.BorderStyle = BorderStyle.FixedSingle; - RootFlowLayoutPanel.Dock = DockStyle.Fill; - RootFlowLayoutPanel.FlowDirection = FlowDirection.TopDown; - RootFlowLayoutPanel.Location = new Point(0, 0); - RootFlowLayoutPanel.Name = "RootFlowLayoutPanel"; - RootFlowLayoutPanel.Size = new Size(432, 406); - RootFlowLayoutPanel.TabIndex = 0; - RootFlowLayoutPanel.WrapContents = false; - // - // ProcessorCollectionControl - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - Controls.Add(RootFlowLayoutPanel); - Name = "ProcessorCollectionControl"; - Size = new Size(432, 406); - ResumeLayout(false); - } - - #endregion - - private FlowLayoutPanel RootFlowLayoutPanel; -} diff --git a/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.cs b/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.cs deleted file mode 100644 index 2e33460..0000000 --- a/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.cs +++ /dev/null @@ -1,173 +0,0 @@ -using System.ComponentModel; -using Pf2eDataScrapper.App; - -namespace Pf2eDataScrapper.Forms.Controls; - -internal partial class ProcessorCollectionControl : UserControl -{ - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public ProcessorCollection Collection - { - get => _collection; - set - { - _collection = value; - SetContent(); - } - } - private ProcessorCollection _collection = null!; - - public ProcessorCollectionControl() - { - InitializeComponent(); - } - - private Dictionary GroupCheckBoxes { get; } = []; - - private Dictionary GroupFlowLayoutPanels { get; } = []; - - private Dictionary ItemCheckBoxes { get; } = []; - - private void SetContent() - { - RootFlowLayoutPanel.Controls.Clear(); - - foreach (ProcessorGroupEnum group in Enum.GetValues()) - { - GroupCheckBoxes[group] = new() - { - Text = group.GetDescription(), - Tag = group, - Dock = DockStyle.Fill, - ThreeState = true, - Checked = true, - AutoCheck = false, - CheckAlign = ContentAlignment.TopLeft, - }; - - GroupCheckBoxes[group].Click += GroupCheckBox_Click; - - GroupFlowLayoutPanels[group] = new() - { - AutoSize = true, - Dock = DockStyle.Fill, - FlowDirection = FlowDirection.LeftToRight, - WrapContents = true, - BorderStyle = BorderStyle.FixedSingle, - Margin = new(10, 0, 10, 15), - }; - - RootFlowLayoutPanel.Controls.Add(GroupCheckBoxes[group]); - RootFlowLayoutPanel.Controls.Add(GroupFlowLayoutPanels[group]); - } - - foreach (ProcessorCollectionItem item in Collection.AllItems) - { - ItemCheckBoxes[item.Name] = new() - { - Text = item.Description, - Tag = item, - AutoSize = true, - // Dock = DockStyle.Fill, - // MaximumSize = new Size(Width, 20), - // Width = 200, - Checked = item.Active, - CheckAlign = ContentAlignment.TopLeft, - }; - - ItemCheckBoxes[item.Name].CheckedChanged += ItemCheckBox_CheckedChanged; - - GroupFlowLayoutPanels[item.Group].Controls.Add(ItemCheckBoxes[item.Name]); - } - - UpdateContent(); - } - - private void UpdateContent() - { - Dictionary checkStates = []; - List checkedItems = []; - - foreach ((string key, CheckBox checkBox) in ItemCheckBoxes) - { - ProcessorCollectionItem item = Collection[key]; - - if (checkStates.TryGetValue(item.Group, out CheckState state)) - { - /* - * | Checked | Unchecked | Indeterminate - * -------+---------------+---------------+--------------- - * true | Checked | Indeterminate | Indeterminate - * false | Indeterminate | Unchecked | Indeterminate - */ - - checkStates[item.Group] = - checkBox.Checked && state == CheckState.Checked ? CheckState.Checked - : !checkBox.Checked && state == CheckState.Unchecked ? CheckState.Unchecked - : CheckState.Indeterminate; - } - else - { - checkStates[item.Group] = checkBox.Checked - ? CheckState.Checked - : CheckState.Unchecked; - } - - if (checkBox.Checked) - { - checkedItems.Add(key); - } - } - - foreach ((ProcessorGroupEnum groupEnum, CheckBox checkBox) in GroupCheckBoxes) - { - checkBox.CheckState = checkStates.GetValueOrDefault( - groupEnum, - CheckState.Indeterminate - ); - } - - Collection.FilterProcessors(checkedItems); - } - - private void GroupCheckBox_Click(object? sender, EventArgs e) - { - if (sender is null) - { - return; - } - - CheckBox groupCheckBox = (CheckBox)sender; - ProcessorGroupEnum groupEnum = GroupCheckBoxes - .First(pair => pair.Value == groupCheckBox) - .Key; - - CheckState nextState = groupCheckBox.CheckState switch - { - CheckState.Unchecked => CheckState.Checked, - CheckState.Checked => CheckState.Unchecked, - CheckState.Indeterminate => CheckState.Checked, - _ => throw new ArgumentOutOfRangeException( - $"Неизвестное состояние {groupCheckBox.CheckState}" - ), - }; - - groupCheckBox.CheckState = nextState; - - foreach ( - (string _, CheckBox checkBox) in ItemCheckBoxes.Where(pair => - ((ProcessorCollectionItem?)pair.Value.Tag)?.Group == groupEnum - ) - ) - { - checkBox.Checked = nextState == CheckState.Checked; - } - - UpdateContent(); - } - - private void ItemCheckBox_CheckedChanged(object? sender, EventArgs e) - { - UpdateContent(); - } -} diff --git a/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.resx b/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/Pf2eDataScrapper/Forms/Controls/ProcessorCollectionControl.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/EntityViewForm.Designer.cs b/Pf2eDataScrapper/Forms/EntityViewForm.Designer.cs deleted file mode 100644 index 66ae9be..0000000 --- a/Pf2eDataScrapper/Forms/EntityViewForm.Designer.cs +++ /dev/null @@ -1,240 +0,0 @@ -using Pf2eDataScrapper.Forms.Controls.DatabaseViewer; -using Pf2eDataScrapper.Forms.Controls.EntityTreeViewer; - -namespace Pf2eDataScrapper.Forms; - -partial class EntityViewForm -{ - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - RootSplitContainer = new SplitContainer(); - InnerSplitContainer = new SplitContainer(); - TypesListBox = new ListBox(); - ResultSplitContainer = new SplitContainer(); - DescriptionTextBox = new TextBox(); - DatabaseViewer = new DatabaseViewerControl(); - _entityTreeViewerCntrl = new EntityTreeViewerControl(); - MenuStrip = new MenuStrip(); - FileToolStripMenuItem = new ToolStripMenuItem(); - ExitToolStripMenuItem = new ToolStripMenuItem(); - WindowsToolStripMenuItem = new ToolStripMenuItem(); - ImportSettingsWindowsToolStripMenuItem = new ToolStripMenuItem(); - EntityViewWindowToolStripMenuItem = new ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)RootSplitContainer).BeginInit(); - RootSplitContainer.Panel1.SuspendLayout(); - RootSplitContainer.Panel2.SuspendLayout(); - RootSplitContainer.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)InnerSplitContainer).BeginInit(); - InnerSplitContainer.Panel1.SuspendLayout(); - InnerSplitContainer.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)ResultSplitContainer).BeginInit(); - ResultSplitContainer.Panel2.SuspendLayout(); - ResultSplitContainer.SuspendLayout(); - MenuStrip.SuspendLayout(); - SuspendLayout(); - // - // RootSplitContainer - // - RootSplitContainer.Dock = DockStyle.Fill; - RootSplitContainer.Location = new Point(0, 24); - RootSplitContainer.Name = "RootSplitContainer"; - // - // RootSplitContainer.Panel1 - // - RootSplitContainer.Panel1.Controls.Add(InnerSplitContainer); - RootSplitContainer.Panel1MinSize = 200; - // - // RootSplitContainer.Panel2 - // - RootSplitContainer.Panel2.Controls.Add(ResultSplitContainer); - RootSplitContainer.Panel2MinSize = 400; - RootSplitContainer.Size = new Size(1384, 837); - RootSplitContainer.SplitterDistance = 322; - RootSplitContainer.TabIndex = 0; - // - // InnerSplitContainer - // - InnerSplitContainer.Dock = DockStyle.Fill; - InnerSplitContainer.Location = new Point(0, 0); - InnerSplitContainer.Name = "InnerSplitContainer"; - InnerSplitContainer.Orientation = Orientation.Horizontal; - // - // InnerSplitContainer.Panel1 - // - InnerSplitContainer.Panel1.Controls.Add(TypesListBox); - // - // InnerSplitContainer.Panel2 - // - InnerSplitContainer.Panel2.Controls.Add(DatabaseViewer); - InnerSplitContainer.Size = new Size(322, 861); - InnerSplitContainer.SplitterDistance = 126; - InnerSplitContainer.TabIndex = 1; - // - // TypesListBox - // - TypesListBox.Dock = DockStyle.Fill; - TypesListBox.FormattingEnabled = true; - TypesListBox.Location = new Point(0, 0); - TypesListBox.Name = "TypesListBox"; - TypesListBox.Size = new Size(322, 122); - TypesListBox.TabIndex = 0; - TypesListBox.SelectedIndexChanged += TypesListBox_SelectedIndexChanged; - // - // ResultSplitContainer - // - ResultSplitContainer.Dock = DockStyle.Fill; - ResultSplitContainer.Location = new Point(0, 0); - ResultSplitContainer.Name = "ResultSplitContainer"; - // - // ResultSplitContainer.Panel2 - // - ResultSplitContainer.Panel2.Controls.Add(DescriptionTextBox); - ResultSplitContainer.Size = new Size(1058, 837); - ResultSplitContainer.SplitterDistance = 582; - ResultSplitContainer.TabIndex = 1; - // - // DescriptionTextBox - // - DescriptionTextBox.Dock = DockStyle.Fill; - DescriptionTextBox.Font = new Font("Consolas", 9F); - DescriptionTextBox.Location = new Point(0, 0); - DescriptionTextBox.Multiline = true; - DescriptionTextBox.Name = "DescriptionTextBox"; - DescriptionTextBox.ReadOnly = true; - DescriptionTextBox.ScrollBars = ScrollBars.Vertical; - DescriptionTextBox.Size = new Size(472, 837); - DescriptionTextBox.TabIndex = 0; - // - // DatabaseViewer - // - DatabaseViewer.Dock = DockStyle.Fill; - DatabaseViewer.Location = new Point(0, 0); - DatabaseViewer.Name = "DatabaseViewer"; - DatabaseViewer.Size = new Size(322, 731); - DatabaseViewer.TabIndex = 1; - // - // _entityTreeViewerCntrl - // - _entityTreeViewerCntrl.AutoScroll = true; - _entityTreeViewerCntrl.ButtonSize = 15; - _entityTreeViewerCntrl.DepthSize = 15; - _entityTreeViewerCntrl.Dock = DockStyle.Fill; - _entityTreeViewerCntrl.Font = new Font("Consolas", 9F); - _entityTreeViewerCntrl.HoverColor = SystemColors.ControlDark; - _entityTreeViewerCntrl.ItemHeight = 20; - _entityTreeViewerCntrl.Location = new Point(0, 0); - _entityTreeViewerCntrl.Name = "_entityTreeViewerCntrl"; - _entityTreeViewerCntrl.Size = new Size(582, 861); - _entityTreeViewerCntrl.TabIndex = 0; - _entityTreeViewerCntrl.TypeFontSize = 7F; - // - // MenuStrip - // - MenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem, WindowsToolStripMenuItem }); - MenuStrip.Location = new Point(0, 0); - MenuStrip.Name = "MainMenuStrip"; - MenuStrip.Size = new Size(1384, 24); - MenuStrip.TabIndex = 1; - MenuStrip.Text = "menuStrip1"; - // - // FileToolStripMenuItem - // - FileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ExitToolStripMenuItem }); - FileToolStripMenuItem.Name = "FileToolStripMenuItem"; - FileToolStripMenuItem.Size = new Size(48, 20); - FileToolStripMenuItem.Text = "Файл"; - // - // ExitToolStripMenuItem - // - ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"; - ExitToolStripMenuItem.Size = new Size(109, 22); - ExitToolStripMenuItem.Text = "Выход"; - ExitToolStripMenuItem.Click += ExitToolStripMenuItem_Click; - // - // WindowsToolStripMenuItem - // - WindowsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ImportSettingsWindowsToolStripMenuItem, EntityViewWindowToolStripMenuItem }); - WindowsToolStripMenuItem.Name = "WindowsToolStripMenuItem"; - WindowsToolStripMenuItem.Size = new Size(47, 20); - WindowsToolStripMenuItem.Text = "Окна"; - // - // ImportSettingsWindowsToolStripMenuItem - // - ImportSettingsWindowsToolStripMenuItem.Name = "ImportSettingsWindowsToolStripMenuItem"; - ImportSettingsWindowsToolStripMenuItem.Size = new Size(228, 22); - ImportSettingsWindowsToolStripMenuItem.Text = "Настройка импорта данных"; - ImportSettingsWindowsToolStripMenuItem.Click += ImportSettingsWindowsToolStripMenuItem_Click; - // - // EntityViewWindowToolStripMenuItem - // - EntityViewWindowToolStripMenuItem.Enabled = false; - EntityViewWindowToolStripMenuItem.Name = "EntityViewWindowToolStripMenuItem"; - EntityViewWindowToolStripMenuItem.Size = new Size(228, 22); - EntityViewWindowToolStripMenuItem.Text = "Просмотр сущностей"; - // - // EntityViewForm - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(1384, 861); - Controls.Add(RootSplitContainer); - Controls.Add(MenuStrip); - Name = "EntityViewForm"; - Text = "DataBaseViewer"; - RootSplitContainer.Panel1.ResumeLayout(false); - RootSplitContainer.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)RootSplitContainer).EndInit(); - RootSplitContainer.ResumeLayout(false); - InnerSplitContainer.Panel1.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)InnerSplitContainer).EndInit(); - InnerSplitContainer.ResumeLayout(false); - ResultSplitContainer.Panel2.ResumeLayout(false); - ResultSplitContainer.Panel2.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)ResultSplitContainer).EndInit(); - ResultSplitContainer.ResumeLayout(false); - MenuStrip.ResumeLayout(false); - MenuStrip.PerformLayout(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private SplitContainer RootSplitContainer; - private SplitContainer InnerSplitContainer; - private ListBox TypesListBox; - private SplitContainer ResultSplitContainer; - private TextBox DescriptionTextBox; - private EntityTreeViewerControl _entityTreeViewerCntrl; - private DatabaseViewerControl DatabaseViewer; - private MenuStrip MenuStrip; - private ToolStripMenuItem FileToolStripMenuItem; - private ToolStripMenuItem ExitToolStripMenuItem; - private ToolStripMenuItem WindowsToolStripMenuItem; - private ToolStripMenuItem ImportSettingsWindowsToolStripMenuItem; - private ToolStripMenuItem EntityViewWindowToolStripMenuItem; -} diff --git a/Pf2eDataScrapper/Forms/EntityViewForm.cs b/Pf2eDataScrapper/Forms/EntityViewForm.cs deleted file mode 100644 index ade43ff..0000000 --- a/Pf2eDataScrapper/Forms/EntityViewForm.cs +++ /dev/null @@ -1,99 +0,0 @@ -using System.ComponentModel; -using Pf2eDataScrapper.Helpers; -using Pf2eModel; -using Pf2eModel.Model.Enum; - -namespace Pf2eDataScrapper.Forms; - -/// -/// Основная форма приложения. -/// -internal partial class EntityViewForm : Form -{ - public Pf2eDbContext Context { get; } - - /// - /// Элемент управления для отображения дерева сущностей. - /// - [DesignerSerializationVisibility(DesignerSerializationVisibility.Hidden)] - public EntityView? CurrentView - { - get => _entityTreeViewerCntrl.EntityView; - set - { - _entityTreeViewerCntrl.EntityView = value; - Application.DoEvents(); - } - } - - /// - /// Конструктор класса . - /// - public EntityViewForm(Pf2eDbContext context) - { - Context = context; - - InitializeComponent(); - - DatabaseViewer.EntityChange += DatabaseViewer_EntityChange; - - Reset(); - } - - /// - /// Сброс состояния формы. - /// - public void Reset() - { - TypesListBox.DataSource = Context - .Entities.Select(e => e.Type) - .Distinct() - .OrderBy(t => t.ToString()) - .ToList(); - - if (TypesListBox.Items.Count > 0) - { - TypesListBox.SelectedIndex = 0; - } - } - - /// - /// Обработчик события изменения выбранного элемента в списке типов сущностей. - /// - /// Источник события. - /// Данные события. - private void TypesListBox_SelectedIndexChanged(object sender, EventArgs _) - { - if (TypesListBox.SelectedItem is null) - { - return; - } - - CurrentView = null; - - DatabaseViewer.Type = (EntityType)TypesListBox.SelectedItem; - } - - /// - /// Обработчик события изменения выбранной сущности в дереве сущностей. - /// - /// Новая выбранная сущность. - private void DatabaseViewer_EntityChange(EntityView newEntity) - { - CurrentView = newEntity; - - DescriptionTextBox.Text = newEntity.Entity!.Description; - } - - private void ExitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void ImportSettingsWindowsToolStripMenuItem_Click(object sender, EventArgs e) - { - ApplicationStateChange?.Invoke(this, ApplicationStage.InitialSettings); - } - - public event ImportApplication.ApplicationStateChangeDelegate? ApplicationStateChange; -} diff --git a/Pf2eDataScrapper/Forms/EntityViewForm.resx b/Pf2eDataScrapper/Forms/EntityViewForm.resx deleted file mode 100644 index 9b2a006..0000000 --- a/Pf2eDataScrapper/Forms/EntityViewForm.resx +++ /dev/null @@ -1,126 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - - 51 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/ProgressForm.Designer.cs b/Pf2eDataScrapper/Forms/ProgressForm.Designer.cs deleted file mode 100644 index 1d2a967..0000000 --- a/Pf2eDataScrapper/Forms/ProgressForm.Designer.cs +++ /dev/null @@ -1,128 +0,0 @@ -namespace Pf2eDataScrapper.Forms; - -partial class ProgressForm -{ - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - ProcessorsProgressBar = new ProgressBar(); - ProcessorsLabel = new Label(); - LocalLabel = new Label(); - LocalProgressBar = new ProgressBar(); - MessageListView = new ListView(); - TimeColumnHeader = new ColumnHeader(); - TypeColumnHeader = new ColumnHeader(); - MessageColumnHeader = new ColumnHeader(); - SuspendLayout(); - // - // ProcessorsProgressBar - // - ProcessorsProgressBar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - ProcessorsProgressBar.Location = new Point(12, 27); - ProcessorsProgressBar.Name = "ProcessorsProgressBar"; - ProcessorsProgressBar.Size = new Size(537, 23); - ProcessorsProgressBar.TabIndex = 0; - // - // ProcessorsLabel - // - ProcessorsLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - ProcessorsLabel.Location = new Point(12, 9); - ProcessorsLabel.Name = "ProcessorsLabel"; - ProcessorsLabel.Size = new Size(537, 15); - ProcessorsLabel.TabIndex = 1; - ProcessorsLabel.Text = "ProcessorsLabel"; - // - // LocalLabel - // - LocalLabel.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - LocalLabel.Location = new Point(12, 59); - LocalLabel.Name = "LocalLabel"; - LocalLabel.Size = new Size(537, 15); - LocalLabel.TabIndex = 2; - LocalLabel.Text = "LocalLabel"; - // - // LocalProgressBar - // - LocalProgressBar.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Right; - LocalProgressBar.Location = new Point(12, 77); - LocalProgressBar.Name = "LocalProgressBar"; - LocalProgressBar.Size = new Size(537, 23); - LocalProgressBar.TabIndex = 3; - // - // MessageListView - // - MessageListView.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - MessageListView.Columns.AddRange(new ColumnHeader[] { TimeColumnHeader, TypeColumnHeader, MessageColumnHeader }); - MessageListView.GridLines = true; - MessageListView.HeaderStyle = ColumnHeaderStyle.Nonclickable; - MessageListView.Location = new Point(12, 114); - MessageListView.Name = "MessageListView"; - MessageListView.Size = new Size(537, 450); - MessageListView.TabIndex = 4; - MessageListView.UseCompatibleStateImageBehavior = false; - MessageListView.View = View.Details; - // - // TimeColumnHeader - // - TimeColumnHeader.Text = "Время"; - TimeColumnHeader.Width = 80; - // - // TypeColumnHeader - // - TypeColumnHeader.Text = "Тип"; - TypeColumnHeader.Width = 80; - // - // MessageColumnHeader - // - MessageColumnHeader.Text = "Сообщение"; - MessageColumnHeader.Width = 2000; - // - // ProgressForm - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(561, 576); - Controls.Add(MessageListView); - Controls.Add(LocalProgressBar); - Controls.Add(LocalLabel); - Controls.Add(ProcessorsLabel); - Controls.Add(ProcessorsProgressBar); - Name = "ProgressForm"; - Text = "ProgressForm"; - ResumeLayout(false); - } - - #endregion - - private ProgressBar ProcessorsProgressBar; - private Label ProcessorsLabel; - private Label LocalLabel; - private ProgressBar LocalProgressBar; - private ListView MessageListView; - private ColumnHeader TimeColumnHeader; - private ColumnHeader TypeColumnHeader; - private ColumnHeader MessageColumnHeader; -} \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/ProgressForm.cs b/Pf2eDataScrapper/Forms/ProgressForm.cs deleted file mode 100644 index 32cdd08..0000000 --- a/Pf2eDataScrapper/Forms/ProgressForm.cs +++ /dev/null @@ -1,72 +0,0 @@ -using Pf2eDataScrapper.Helpers; - -namespace Pf2eDataScrapper.Forms; - -internal partial class ProgressForm : Form -{ - public ProcessProgress Progress { get; } - - public ProgressForm(ProcessProgress progress) - { - Progress = progress; - - InitializeComponent(); - - Progress.ProgressUpdate += Progress_ProgressUpdate; - Progress.ProgressMessage += Progress_ProgressMessage; - - MessageListView - .GetType() - .GetProperty( - "DoubleBuffered", - System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic - )! - .SetValue(MessageListView, true, null); - } - - private void Progress_ProgressUpdate(ProcessProgress sender) - { - if (InvokeRequired) - { - Invoke(Progress_ProgressUpdate, sender); - return; - } - - ProcessorsLabel.Text = sender.Processors.ToString(); - ProcessorsProgressBar.Maximum = sender.Processors.Count; - ProcessorsProgressBar.Value = sender.Processors.Current; - - LocalLabel.Text = sender.Local.ToString(); - LocalProgressBar.Maximum = sender.Local.Count; - LocalProgressBar.Value = sender.Local.Current; - - Application.DoEvents(); - } - - private void Progress_ProgressMessage(ProcessProgress sender, LogLevel level, string message) - { - if (InvokeRequired) - { - Invoke(Progress_ProgressMessage, sender, level, message); - return; - } - - ListViewItem item = new([DateTime.Now.ToString("HH:mm:ss.fff"), level.ToString(), message]) - { - BackColor = level switch - { - LogLevel.Important => Color.Salmon, - LogLevel.Warning => Color.Khaki, - LogLevel.Information => Color.White, - LogLevel.Progress => Color.LightGray, - _ => Color.White, - }, - }; - - MessageListView.Items.Add(item); - //MessageListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent); - //MessageListView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.HeaderSize); - - Application.DoEvents(); - } -} diff --git a/Pf2eDataScrapper/Forms/ProgressForm.resx b/Pf2eDataScrapper/Forms/ProgressForm.resx deleted file mode 100644 index 8b2ff64..0000000 --- a/Pf2eDataScrapper/Forms/ProgressForm.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/StartForm.Designer.cs b/Pf2eDataScrapper/Forms/StartForm.Designer.cs deleted file mode 100644 index 7519395..0000000 --- a/Pf2eDataScrapper/Forms/StartForm.Designer.cs +++ /dev/null @@ -1,236 +0,0 @@ -namespace Pf2eDataScrapper.Forms; - -partial class StartForm -{ - /// - /// Required designer variable. - /// - private System.ComponentModel.IContainer components = null; - - /// - /// Clean up any resources being used. - /// - /// true if managed resources should be disposed; otherwise, false. - protected override void Dispose(bool disposing) - { - if (disposing && (components != null)) - { - components.Dispose(); - } - base.Dispose(disposing); - } - - #region Windows Form Designer generated code - - /// - /// Required method for Designer support - do not modify - /// the contents of this method with the code editor. - /// - private void InitializeComponent() - { - MainSplitContainer = new SplitContainer(); - PropertiesGroupBox = new GroupBox(); - SettingsPropertyGrid = new PropertyGrid(); - ProcessorsGroupBox = new GroupBox(); - ProcessorCollectionControl = new Pf2eDataScrapper.Forms.Controls.ProcessorCollectionControl(); - SelectAllButton = new Button(); - DeselectAllButton = new Button(); - StartButton = new Button(); - MenuStrip = new MenuStrip(); - FileToolStripMenuItem = new ToolStripMenuItem(); - ExitToolStripMenuItem = new ToolStripMenuItem(); - WindowsToolStripMenuItem = new ToolStripMenuItem(); - ImportSettingsWindowsToolStripMenuItem = new ToolStripMenuItem(); - EntityViewWindowToolStripMenuItem = new ToolStripMenuItem(); - StartToolStripMenuItem = new ToolStripMenuItem(); - ((System.ComponentModel.ISupportInitialize)MainSplitContainer).BeginInit(); - MainSplitContainer.Panel1.SuspendLayout(); - MainSplitContainer.Panel2.SuspendLayout(); - MainSplitContainer.SuspendLayout(); - PropertiesGroupBox.SuspendLayout(); - ProcessorsGroupBox.SuspendLayout(); - MenuStrip.SuspendLayout(); - SuspendLayout(); - // - // MainSplitContainer - // - MainSplitContainer.Dock = DockStyle.Fill; - MainSplitContainer.Location = new Point(0, 24); - MainSplitContainer.Name = "MainSplitContainer"; - // - // MainSplitContainer.Panel1 - // - MainSplitContainer.Panel1.Controls.Add(PropertiesGroupBox); - MainSplitContainer.Panel1MinSize = 300; - // - // MainSplitContainer.Panel2 - // - MainSplitContainer.Panel2.Controls.Add(ProcessorsGroupBox); - MainSplitContainer.Panel2.Controls.Add(StartButton); - MainSplitContainer.Panel2MinSize = 300; - MainSplitContainer.Size = new Size(931, 653); - MainSplitContainer.SplitterDistance = 300; - MainSplitContainer.TabIndex = 0; - // - // PropertiesGroupBox - // - PropertiesGroupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - PropertiesGroupBox.Controls.Add(SettingsPropertyGrid); - PropertiesGroupBox.Location = new Point(3, 3); - PropertiesGroupBox.Name = "PropertiesGroupBox"; - PropertiesGroupBox.Size = new Size(294, 647); - PropertiesGroupBox.TabIndex = 0; - PropertiesGroupBox.TabStop = false; - PropertiesGroupBox.Text = "Свойства"; - // - // SettingsPropertyGrid - // - SettingsPropertyGrid.BackColor = SystemColors.Control; - SettingsPropertyGrid.Dock = DockStyle.Fill; - SettingsPropertyGrid.Location = new Point(3, 19); - SettingsPropertyGrid.Name = "SettingsPropertyGrid"; - SettingsPropertyGrid.Size = new Size(288, 625); - SettingsPropertyGrid.TabIndex = 0; - // - // ProcessorsGroupBox - // - ProcessorsGroupBox.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - ProcessorsGroupBox.Controls.Add(ProcessorCollectionControl); - ProcessorsGroupBox.Controls.Add(SelectAllButton); - ProcessorsGroupBox.Controls.Add(DeselectAllButton); - ProcessorsGroupBox.Location = new Point(3, 3); - ProcessorsGroupBox.Name = "ProcessorsGroupBox"; - ProcessorsGroupBox.Size = new Size(621, 578); - ProcessorsGroupBox.TabIndex = 1; - ProcessorsGroupBox.TabStop = false; - ProcessorsGroupBox.Text = "Обработчики"; - // - // ProcessorCollectionControl - // - ProcessorCollectionControl.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - ProcessorCollectionControl.Location = new Point(6, 48); - ProcessorCollectionControl.Name = "ProcessorCollectionControl"; - ProcessorCollectionControl.Size = new Size(609, 524); - ProcessorCollectionControl.TabIndex = 2; - // - // SelectAllButton - // - SelectAllButton.Location = new Point(149, 19); - SelectAllButton.Name = "SelectAllButton"; - SelectAllButton.Size = new Size(137, 23); - SelectAllButton.TabIndex = 1; - SelectAllButton.Text = "Выделить все"; - SelectAllButton.UseVisualStyleBackColor = true; - // - // DeselectAllButton - // - DeselectAllButton.Location = new Point(6, 19); - DeselectAllButton.Name = "DeselectAllButton"; - DeselectAllButton.Size = new Size(137, 23); - DeselectAllButton.TabIndex = 0; - DeselectAllButton.Text = "Снять выделение всех"; - DeselectAllButton.UseVisualStyleBackColor = true; - // - // StartButton - // - StartButton.Anchor = AnchorStyles.Bottom | AnchorStyles.Left | AnchorStyles.Right; - StartButton.Font = new Font("Segoe UI", 18F, FontStyle.Bold); - StartButton.Location = new Point(3, 587); - StartButton.Name = "StartButton"; - StartButton.Size = new Size(621, 63); - StartButton.TabIndex = 0; - StartButton.Text = "Запуск"; - StartButton.UseVisualStyleBackColor = true; - StartButton.Click += StartButton_Click; - // - // MenuStrip - // - MenuStrip.Items.AddRange(new ToolStripItem[] { FileToolStripMenuItem, WindowsToolStripMenuItem, StartToolStripMenuItem }); - MenuStrip.Location = new Point(0, 0); - MenuStrip.Name = "MenuStrip"; - MenuStrip.Size = new Size(931, 24); - MenuStrip.TabIndex = 1; - MenuStrip.Text = "menuStrip1"; - // - // FileToolStripMenuItem - // - FileToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ExitToolStripMenuItem }); - FileToolStripMenuItem.Name = "FileToolStripMenuItem"; - FileToolStripMenuItem.Size = new Size(48, 20); - FileToolStripMenuItem.Text = "Файл"; - // - // ExitToolStripMenuItem - // - ExitToolStripMenuItem.Name = "ExitToolStripMenuItem"; - ExitToolStripMenuItem.Size = new Size(109, 22); - ExitToolStripMenuItem.Text = "Выход"; - ExitToolStripMenuItem.Click += ExitToolStripMenuItem_Click; - // - // WindowsToolStripMenuItem - // - WindowsToolStripMenuItem.DropDownItems.AddRange(new ToolStripItem[] { ImportSettingsWindowsToolStripMenuItem, EntityViewWindowToolStripMenuItem }); - WindowsToolStripMenuItem.Name = "WindowsToolStripMenuItem"; - WindowsToolStripMenuItem.Size = new Size(47, 20); - WindowsToolStripMenuItem.Text = "Окна"; - // - // ImportSettingsWindowsToolStripMenuItem - // - ImportSettingsWindowsToolStripMenuItem.Enabled = false; - ImportSettingsWindowsToolStripMenuItem.Name = "ImportSettingsWindowsToolStripMenuItem"; - ImportSettingsWindowsToolStripMenuItem.Size = new Size(228, 22); - ImportSettingsWindowsToolStripMenuItem.Text = "Настройка импорта данных"; - // - // EntityViewWindowToolStripMenuItem - // - EntityViewWindowToolStripMenuItem.Name = "EntityViewWindowToolStripMenuItem"; - EntityViewWindowToolStripMenuItem.Size = new Size(228, 22); - EntityViewWindowToolStripMenuItem.Text = "Просмотр сущностей"; - EntityViewWindowToolStripMenuItem.Click += EntityViewWindowToolStripMenuItem_Click; - // - // StartToolStripMenuItem - // - StartToolStripMenuItem.Name = "StartToolStripMenuItem"; - StartToolStripMenuItem.Size = new Size(108, 20); - StartToolStripMenuItem.Text = "Запуск импорта"; - StartToolStripMenuItem.Click += StartToolStripMenuItem_Click; - // - // StartForm - // - AutoScaleDimensions = new SizeF(7F, 15F); - AutoScaleMode = AutoScaleMode.Font; - ClientSize = new Size(931, 677); - Controls.Add(MainSplitContainer); - Controls.Add(MenuStrip); - Name = "StartForm"; - Text = "Настройки импорта данных"; - Load += StartForm_Load; - MainSplitContainer.Panel1.ResumeLayout(false); - MainSplitContainer.Panel2.ResumeLayout(false); - ((System.ComponentModel.ISupportInitialize)MainSplitContainer).EndInit(); - MainSplitContainer.ResumeLayout(false); - PropertiesGroupBox.ResumeLayout(false); - ProcessorsGroupBox.ResumeLayout(false); - MenuStrip.ResumeLayout(false); - MenuStrip.PerformLayout(); - ResumeLayout(false); - PerformLayout(); - } - - #endregion - - private SplitContainer MainSplitContainer; - private GroupBox PropertiesGroupBox; - private PropertyGrid SettingsPropertyGrid; - private Button StartButton; - private GroupBox ProcessorsGroupBox; - private Button SelectAllButton; - private Button DeselectAllButton; - private Controls.ProcessorCollectionControl ProcessorCollectionControl; - private MenuStrip MenuStrip; - private ToolStripMenuItem FileToolStripMenuItem; - private ToolStripMenuItem ExitToolStripMenuItem; - private ToolStripMenuItem WindowsToolStripMenuItem; - private ToolStripMenuItem ImportSettingsWindowsToolStripMenuItem; - private ToolStripMenuItem EntityViewWindowToolStripMenuItem; - private ToolStripMenuItem StartToolStripMenuItem; -} \ No newline at end of file diff --git a/Pf2eDataScrapper/Forms/StartForm.cs b/Pf2eDataScrapper/Forms/StartForm.cs deleted file mode 100644 index 899bbda..0000000 --- a/Pf2eDataScrapper/Forms/StartForm.cs +++ /dev/null @@ -1,107 +0,0 @@ -using Pf2eDataScrapper.App; - -namespace Pf2eDataScrapper.Forms; - -internal partial class StartForm : Form -{ - private ProcessorCollection ProcessorCollection { get; } - public ApplicationSettings Settings { get; } - - public StartForm(ProcessorCollection processorCollection, ApplicationSettings settings) - { - ProcessorCollection = processorCollection; - Settings = settings; - - InitializeComponent(); - } - - private void StartForm_Load(object sender, EventArgs e) - { - ProcessorCollectionControl.Collection = ProcessorCollection; - - SettingsPropertyGrid.SelectedObject = Settings; - } - - /* - private void PopulateListView() - { - Dictionary> items = []; - - foreach (ProcessorCollectionItem item in ProcessorCollection.AllItems) - { - items.TryAdd(item.Group, []); - items[item.Group].Add(item); - } - - ProcessorsListView.Groups.Clear(); - - foreach (ProcessorGroupEnum group in Enum.GetValues()) - { - if (!items.TryGetValue(group, out List? list)) - { - continue; - } - - ListViewGroup listViewGroup = new(group.GetDescription()) - { - TaskLink = "Выбрать/снять все", - }; - ProcessorsListView.Groups.Add(listViewGroup); - - foreach (ProcessorCollectionItem item in list) - { - ListViewItem listViewItem = new() - { - Group = listViewGroup, - Text = item.Description, - Checked = true, - ToolTipText = item.Name, - }; - ProcessorsListView.Items.Add(listViewItem); - } - } - } - - private void ProcessorsListView_GroupTaskLinkClick(object sender, ListViewGroupEventArgs e) - { - ListViewGroup group = ProcessorsListView.Groups[e.GroupIndex]; - - bool allSelected = group.Items.Cast().All(item => item.Checked); - - foreach (ListViewItem item in group.Items.Cast()) - { - item.Checked = !allSelected; - } - } - */ - #region "Кнопка старта" - - private void StartButton_Click(object sender, EventArgs e) - { - ApplicationStateChange?.Invoke(this, ApplicationStage.ImportProcess); - } - - #endregion - - #region "Основное меню" - - - private void ExitToolStripMenuItem_Click(object sender, EventArgs e) - { - Close(); - } - - private void EntityViewWindowToolStripMenuItem_Click(object sender, EventArgs e) - { - ApplicationStateChange?.Invoke(this, ApplicationStage.Viewer); - } - - private void StartToolStripMenuItem_Click(object sender, EventArgs e) - { - ApplicationStateChange?.Invoke(this, ApplicationStage.ImportProcess); - } - - public event ImportApplication.ApplicationStateChangeDelegate? ApplicationStateChange; - - #endregion -} diff --git a/Pf2eDataScrapper/Forms/StartForm.resx b/Pf2eDataScrapper/Forms/StartForm.resx deleted file mode 100644 index 2099966..0000000 --- a/Pf2eDataScrapper/Forms/StartForm.resx +++ /dev/null @@ -1,123 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 17, 17 - - \ No newline at end of file diff --git a/Pf2eDataScrapper/Helpers/DatabaseHelper.cs b/Pf2eDataScrapper/Helpers/DatabaseHelper.cs index bcf30e0..690f4f3 100644 --- a/Pf2eDataScrapper/Helpers/DatabaseHelper.cs +++ b/Pf2eDataScrapper/Helpers/DatabaseHelper.cs @@ -1,4 +1,5 @@ -using Pf2eModel; +using System.Linq; +using Pf2eModel; using Slugify; namespace Pf2eDataScrapper.Helpers; diff --git a/Pf2eDataScrapper/Helpers/EntityView.cs b/Pf2eDataScrapper/Helpers/EntityView.cs index dd9c5fe..fb818db 100644 --- a/Pf2eDataScrapper/Helpers/EntityView.cs +++ b/Pf2eDataScrapper/Helpers/EntityView.cs @@ -1,4 +1,7 @@ -using Microsoft.EntityFrameworkCore; +using System; +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; using Pf2eModel; using Pf2eModel.Model; using Pf2eModel.Model.Base; diff --git a/Pf2eDataScrapper/ImportApplication.cs b/Pf2eDataScrapper/ImportApplication.cs index cb6de5d..43425af 100644 --- a/Pf2eDataScrapper/ImportApplication.cs +++ b/Pf2eDataScrapper/ImportApplication.cs @@ -1,6 +1,6 @@ -using System.ComponentModel; +using System; +using System.ComponentModel; using System.Windows; -using System.Windows.Forms.Integration; using Microsoft.Extensions.DependencyInjection; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; @@ -9,11 +9,10 @@ using Pf2eDataScrapper.WPF; using Pf2eDataScrapper.WPF.Views; using Pf2eModel; using Slugify; -using StartForm = Pf2eDataScrapper.WPF.Views.StartForm; namespace Pf2eDataScrapper; -internal sealed class ImportApplication : ApplicationContext +internal sealed class ImportApplication : Application { public ImportApplication( IServiceProvider serviceProvider, @@ -82,7 +81,6 @@ internal sealed class ImportApplication : ApplicationContext _startFormWpf.ApplicationStateChange += ApplicationStateChange; _startFormWpf.Show(); - ElementHost.EnableModelessKeyboardInterop(_startFormWpf); CurrentWpfForm = _startFormWpf; break; @@ -99,7 +97,6 @@ internal sealed class ImportApplication : ApplicationContext _progressFormWpf.ApplicationStateChange += ApplicationStateChange; _progressFormWpf.Show(); - ElementHost.EnableModelessKeyboardInterop(_progressFormWpf); CurrentWpfForm = _progressFormWpf; executor.Start(); @@ -112,7 +109,6 @@ internal sealed class ImportApplication : ApplicationContext //_entityForm.ApplicationStateChange += ApplicationStateChange; _entityForm.Show(); - ElementHost.EnableModelessKeyboardInterop(_entityForm); CurrentWpfForm = _entityForm; break; @@ -147,7 +143,7 @@ internal sealed class ImportApplication : ApplicationContext break; default: - throw new ArgumentOutOfRangeException(); + throw new ArgumentOutOfRangeException(nameof(stage)); } } @@ -167,7 +163,7 @@ internal sealed class ImportApplication : ApplicationContext { if (sender?.Equals(CurrentWpfForm) ?? false) { - ExitThread(); + Shutdown(); } else { diff --git a/Pf2eDataScrapper/Importers/AbstractCompendium.cs b/Pf2eDataScrapper/Importers/AbstractCompendium.cs index dc1108e..ee6d349 100644 --- a/Pf2eDataScrapper/Importers/AbstractCompendium.cs +++ b/Pf2eDataScrapper/Importers/AbstractCompendium.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.Importers.Repositories; namespace Pf2eDataScrapper.Importers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdRepository.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdRepository.cs index ccb52cd..c075b3d 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdRepository.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/AonprdRepository.cs @@ -1,5 +1,8 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using System.Net.Http; +using System.Threading.Tasks; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Repositories; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs index 9ee710d..ea64077 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Compendium/AonprdCompendium.cs @@ -1,5 +1,8 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; using System.IO; +using System.Linq; using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Compendium; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdBuilderGlobals.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdBuilderGlobals.cs index f8891ca..97cbc53 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdBuilderGlobals.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdBuilderGlobals.cs @@ -1,4 +1,5 @@ -using Pf2eModel.Model.Base.Targets; +using System.Collections.Generic; +using Pf2eModel.Model.Base.Targets; namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdProcessorInputExtension.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdProcessorInputExtension.cs index b29847a..b3f407e 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdProcessorInputExtension.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/AonprdProcessorInputExtension.cs @@ -1,4 +1,5 @@ -using Microsoft.Extensions.DependencyInjection; +using System.Collections.Generic; +using Microsoft.Extensions.DependencyInjection; using Pf2eDataScrapper.Processors; using Pf2eModel.Model.Enum; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/RuleToc.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/RuleToc.cs index 84b3a64..cfa169a 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/RuleToc.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/RuleToc.cs @@ -1,4 +1,7 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Pf2eModel.Model.Base.Source; namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/StringHelper.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/StringHelper.cs index 159ade1..2613b27 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/StringHelper.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Helpers/StringHelper.cs @@ -1,4 +1,6 @@ -using System.Text.RegularExpressions; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; namespace Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractEntityProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractEntityProcessor.cs index 9121e01..2fc750e 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractEntityProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractEntityProcessor.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractSubclassProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractSubclassProcessor.cs index f0b9ba1..fac791d 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractSubclassProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/AbstractSubclassProcessor.cs @@ -1,4 +1,5 @@ -using Pf2eDataScrapper.App; +using System.Linq; +using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; using Pf2eDataScrapper.Processors; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Common/SourceProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Common/SourceProcessor.cs index 88b29fc..d8215ba 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Common/SourceProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Common/SourceProcessor.cs @@ -1,4 +1,5 @@ -using Pf2eDataScrapper.App; +using System; +using Pf2eDataScrapper.App; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; using Pf2eDataScrapper.Processors; using Pf2eModel; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Finalization/LegacyRemasterProcessors.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Finalization/LegacyRemasterProcessors.cs index 001f71e..6a6b1a7 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Finalization/LegacyRemasterProcessors.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Finalization/LegacyRemasterProcessors.cs @@ -1,4 +1,6 @@ -using Microsoft.EntityFrameworkCore; +using System.Collections.Generic; +using System.Linq; +using Microsoft.EntityFrameworkCore; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Processors; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Preparation/SchemaBuildProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Preparation/SchemaBuildProcessor.cs index 6de832c..2fe2017 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Preparation/SchemaBuildProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Preparation/SchemaBuildProcessor.cs @@ -1,4 +1,7 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Compendium; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs index ec100ae..b0451aa 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Subclasses/ApparitionProcessor.cs @@ -1,4 +1,6 @@ -using Pf2eDataScrapper.App; +using System.Collections.Generic; +using System.Linq; +using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; using Pf2eDataScrapper.Processors; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/AncestryProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/AncestryProcessor.cs index b6b9d2d..babaafc 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/AncestryProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/AncestryProcessor.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs index 19c407d..8047147 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/ClassProcessor.cs @@ -1,4 +1,7 @@ -using System.Text.RegularExpressions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/FeatProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/FeatProcessor.cs index 636ddc4..6697968 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/FeatProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/FeatProcessor.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System.Linq; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/RitualProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/RitualProcessor.cs index 407af42..dc658a5 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/RitualProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/RitualProcessor.cs @@ -1,4 +1,7 @@ -using System.Text.RegularExpressions; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Text.RegularExpressions; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RuleProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RuleProcessor.cs index d60aa25..729f807 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RuleProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RuleProcessor.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System.Linq; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesOrderProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesOrderProcessor.cs index 6c17394..7d0b629 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesOrderProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesOrderProcessor.cs @@ -5,6 +5,8 @@ // так что ставить порядок ВСЕХ правил в архиве не получится, только тех, что есть в содержании. // Ну а пока просто расставляем родительские и дочерние элементы. +using System.Collections.Generic; +using System.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; using Pf2eDataScrapper.Processors; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesTocProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesTocProcessor.cs index 052f55d..6ba76db 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesTocProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/Rules/RulesTocProcessor.cs @@ -1,4 +1,5 @@ -using System.Text.RegularExpressions; +using System.Linq; +using System.Text.RegularExpressions; using System.Web; using AngleSharp; using AngleSharp.Dom; diff --git a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/SpellProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/SpellProcessor.cs index 631ff74..4a61ede 100644 --- a/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/SpellProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/Aonprd/Processors/Types/SpellProcessor.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.Aonprd.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolder.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolder.cs index 49f1f15..a7ff17d 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolder.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolder.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium; diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolderCollection.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolderCollection.cs index 69d0bf0..7528df6 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolderCollection.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/CompendiumFolderCollection.cs @@ -1,4 +1,7 @@ -namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium; +using System.Collections.Generic; +using System.Linq; + +namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium; /// /// Коллекция папок компендиума diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/FoundryEnCompendium.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/FoundryEnCompendium.cs index 15e3103..7dfc785 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/FoundryEnCompendium.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Compendium/FoundryEnCompendium.cs @@ -1,5 +1,8 @@ -using System.Collections.Concurrent; +using System; +using System.Collections.Concurrent; +using System.Collections.Generic; using System.IO; +using System.Linq; using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium; diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/FoundryEnAbstractProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/FoundryEnAbstractProcessor.cs index 3c25f0f..214e593 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/FoundryEnAbstractProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/FoundryEnAbstractProcessor.cs @@ -1,4 +1,7 @@ -using System.Security.Cryptography; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; using System.Text; using Microsoft.EntityFrameworkCore; using Newtonsoft.Json.Linq; diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/CompendiumItemsProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/CompendiumItemsProcessor.cs index ac5a0e3..5093b44 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/CompendiumItemsProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/CompendiumItemsProcessor.cs @@ -1,4 +1,6 @@ -using System.IO; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaBuildProcessor.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaBuildProcessor.cs index 84adc47..1cac93c 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaBuildProcessor.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaBuildProcessor.cs @@ -1,4 +1,7 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; using Pf2eDataScrapper.App; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers.Implementations.FoundryEn.Compendium; diff --git a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaTypeResolver.cs b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaTypeResolver.cs index e741c24..a469666 100644 --- a/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaTypeResolver.cs +++ b/Pf2eDataScrapper/Importers/Implementations/FoundryEn/Processors/Preparation/SchemaTypeResolver.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.SchemaBuilder; using Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/Pf2eDataScrapper.csproj b/Pf2eDataScrapper/Pf2eDataScrapper.csproj index ef7689d..13cb96a 100644 --- a/Pf2eDataScrapper/Pf2eDataScrapper.csproj +++ b/Pf2eDataScrapper/Pf2eDataScrapper.csproj @@ -3,8 +3,8 @@ WinExe net9.0-windows7.0 enable - true - enable + False + disable True @@ -39,18 +39,4 @@ Always - - - Component - - - UserControl - - - UserControl - - - Form - - diff --git a/Pf2eDataScrapper/Processors/ProcessorExecutor.cs b/Pf2eDataScrapper/Processors/ProcessorExecutor.cs index 560b179..b4d97f8 100644 --- a/Pf2eDataScrapper/Processors/ProcessorExecutor.cs +++ b/Pf2eDataScrapper/Processors/ProcessorExecutor.cs @@ -1,4 +1,7 @@ -using System.ComponentModel; +using System; +using System.Collections.Generic; +using System.ComponentModel; +using System.Threading.Tasks; using Microsoft.Extensions.DependencyInjection; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.App; @@ -49,7 +52,10 @@ internal sealed class ProcessorExecutor( { Parallel.ForEach( IterateProcessors(item), - new() { MaxDegreeOfParallelism = item.Parallel ? Settings.MaxThreads : 1 }, + new ParallelOptions() + { + MaxDegreeOfParallelism = item.Parallel ? Settings.MaxThreads : 1, + }, RunProcessor ); }; diff --git a/Pf2eDataScrapper/Processors/ProcessorInput.cs b/Pf2eDataScrapper/Processors/ProcessorInput.cs index e0663b1..632d605 100644 --- a/Pf2eDataScrapper/Processors/ProcessorInput.cs +++ b/Pf2eDataScrapper/Processors/ProcessorInput.cs @@ -1,4 +1,7 @@ -using System.Security.Cryptography; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Security.Cryptography; using System.Text; using Newtonsoft.Json.Linq; using NpgsqlTypes; diff --git a/Pf2eDataScrapper/Program.cs b/Pf2eDataScrapper/Program.cs index 71d8b6c..b6dd3a8 100644 --- a/Pf2eDataScrapper/Program.cs +++ b/Pf2eDataScrapper/Program.cs @@ -1,4 +1,6 @@ -using Microsoft.Extensions.DependencyInjection; +using System; +using System.Windows; +using Microsoft.Extensions.DependencyInjection; using Pf2eDataScrapper.Importers.Implementations.Aonprd; using Pf2eDataScrapper.Importers.Implementations.FoundryEn; using Pf2eDataScrapper.WPF; @@ -17,7 +19,7 @@ internal static class Program // see https://aka.ms/applicationconfiguration. ApplicationConfiguration.Initialize(); - Application.SetHighDpiMode(HighDpiMode.SystemAware); + // Application.SetHighDpiMode(HighDpiMode.SystemAware); /* #pragma warning disable WFO5001 Application.SetColorMode(SystemColorMode.System); @@ -31,7 +33,8 @@ internal static class Program serviceProvider ); - Application.Run(app); + app.Run(); + // Application.Run(app); } private static IServiceCollection RegisterServices() diff --git a/Pf2eDataScrapper/SchemaBuilder/AbstractSchemaBuildProcessor.cs b/Pf2eDataScrapper/SchemaBuilder/AbstractSchemaBuildProcessor.cs index 6212448..db2d0df 100644 --- a/Pf2eDataScrapper/SchemaBuilder/AbstractSchemaBuildProcessor.cs +++ b/Pf2eDataScrapper/SchemaBuilder/AbstractSchemaBuildProcessor.cs @@ -1,4 +1,6 @@ -using System.IO; +using System; +using System.Collections.Generic; +using System.IO; using Newtonsoft.Json.Linq; using Pf2eDataScrapper.Helpers; using Pf2eDataScrapper.Importers; diff --git a/Pf2eDataScrapper/SchemaBuilder/SchemaNode.cs b/Pf2eDataScrapper/SchemaBuilder/SchemaNode.cs index cd7792f..544d28d 100644 --- a/Pf2eDataScrapper/SchemaBuilder/SchemaNode.cs +++ b/Pf2eDataScrapper/SchemaBuilder/SchemaNode.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.SchemaBuilder.Types; namespace Pf2eDataScrapper.SchemaBuilder; diff --git a/Pf2eDataScrapper/SchemaBuilder/TypeResolver.cs b/Pf2eDataScrapper/SchemaBuilder/TypeResolver.cs index b436c9d..47a69db 100644 --- a/Pf2eDataScrapper/SchemaBuilder/TypeResolver.cs +++ b/Pf2eDataScrapper/SchemaBuilder/TypeResolver.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; using Pf2eDataScrapper.SchemaBuilder.Types; namespace Pf2eDataScrapper.SchemaBuilder; diff --git a/Pf2eDataScrapper/SchemaBuilder/Types/AbstractSchemaType.cs b/Pf2eDataScrapper/SchemaBuilder/Types/AbstractSchemaType.cs index af83044..d56d83f 100644 --- a/Pf2eDataScrapper/SchemaBuilder/Types/AbstractSchemaType.cs +++ b/Pf2eDataScrapper/SchemaBuilder/Types/AbstractSchemaType.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/SchemaBuilder/Types/ArraySchemaType.cs b/Pf2eDataScrapper/SchemaBuilder/Types/ArraySchemaType.cs index 3c928d5..aaaf7f7 100644 --- a/Pf2eDataScrapper/SchemaBuilder/Types/ArraySchemaType.cs +++ b/Pf2eDataScrapper/SchemaBuilder/Types/ArraySchemaType.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/SchemaBuilder/Types/DictionarySchemaType.cs b/Pf2eDataScrapper/SchemaBuilder/Types/DictionarySchemaType.cs index cce825d..8506386 100644 --- a/Pf2eDataScrapper/SchemaBuilder/Types/DictionarySchemaType.cs +++ b/Pf2eDataScrapper/SchemaBuilder/Types/DictionarySchemaType.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/SchemaBuilder/Types/IgnoreSchemaType.cs b/Pf2eDataScrapper/SchemaBuilder/Types/IgnoreSchemaType.cs index 698fed7..3fff5d7 100644 --- a/Pf2eDataScrapper/SchemaBuilder/Types/IgnoreSchemaType.cs +++ b/Pf2eDataScrapper/SchemaBuilder/Types/IgnoreSchemaType.cs @@ -1,4 +1,5 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/SchemaBuilder/Types/ObjectSchemaType.cs b/Pf2eDataScrapper/SchemaBuilder/Types/ObjectSchemaType.cs index e573405..7385f7a 100644 --- a/Pf2eDataScrapper/SchemaBuilder/Types/ObjectSchemaType.cs +++ b/Pf2eDataScrapper/SchemaBuilder/Types/ObjectSchemaType.cs @@ -1,4 +1,7 @@ -using Newtonsoft.Json.Linq; +using System; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/SchemaBuilder/Types/StaticSchemaType.cs b/Pf2eDataScrapper/SchemaBuilder/Types/StaticSchemaType.cs index 76a5498..3ca17a5 100644 --- a/Pf2eDataScrapper/SchemaBuilder/Types/StaticSchemaType.cs +++ b/Pf2eDataScrapper/SchemaBuilder/Types/StaticSchemaType.cs @@ -1,4 +1,6 @@ -using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.Linq; +using Newtonsoft.Json.Linq; namespace Pf2eDataScrapper.SchemaBuilder.Types; diff --git a/Pf2eDataScrapper/WPF/Components/EntityViewControl.xaml b/Pf2eDataScrapper/WPF/Components/EntityViewControl.xaml index e525e0c..702e2ce 100644 --- a/Pf2eDataScrapper/WPF/Components/EntityViewControl.xaml +++ b/Pf2eDataScrapper/WPF/Components/EntityViewControl.xaml @@ -62,7 +62,6 @@