Fix ExtraIni setter issues

This commit is contained in:
Matt Nadareski
2024-03-05 17:33:02 -05:00
parent 6987ec2641
commit 3ec85cf04a
4 changed files with 49 additions and 99 deletions

View File

@@ -79,6 +79,31 @@ namespace SabreTools.DatFiles
watch.Stop();
}
/// <summary>
/// Populate the setters using a set of field names
/// </summary>
/// <param name="mappings">Dictionary of mappings</param>
public void PopulateSettersFromDictionary(Dictionary<(string, string), string>? mappings)
{
// If the dictionary is null or empty, just return
if (mappings == null || mappings.Count == 0)
return;
var watch = new InternalStopwatch("Populating setters from dictionary");
// Now we loop through and get values for everything
foreach (var mapping in mappings)
{
string field = $"{mapping.Key.Item1}.{mapping.Key.Item2}";
string value = mapping.Value;
if (!SetSetter(field, value))
logger.Warning($"The value {value} did not match any known field names. Please check the wiki for more details on supported field names.");
}
watch.Stop();
}
/// <summary>
/// Set remover from a value
/// </summary>