mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move ExtraIniItem to Core
This commit is contained in:
@@ -1,10 +1,9 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using SabreTools.Core.Filter;
|
||||
using SabreTools.IO.Logging;
|
||||
using SabreTools.IO.Readers;
|
||||
|
||||
namespace SabreTools.Filtering
|
||||
namespace SabreTools.Core.Filter
|
||||
{
|
||||
public class ExtraIniItem
|
||||
{
|
||||
@@ -25,9 +24,11 @@ namespace SabreTools.Filtering
|
||||
|
||||
#region Constructors
|
||||
|
||||
public ExtraIniItem(string itemName, string fieldName)
|
||||
public ExtraIniItem(string itemName, string fieldName, string ini)
|
||||
{
|
||||
Key = new FilterKey(itemName, fieldName);
|
||||
if (!PopulateFromFile(ini))
|
||||
Mappings.Clear();
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -46,7 +47,7 @@ namespace SabreTools.Filtering
|
||||
/// the value is boolean. If there's another section name, then that is set
|
||||
/// as the value instead.
|
||||
/// </remarks>
|
||||
public bool PopulateFromFile(string ini)
|
||||
private bool PopulateFromFile(string ini)
|
||||
{
|
||||
// Prepare all intenral variables
|
||||
IniReader ir = new(ini) { ValidateRows = false };
|
||||
@@ -67,8 +67,8 @@ namespace SabreTools.Filtering
|
||||
string fileString = inputTrimmed.Substring(fieldString.Length + 1).Trim('"', ' ', '\t');
|
||||
|
||||
FilterParser.ParseFilterId(fieldString, out string itemName, out string fieldName);
|
||||
var item = new ExtraIniItem(itemName, fieldName);
|
||||
if (item.PopulateFromFile(fileString))
|
||||
var item = new ExtraIniItem(itemName, fieldName, fileString);
|
||||
if (item.Mappings.Count > 0)
|
||||
Items.Add(item);
|
||||
}
|
||||
|
||||
|
||||
@@ -342,8 +342,7 @@ Reset the internal state: reset();";
|
||||
|
||||
// Create the extra INI
|
||||
var extraIni = new ExtraIni();
|
||||
var extraIniItem = new ExtraIniItem(itemName, fieldName);
|
||||
extraIniItem.PopulateFromFile(extraFile);
|
||||
var extraIniItem = new ExtraIniItem(itemName, fieldName, extraFile);
|
||||
extraIni.Items.Add(extraIniItem);
|
||||
|
||||
// Apply the extra INI blindly
|
||||
|
||||
Reference in New Issue
Block a user