2025-05-13 10:16:17 -04:00
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2025-05-02 22:34:38 -04:00
|
|
|
#if NET40_OR_GREATER || NETCOREAPP
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
#endif
|
2025-01-11 22:00:26 -05:00
|
|
|
using SabreTools.Core;
|
2025-05-02 22:34:38 -04:00
|
|
|
using SabreTools.Core.Filter;
|
2024-03-10 23:35:57 -04:00
|
|
|
using SabreTools.Core.Tools;
|
2024-03-13 00:02:19 -04:00
|
|
|
using SabreTools.DatItems;
|
2025-01-11 22:00:26 -05:00
|
|
|
using SabreTools.DatItems.Formats;
|
2024-03-09 21:34:26 -05:00
|
|
|
|
|
|
|
|
namespace SabreTools.DatFiles
|
|
|
|
|
{
|
2024-03-10 00:20:56 -05:00
|
|
|
public partial class DatFile
|
2024-03-09 21:34:26 -05:00
|
|
|
{
|
2024-03-11 01:08:44 -04:00
|
|
|
#region From Metadata
|
2024-03-09 21:34:26 -05:00
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert metadata information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">Metadata file to convert</param>
|
|
|
|
|
/// <param name="filename">Name of the file to be parsed</param>
|
|
|
|
|
/// <param name="indexId">Index ID for the DAT</param>
|
2024-03-10 23:35:57 -04:00
|
|
|
/// <param name="keep">True if full pathnames are to be kept, false otherwise</param>
|
2024-03-09 21:34:26 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
internal void ConvertFromMetadata(Models.Metadata.MetadataFile? item,
|
|
|
|
|
string filename,
|
|
|
|
|
int indexId,
|
|
|
|
|
bool keep,
|
|
|
|
|
bool statsOnly,
|
|
|
|
|
FilterRunner? filterRunner)
|
2024-03-09 21:34:26 -05:00
|
|
|
{
|
|
|
|
|
// If the metadata file is invalid, we can't do anything
|
2024-10-19 21:41:08 -04:00
|
|
|
if (item == null || item.Count == 0)
|
2024-03-09 21:34:26 -05:00
|
|
|
return;
|
|
|
|
|
|
2024-03-20 01:15:07 -04:00
|
|
|
// Create an internal source and add to the dictionary
|
2025-01-12 22:10:48 -05:00
|
|
|
var source = new Source(indexId, filename);
|
2025-05-02 00:28:22 -04:00
|
|
|
// long sourceIndex = AddSourceDB(source);
|
2024-03-20 01:15:07 -04:00
|
|
|
|
2024-03-10 22:49:15 -04:00
|
|
|
// Get the header from the metadata
|
|
|
|
|
var header = item.Read<Models.Metadata.Header>(Models.Metadata.MetadataFile.HeaderKey);
|
|
|
|
|
if (header != null)
|
2024-03-10 23:35:57 -04:00
|
|
|
ConvertHeader(header, keep);
|
2024-03-10 00:27:23 -05:00
|
|
|
|
2024-03-09 21:34:26 -05:00
|
|
|
// Get the machines from the metadata
|
2025-01-11 22:00:26 -05:00
|
|
|
var machines = item.ReadItemArray<Models.Metadata.Machine>(Models.Metadata.MetadataFile.MachineKey);
|
2024-03-10 22:49:15 -04:00
|
|
|
if (machines != null)
|
2025-05-02 22:34:38 -04:00
|
|
|
ConvertMachines(machines, source, sourceIndex: 0, statsOnly, filterRunner);
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert header information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">Header to convert</param>
|
2024-03-10 23:35:57 -04:00
|
|
|
/// <param name="keep">True if full pathnames are to be kept, false otherwise</param>
|
|
|
|
|
private void ConvertHeader(Models.Metadata.Header? item, bool keep)
|
2024-03-10 22:49:15 -04:00
|
|
|
{
|
|
|
|
|
// If the header is invalid, we can't do anything
|
2024-10-19 21:41:08 -04:00
|
|
|
if (item == null || item.Count == 0)
|
2024-03-09 21:34:26 -05:00
|
|
|
return;
|
|
|
|
|
|
2024-03-10 22:49:15 -04:00
|
|
|
// Create an internal header
|
2024-03-20 01:15:07 -04:00
|
|
|
var header = new DatHeader(item);
|
2024-03-10 22:49:15 -04:00
|
|
|
|
|
|
|
|
// Convert subheader values
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Header.CanOpenKey))
|
2024-03-09 21:34:26 -05:00
|
|
|
{
|
2024-03-10 23:35:57 -04:00
|
|
|
var canOpen = item.Read<Models.OfflineList.CanOpen>(Models.Metadata.Header.CanOpenKey);
|
|
|
|
|
if (canOpen?.Extension != null)
|
|
|
|
|
Header.SetFieldValue<string[]?>(Models.Metadata.Header.CanOpenKey, canOpen.Extension);
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Header.ImagesKey))
|
|
|
|
|
{
|
2024-03-12 11:53:58 -04:00
|
|
|
var images = item.Read<Models.OfflineList.Images>(Models.Metadata.Header.ImagesKey);
|
2025-01-10 13:10:50 -05:00
|
|
|
Header.SetFieldValue<Models.OfflineList.Images?>(Models.Metadata.Header.ImagesKey, images);
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Header.InfosKey))
|
|
|
|
|
{
|
2024-03-10 23:35:57 -04:00
|
|
|
var infos = item.Read<Models.OfflineList.Infos>(Models.Metadata.Header.InfosKey);
|
2025-01-09 07:04:55 -05:00
|
|
|
Header.SetFieldValue<Models.OfflineList.Infos?>(Models.Metadata.Header.InfosKey, infos);
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Header.NewDatKey))
|
|
|
|
|
{
|
2024-03-10 23:35:57 -04:00
|
|
|
var newDat = item.Read<Models.OfflineList.NewDat>(Models.Metadata.Header.NewDatKey);
|
2025-01-10 13:10:50 -05:00
|
|
|
Header.SetFieldValue<Models.OfflineList.NewDat?>(Models.Metadata.Header.NewDatKey, newDat);
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Header.SearchKey))
|
|
|
|
|
{
|
2024-03-12 00:09:48 -04:00
|
|
|
var search = item.Read<Models.OfflineList.Search>(Models.Metadata.Header.SearchKey);
|
2025-01-10 13:10:50 -05:00
|
|
|
Header.SetFieldValue<Models.OfflineList.Search?>(Models.Metadata.Header.SearchKey, search);
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
|
|
|
|
|
2024-03-10 23:35:57 -04:00
|
|
|
// Selectively set all possible fields -- TODO: Figure out how to make this less manual
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.AuthorKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.AuthorKey, header.GetStringFieldValue(Models.Metadata.Header.AuthorKey));
|
2025-05-11 22:55:38 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.BiosModeKey).AsMergingFlag() == MergingFlag.None)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.BiosModeKey, header.GetStringFieldValue(Models.Metadata.Header.BiosModeKey).AsMergingFlag().AsStringValue());
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.BuildKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.BuildKey, header.GetStringFieldValue(Models.Metadata.Header.BuildKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.CategoryKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.CategoryKey, header.GetStringFieldValue(Models.Metadata.Header.CategoryKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.CommentKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.CommentKey, header.GetStringFieldValue(Models.Metadata.Header.CommentKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.DateKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.DateKey, header.GetStringFieldValue(Models.Metadata.Header.DateKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.DatVersionKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.DatVersionKey, header.GetStringFieldValue(Models.Metadata.Header.DatVersionKey));
|
|
|
|
|
if (Header.GetBoolFieldValue(Models.Metadata.Header.DebugKey) == null)
|
|
|
|
|
Header.SetFieldValue<bool?>(Models.Metadata.Header.DebugKey, header.GetBoolFieldValue(Models.Metadata.Header.DebugKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.DescriptionKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.DescriptionKey, header.GetStringFieldValue(Models.Metadata.Header.DescriptionKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.EmailKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.EmailKey, header.GetStringFieldValue(Models.Metadata.Header.EmailKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.EmulatorVersionKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.EmulatorVersionKey, header.GetStringFieldValue(Models.Metadata.Header.EmulatorVersionKey));
|
2025-05-11 22:55:38 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.ForceMergingKey).AsMergingFlag() == MergingFlag.None)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.ForceMergingKey, header.GetStringFieldValue(Models.Metadata.Header.ForceMergingKey).AsMergingFlag().AsStringValue());
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.ForceNodumpKey).AsNodumpFlag() == NodumpFlag.None)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.ForceNodumpKey, header.GetStringFieldValue(Models.Metadata.Header.ForceNodumpKey).AsNodumpFlag().AsStringValue());
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.ForcePackingKey).AsPackingFlag() == PackingFlag.None)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.ForcePackingKey, header.GetStringFieldValue(Models.Metadata.Header.ForcePackingKey).AsPackingFlag().AsStringValue());
|
2025-01-10 13:10:50 -05:00
|
|
|
if (Header.GetBoolFieldValue(Models.Metadata.Header.ForceZippingKey) == null)
|
|
|
|
|
Header.SetFieldValue<bool?>(Models.Metadata.Header.ForceZippingKey, header.GetBoolFieldValue(Models.Metadata.Header.ForceZippingKey));
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.HeaderKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.HeaderKey, header.GetStringFieldValue(Models.Metadata.Header.HeaderKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.HomepageKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.HomepageKey, header.GetStringFieldValue(Models.Metadata.Header.HomepageKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.IdKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.IdKey, header.GetStringFieldValue(Models.Metadata.Header.IdKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.ImFolderKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.ImFolderKey, header.GetStringFieldValue(Models.Metadata.Header.ImFolderKey));
|
|
|
|
|
if (Header.GetBoolFieldValue(Models.Metadata.Header.LockBiosModeKey) == null)
|
|
|
|
|
Header.SetFieldValue<bool?>(Models.Metadata.Header.LockBiosModeKey, header.GetBoolFieldValue(Models.Metadata.Header.LockBiosModeKey));
|
|
|
|
|
if (Header.GetBoolFieldValue(Models.Metadata.Header.LockRomModeKey) == null)
|
|
|
|
|
Header.SetFieldValue<bool?>(Models.Metadata.Header.LockRomModeKey, header.GetBoolFieldValue(Models.Metadata.Header.LockRomModeKey));
|
|
|
|
|
if (Header.GetBoolFieldValue(Models.Metadata.Header.LockSampleModeKey) == null)
|
|
|
|
|
Header.SetFieldValue<bool?>(Models.Metadata.Header.LockSampleModeKey, header.GetBoolFieldValue(Models.Metadata.Header.LockSampleModeKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.MameConfigKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.MameConfigKey, header.GetStringFieldValue(Models.Metadata.Header.MameConfigKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.NameKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.NameKey, header.GetStringFieldValue(Models.Metadata.Header.NameKey));
|
2025-01-10 13:10:50 -05:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.NotesKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.NotesKey, header.GetStringFieldValue(Models.Metadata.Header.NotesKey));
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.PluginKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.PluginKey, header.GetStringFieldValue(Models.Metadata.Header.PluginKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.RefNameKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.RefNameKey, header.GetStringFieldValue(Models.Metadata.Header.RefNameKey));
|
2025-05-11 22:55:38 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.RomModeKey).AsMergingFlag() == MergingFlag.None)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.RomModeKey, header.GetStringFieldValue(Models.Metadata.Header.RomModeKey).AsMergingFlag().AsStringValue());
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.RomTitleKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.RomTitleKey, header.GetStringFieldValue(Models.Metadata.Header.RomTitleKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.RootDirKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.RootDirKey, header.GetStringFieldValue(Models.Metadata.Header.RootDirKey));
|
2025-05-11 22:55:38 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.SampleModeKey).AsMergingFlag() == MergingFlag.None)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.SampleModeKey, header.GetStringFieldValue(Models.Metadata.Header.SampleModeKey).AsMergingFlag().AsStringValue());
|
2025-01-10 13:10:50 -05:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.SchemaLocationKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.SchemaLocationKey, header.GetStringFieldValue(Models.Metadata.Header.SchemaLocationKey));
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.ScreenshotsHeightKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.ScreenshotsHeightKey, header.GetStringFieldValue(Models.Metadata.Header.ScreenshotsHeightKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.ScreenshotsWidthKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.ScreenshotsWidthKey, header.GetStringFieldValue(Models.Metadata.Header.ScreenshotsWidthKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.SystemKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.SystemKey, header.GetStringFieldValue(Models.Metadata.Header.SystemKey));
|
2025-01-10 13:10:50 -05:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.TimestampKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.TimestampKey, header.GetStringFieldValue(Models.Metadata.Header.TimestampKey));
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.TypeKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.TypeKey, header.GetStringFieldValue(Models.Metadata.Header.TypeKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.UrlKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.UrlKey, header.GetStringFieldValue(Models.Metadata.Header.UrlKey));
|
|
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.VersionKey) == null)
|
|
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.VersionKey, header.GetStringFieldValue(Models.Metadata.Header.VersionKey));
|
2024-03-10 22:49:15 -04:00
|
|
|
|
2024-03-10 23:35:57 -04:00
|
|
|
// Handle implied SuperDAT
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.NameKey)?.Contains(" - SuperDAT") == true && keep)
|
2024-03-10 22:49:15 -04:00
|
|
|
{
|
2024-03-11 15:46:44 -04:00
|
|
|
if (Header.GetStringFieldValue(Models.Metadata.Header.TypeKey) == null)
|
2024-03-10 23:35:57 -04:00
|
|
|
Header.SetFieldValue<string?>(Models.Metadata.Header.TypeKey, "SuperDAT");
|
2024-03-09 21:34:26 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-10 04:10:37 -04:00
|
|
|
/// <summary>
|
2024-03-10 22:49:15 -04:00
|
|
|
/// Convert machines information
|
2024-03-10 04:10:37 -04:00
|
|
|
/// </summary>
|
2024-03-10 22:49:15 -04:00
|
|
|
/// <param name="items">Machine array to convert</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-10 22:49:15 -04:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ConvertMachines(Models.Metadata.Machine[]? items,
|
|
|
|
|
Source source,
|
|
|
|
|
long sourceIndex,
|
|
|
|
|
bool statsOnly,
|
|
|
|
|
FilterRunner? filterRunner)
|
2024-03-10 04:10:37 -04:00
|
|
|
{
|
2024-03-10 22:49:15 -04:00
|
|
|
// If the array is invalid, we can't do anything
|
2024-03-19 14:35:43 -04:00
|
|
|
if (items == null || items.Length == 0)
|
2024-03-10 22:49:15 -04:00
|
|
|
return;
|
2024-03-10 04:10:37 -04:00
|
|
|
|
2024-03-10 22:49:15 -04:00
|
|
|
// Loop through the machines and add
|
2025-05-13 14:49:18 -04:00
|
|
|
#if NET452_OR_GREATER || NETCOREAPP
|
2025-05-02 22:34:38 -04:00
|
|
|
Parallel.ForEach(items, Core.Globals.ParallelOptions, machine =>
|
|
|
|
|
#elif NET40_OR_GREATER
|
|
|
|
|
Parallel.ForEach(items, machine =>
|
|
|
|
|
#else
|
2024-03-10 22:49:15 -04:00
|
|
|
foreach (var machine in items)
|
2025-05-02 22:34:38 -04:00
|
|
|
#endif
|
2024-03-10 22:49:15 -04:00
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
ConvertMachine(machine, source, sourceIndex, statsOnly, filterRunner);
|
|
|
|
|
#if NET40_OR_GREATER || NETCOREAPP
|
|
|
|
|
});
|
|
|
|
|
#else
|
2024-03-10 22:49:15 -04:00
|
|
|
}
|
2025-05-02 22:34:38 -04:00
|
|
|
#endif
|
2024-03-10 04:10:37 -04:00
|
|
|
}
|
|
|
|
|
|
2024-03-09 21:34:26 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert machine information
|
|
|
|
|
/// </summary>
|
2024-03-10 04:10:37 -04:00
|
|
|
/// <param name="item">Machine to convert</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 21:34:26 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ConvertMachine(Models.Metadata.Machine? item,
|
|
|
|
|
Source source,
|
|
|
|
|
long sourceIndex,
|
|
|
|
|
bool statsOnly,
|
|
|
|
|
FilterRunner? filterRunner)
|
2024-03-09 21:34:26 -05:00
|
|
|
{
|
|
|
|
|
// If the machine is invalid, we can't do anything
|
2024-10-19 21:41:08 -04:00
|
|
|
if (item == null || item.Count == 0)
|
2024-03-09 21:34:26 -05:00
|
|
|
return;
|
|
|
|
|
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the machine doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
return;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
// Create an internal machine and add to the dictionary
|
2025-01-10 13:10:50 -05:00
|
|
|
var machine = new Machine(item);
|
2025-05-02 00:28:22 -04:00
|
|
|
// long machineIndex = AddMachineDB(machine);
|
2024-03-19 15:21:01 -04:00
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
// Convert items in the machine
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.AdjusterKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Adjuster>(Models.Metadata.Machine.AdjusterKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.ArchiveKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Archive>(Models.Metadata.Machine.ArchiveKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.BiosSetKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.BiosSet>(Models.Metadata.Machine.BiosSetKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.ChipKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Chip>(Models.Metadata.Machine.ChipKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.ConfigurationKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Configuration>(Models.Metadata.Machine.ConfigurationKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DeviceKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Device>(Models.Metadata.Machine.DeviceKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DeviceRefKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.DeviceRef>(Models.Metadata.Machine.DeviceRefKey);
|
2025-05-14 12:48:14 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DipSwitchKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.DipSwitch>(Models.Metadata.Machine.DipSwitchKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DiskKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Disk>(Models.Metadata.Machine.DiskKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DisplayKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Display>(Models.Metadata.Machine.DisplayKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DriverKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Driver>(Models.Metadata.Machine.DriverKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.DumpKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Dump>(Models.Metadata.Machine.DumpKey);
|
2025-05-02 16:05:08 -04:00
|
|
|
string? machineName = machine.GetName();
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, machineName, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.FeatureKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Feature>(Models.Metadata.Machine.FeatureKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.InfoKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Info>(Models.Metadata.Machine.InfoKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.InputKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Input>(Models.Metadata.Machine.InputKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.MediaKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Media>(Models.Metadata.Machine.MediaKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.PartKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Part>(Models.Metadata.Machine.PartKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.PortKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Port>(Models.Metadata.Machine.PortKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.RamOptionKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.RamOption>(Models.Metadata.Machine.RamOptionKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.ReleaseKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Release>(Models.Metadata.Machine.ReleaseKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.RomKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Rom>(Models.Metadata.Machine.RomKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.SampleKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Sample>(Models.Metadata.Machine.SampleKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.SharedFeatKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.SharedFeat>(Models.Metadata.Machine.SharedFeatKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
2024-03-11 00:46:20 -04:00
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.SlotKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Slot>(Models.Metadata.Machine.SlotKey);
|
2025-05-14 12:48:14 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly);
|
2024-03-11 00:46:20 -04:00
|
|
|
}
|
2024-03-09 23:52:01 -05:00
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.SoftwareListKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.SoftwareList>(Models.Metadata.Machine.SoftwareListKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.SoundKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Sound>(Models.Metadata.Machine.SoundKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
if (item.ContainsKey(Models.Metadata.Machine.VideoKey))
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var items = item.ReadItemArray<Models.Metadata.Video>(Models.Metadata.Machine.VideoKey);
|
2025-05-02 22:34:38 -04:00
|
|
|
ProcessItems(items, machine, machineIndex: 0, source, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Adjuster information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Adjuster[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Adjuster(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 00:46:20 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 22:34:38 -04:00
|
|
|
//AddItemDB(datItem, machineIndex, sourceIndex, statsOnly, filterRunner);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Archive information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Archive[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Archive(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2025-01-10 23:02:36 -05:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert BiosSet information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.BiosSet[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new BiosSet(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Chip information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Chip[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Chip(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Configuration information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Configuration[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Configuration(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 00:46:20 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-10 00:20:56 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Device information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Device[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Device(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 00:46:20 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert DeviceRef information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-14 12:48:14 -04:00
|
|
|
/// <remarks>Does not get filtered here just in case merging or splitting is done</remarks>
|
|
|
|
|
private void ProcessItems(Models.Metadata.DeviceRef[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new DeviceRef(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2025-01-10 23:02:36 -05:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-10 00:20:56 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert DipSwitch information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.DipSwitch[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new DipSwitch(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 00:46:20 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-10 00:20:56 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Disk information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Disk[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Disk(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 16:26:28 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-10 00:20:56 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Display information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Display[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Display(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Driver information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Driver[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Driver(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-10 00:57:48 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Dump information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-10 00:57:48 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2024-03-19 14:23:41 -04:00
|
|
|
/// <param name="machineName">Machine name to use when constructing item names</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
2025-01-11 22:00:26 -05:00
|
|
|
/// TODO: Convert this into a constructor in Rom
|
2025-05-02 22:34:38 -04:00
|
|
|
private void ProcessItems(Models.Metadata.Dump[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, string? machineName, FilterRunner? filterRunner)
|
2024-03-10 00:57:48 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
2024-03-11 00:03:40 -04:00
|
|
|
int index = 0;
|
|
|
|
|
foreach (var dump in items)
|
2024-03-10 00:57:48 -05:00
|
|
|
{
|
2024-03-11 00:03:40 -04:00
|
|
|
// If we don't have rom data, we can't do anything
|
|
|
|
|
Models.Metadata.Rom? rom = null;
|
|
|
|
|
OpenMSXSubType subType = OpenMSXSubType.NULL;
|
|
|
|
|
if (dump?.Read<Models.Metadata.Rom>(Models.Metadata.Dump.RomKey) != null)
|
|
|
|
|
{
|
|
|
|
|
rom = dump.Read<Models.Metadata.Rom>(Models.Metadata.Dump.RomKey);
|
|
|
|
|
subType = OpenMSXSubType.Rom;
|
|
|
|
|
}
|
|
|
|
|
else if (dump?.Read<Models.Metadata.Rom>(Models.Metadata.Dump.MegaRomKey) != null)
|
|
|
|
|
{
|
|
|
|
|
rom = dump.Read<Models.Metadata.Rom>(Models.Metadata.Dump.MegaRomKey);
|
|
|
|
|
subType = OpenMSXSubType.MegaRom;
|
|
|
|
|
}
|
|
|
|
|
else if (dump?.Read<Models.Metadata.Rom>(Models.Metadata.Dump.SCCPlusCartKey) != null)
|
|
|
|
|
{
|
|
|
|
|
rom = dump.Read<Models.Metadata.Rom>(Models.Metadata.Dump.SCCPlusCartKey);
|
|
|
|
|
subType = OpenMSXSubType.SCCPlusCart;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(rom!))
|
|
|
|
|
continue;
|
|
|
|
|
|
2024-03-19 14:23:41 -04:00
|
|
|
string name = $"{machineName}_{index++}{(!string.IsNullOrEmpty(rom!.ReadString(Models.Metadata.Rom.RemarkKey)) ? $" {rom.ReadString(Models.Metadata.Rom.RemarkKey)}" : string.Empty)}";
|
2024-03-11 00:03:40 -04:00
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Rom();
|
2024-03-19 15:21:01 -04:00
|
|
|
datItem.SetName(name);
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.OffsetKey, rom.ReadString(Models.Metadata.Rom.StartKey));
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.OpenMSXMediaType, subType.AsStringValue());
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.OpenMSXType, rom.ReadString(Models.Metadata.Rom.OpenMSXType) ?? rom.ReadString(Models.Metadata.Rom.TypeKey));
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.RemarkKey, rom.ReadString(Models.Metadata.Rom.RemarkKey));
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.SHA1Key, rom.ReadString(Models.Metadata.Rom.SHA1Key));
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.StartKey, rom.ReadString(Models.Metadata.Rom.StartKey));
|
2025-01-11 22:00:26 -05:00
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-11 00:03:40 -04:00
|
|
|
|
2024-03-12 01:02:36 -04:00
|
|
|
if (dump.Read<Models.Metadata.Original>(Models.Metadata.Dump.OriginalKey) != null)
|
2024-03-11 00:03:40 -04:00
|
|
|
{
|
2024-03-12 01:02:36 -04:00
|
|
|
var original = dump.Read<Models.Metadata.Original>(Models.Metadata.Dump.OriginalKey)!;
|
2025-01-11 22:00:26 -05:00
|
|
|
datItem.SetFieldValue<Original?>("ORIGINAL", new Original
|
2024-03-11 00:03:40 -04:00
|
|
|
{
|
2024-03-12 01:02:36 -04:00
|
|
|
Value = original.ReadBool(Models.Metadata.Original.ValueKey),
|
|
|
|
|
Content = original.ReadString(Models.Metadata.Original.ContentKey),
|
2024-03-11 00:03:40 -04:00
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-19 15:21:01 -04:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 16:26:28 -04:00
|
|
|
|
|
|
|
|
// Process hash values
|
2024-03-19 15:21:01 -04:00
|
|
|
if (datItem.GetInt64FieldValue(Models.Metadata.Rom.SizeKey) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.SizeKey, datItem.GetInt64FieldValue(Models.Metadata.Rom.SizeKey).ToString());
|
|
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.CRCKey) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.CRCKey, TextHelper.NormalizeCRC32(datItem.GetStringFieldValue(Models.Metadata.Rom.CRCKey)));
|
2025-01-09 05:26:36 -05:00
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.MD2Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.MD2Key, TextHelper.NormalizeMD2(datItem.GetStringFieldValue(Models.Metadata.Rom.MD2Key)));
|
|
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.MD4Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.MD4Key, TextHelper.NormalizeMD5(datItem.GetStringFieldValue(Models.Metadata.Rom.MD4Key)));
|
2024-03-19 15:21:01 -04:00
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.MD5Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.MD5Key, TextHelper.NormalizeMD5(datItem.GetStringFieldValue(Models.Metadata.Rom.MD5Key)));
|
|
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.SHA1Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.SHA1Key, TextHelper.NormalizeSHA1(datItem.GetStringFieldValue(Models.Metadata.Rom.SHA1Key)));
|
|
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.SHA256Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.SHA256Key, TextHelper.NormalizeSHA256(datItem.GetStringFieldValue(Models.Metadata.Rom.SHA256Key)));
|
|
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.SHA384Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.SHA384Key, TextHelper.NormalizeSHA384(datItem.GetStringFieldValue(Models.Metadata.Rom.SHA384Key)));
|
|
|
|
|
if (datItem.GetStringFieldValue(Models.Metadata.Rom.SHA512Key) != null)
|
|
|
|
|
datItem.SetFieldValue<string?>(Models.Metadata.Rom.SHA512Key, TextHelper.NormalizeSHA512(datItem.GetStringFieldValue(Models.Metadata.Rom.SHA512Key)));
|
|
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-10 00:57:48 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Feature information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Feature[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Feature(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Info information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Info[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Info(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2025-01-10 23:02:36 -05:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Input information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Input[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Input(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 00:46:20 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Media information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Media[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Media(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 16:26:28 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Part information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Part[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var partItem = new Part(item);
|
2024-03-11 01:04:23 -04:00
|
|
|
|
|
|
|
|
// Handle subitems
|
2025-01-11 22:00:26 -05:00
|
|
|
var dataAreas = item.ReadItemArray<Models.Metadata.DataArea>(Models.Metadata.Part.DataAreaKey);
|
2024-03-11 01:04:23 -04:00
|
|
|
if (dataAreas != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var dataArea in dataAreas)
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var dataAreaItem = new DataArea(dataArea);
|
|
|
|
|
var roms = dataArea.ReadItemArray<Models.Metadata.Rom>(Models.Metadata.DataArea.RomKey);
|
2024-03-11 01:04:23 -04:00
|
|
|
if (roms == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-05-13 14:49:18 -04:00
|
|
|
// Handle "offset" roms
|
2025-05-13 10:16:17 -04:00
|
|
|
List<Rom> addRoms = [];
|
2024-03-11 01:04:23 -04:00
|
|
|
foreach (var rom in roms)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(rom))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-05-13 14:49:18 -04:00
|
|
|
// Convert the item
|
|
|
|
|
var romItem = new Rom(rom);
|
|
|
|
|
long? size = romItem.GetInt64FieldValue(Models.Metadata.Rom.SizeKey);
|
|
|
|
|
|
2025-05-14 08:01:11 -04:00
|
|
|
// If the rom is a continue or ignore
|
2025-05-13 10:16:17 -04:00
|
|
|
string? loadFlag = rom.ReadString(Models.Metadata.Rom.LoadFlagKey);
|
2025-05-14 08:01:11 -04:00
|
|
|
if (loadFlag != null
|
|
|
|
|
&& (loadFlag.Equals("continue", StringComparison.OrdinalIgnoreCase)
|
|
|
|
|
|| loadFlag.Equals("ignore", StringComparison.OrdinalIgnoreCase)))
|
2025-05-13 16:45:53 -04:00
|
|
|
{
|
|
|
|
|
var lastRom = addRoms[addRoms.Count - 1];
|
|
|
|
|
long? lastSize = lastRom.GetInt64FieldValue(Models.Metadata.Rom.SizeKey);
|
|
|
|
|
lastRom.SetFieldValue<long?>(Models.Metadata.Rom.SizeKey, lastSize + size);
|
2025-05-13 10:16:17 -04:00
|
|
|
continue;
|
2025-05-13 16:45:53 -04:00
|
|
|
}
|
2025-05-13 10:16:17 -04:00
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
romItem.SetFieldValue<DataArea?>(Rom.DataAreaKey, dataAreaItem);
|
|
|
|
|
romItem.SetFieldValue<Part?>(Rom.PartKey, partItem);
|
|
|
|
|
romItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-11 01:04:23 -04:00
|
|
|
romItem.CopyMachineInformation(machine);
|
2024-03-11 16:26:28 -04:00
|
|
|
|
2025-05-13 10:16:17 -04:00
|
|
|
addRoms.Add(romItem);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// Add all of the adjusted roms
|
|
|
|
|
foreach (var romItem in addRoms)
|
|
|
|
|
{
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(romItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(romItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-11 01:04:23 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var diskAreas = item.ReadItemArray<Models.Metadata.DiskArea>(Models.Metadata.Part.DiskAreaKey);
|
2024-03-11 01:04:23 -04:00
|
|
|
if (diskAreas != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var diskArea in diskAreas)
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var diskAreaitem = new DiskArea(diskArea);
|
|
|
|
|
var disks = diskArea.ReadItemArray<Models.Metadata.Disk>(Models.Metadata.DiskArea.DiskKey);
|
2024-03-11 01:04:23 -04:00
|
|
|
if (disks == null)
|
|
|
|
|
continue;
|
|
|
|
|
|
|
|
|
|
foreach (var disk in disks)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(disk))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var diskItem = new Disk(disk);
|
|
|
|
|
diskItem.SetFieldValue<DiskArea?>(Disk.DiskAreaKey, diskAreaitem);
|
|
|
|
|
diskItem.SetFieldValue<Part?>(Disk.PartKey, partItem);
|
|
|
|
|
diskItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-11 01:04:23 -04:00
|
|
|
diskItem.CopyMachineInformation(machine);
|
2024-03-11 16:26:28 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(diskItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(diskItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-11 01:04:23 -04:00
|
|
|
}
|
|
|
|
|
}
|
2024-03-11 20:57:24 -04:00
|
|
|
}
|
2024-03-11 01:04:23 -04:00
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var dipSwitches = item.ReadItemArray<Models.Metadata.DipSwitch>(Models.Metadata.Part.DipSwitchKey);
|
2024-03-11 20:57:24 -04:00
|
|
|
if (dipSwitches != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var dipSwitch in dipSwitches)
|
2024-03-11 01:04:23 -04:00
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(dipSwitch))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var dipSwitchItem = new DipSwitch(dipSwitch);
|
|
|
|
|
dipSwitchItem.SetFieldValue<Part?>(DipSwitch.PartKey, partItem);
|
|
|
|
|
dipSwitchItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-11 20:57:24 -04:00
|
|
|
dipSwitchItem.CopyMachineInformation(machine);
|
|
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(dipSwitchItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(dipSwitchItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-11 20:57:24 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var partFeatures = item.ReadItemArray<Models.Metadata.Feature>(Models.Metadata.Part.FeatureKey);
|
2024-03-11 20:57:24 -04:00
|
|
|
if (partFeatures != null)
|
|
|
|
|
{
|
|
|
|
|
foreach (var partFeature in partFeatures)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(partFeature))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var partFeatureItem = new PartFeature(partFeature);
|
|
|
|
|
partFeatureItem.SetFieldValue<Part?>(DipSwitch.PartKey, partItem);
|
|
|
|
|
partFeatureItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-11 20:57:24 -04:00
|
|
|
partFeatureItem.CopyMachineInformation(machine);
|
|
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(partFeatureItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(partFeatureItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-11 01:04:23 -04:00
|
|
|
}
|
|
|
|
|
}
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Port information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Port[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Port(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 00:46:20 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert RamOption information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.RamOption[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new RamOption(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Release information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Release[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Release(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Rom information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Rom[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Rom(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 16:26:28 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Sample information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Sample[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Sample(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2025-01-10 23:02:36 -05:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert SharedFeat information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.SharedFeat[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new SharedFeat(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2025-01-10 23:02:36 -05:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-11 00:46:20 -04:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Slot information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-11 00:46:20 -04:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-14 12:48:14 -04:00
|
|
|
/// <remarks>Does not get filtered here just in case merging or splitting is done</remarks>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Slot[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly)
|
2024-03-11 00:46:20 -04:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Slot(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-11 00:46:20 -04:00
|
|
|
datItem.CopyMachineInformation(machine);
|
|
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-11 00:46:20 -04:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <summary>
|
|
|
|
|
/// Convert SoftwareList information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.SoftwareList[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new SoftwareList(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Sound information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Sound[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Sound(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Convert Video information
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">Array of internal items to convert</param>
|
|
|
|
|
/// <param name="machine">Machine to use with the converted items</param>
|
2024-03-19 15:21:01 -04:00
|
|
|
/// <param name="machineIndex">Index of the Machine to use with the converted items</param>
|
2024-03-20 01:15:07 -04:00
|
|
|
/// <param name="source">Source to use with the converted items</param>
|
|
|
|
|
/// <param name="sourceIndex">Index of the Source to use with the converted items</param>
|
2024-03-09 23:52:01 -05:00
|
|
|
/// <param name="statsOnly">True to only add item statistics while parsing, false otherwise</param>
|
2025-05-02 22:34:38 -04:00
|
|
|
/// <param name="filterRunner">Optional FilterRunner to filter items on parse</param>
|
|
|
|
|
private void ProcessItems(Models.Metadata.Video[]? items, Machine machine, long machineIndex, Source source, long sourceIndex, bool statsOnly, FilterRunner? filterRunner)
|
2024-03-09 23:52:01 -05:00
|
|
|
{
|
|
|
|
|
// If the array is null or empty, return without processing
|
|
|
|
|
if (items == null || items.Length == 0)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
// Loop through the items and add
|
|
|
|
|
foreach (var item in items)
|
|
|
|
|
{
|
2025-05-02 22:34:38 -04:00
|
|
|
// If the item doesn't pass the filter
|
|
|
|
|
if (filterRunner != null && !filterRunner.Run(item))
|
|
|
|
|
continue;
|
|
|
|
|
|
2025-01-11 22:00:26 -05:00
|
|
|
var datItem = new Display(item);
|
|
|
|
|
datItem.SetFieldValue<Source?>(DatItem.SourceKey, source);
|
2024-03-09 23:52:01 -05:00
|
|
|
datItem.CopyMachineInformation(machine);
|
2024-03-11 20:57:24 -04:00
|
|
|
|
2025-01-12 22:10:48 -05:00
|
|
|
AddItem(datItem, statsOnly);
|
2025-05-02 00:28:22 -04:00
|
|
|
// AddItemDB(datItem, machineIndex, sourceIndex, statsOnly);
|
2024-03-09 23:52:01 -05:00
|
|
|
}
|
2024-03-09 21:34:26 -05:00
|
|
|
}
|
|
|
|
|
|
2024-03-11 01:08:44 -04:00
|
|
|
#endregion
|
2024-03-09 21:34:26 -05:00
|
|
|
}
|
|
|
|
|
}
|