using System.Linq; using SabreTools.DatItems; using SabreTools.Filter; namespace SabreTools.DatFiles { public static class MetadataConverter { #region Converters /// /// Convert metadata information /// /// Metadata file to convert /// Name of the file to be parsed /// Index ID for the DAT /// True to only add item statistics while parsing, false otherwise public static void ConvertMetadata(Models.Metadata.MetadataFile? item, string filename, int indexId, bool statsOnly) { // If the metadata file is invalid, we can't do anything if (item == null || !item.Any()) return; // Get the machines from the metadata var machines = item.Read(Models.Metadata.MetadataFile.MachineKey); if (machines == null) return; // Loop through the machines and add foreach (var machine in machines) { ConvertMachine(machine, filename, indexId, statsOnly); } } /// /// Convert machine information /// /// Metadata file to convert /// Name of the file to be parsed /// Index ID for the DAT /// True to only add item statistics while parsing, false otherwise private static void ConvertMachine(Models.Metadata.Machine? item, string filename, int indexId, bool statsOnly) { // If the machine is invalid, we can't do anything if (item == null || !item.Any()) return; // Create an internal machine var machine = new Machine(item); // Process all possible items /* AdjusterKey ArchiveKey BiosSetKey ChipKey ConfigurationKey DeviceKey DeviceRefKey DipSwitchKey DiskKey DisplayKey DriverKey DumpKey FeatureKey InfoKey InputKey MediaKey PartKey PortKey RamOptionKey ReleaseKey RomKey SampleKey SharedFeatKey SoftwareListKey SoundKey TruripKey VideoKey */ } #endregion } }