mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Wire up a whole bunch of stuff on read
This commit is contained in:
@@ -1083,6 +1083,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
OneRomPerGame();
|
OneRomPerGame();
|
||||||
|
|
||||||
// If we are removing fields, do that now
|
// If we are removing fields, do that now
|
||||||
|
// TODO: If this works, why in the hell do I have all of the "GetField" crap?????
|
||||||
if (Header.ExcludeFields != null && Header.ExcludeFields.Any())
|
if (Header.ExcludeFields != null && Header.ExcludeFields.Any())
|
||||||
RemoveFieldsFromItems();
|
RemoveFieldsFromItems();
|
||||||
|
|
||||||
@@ -1536,8 +1537,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If the game has no devices, we continue
|
// If the game has no devices, we continue
|
||||||
if (Items[game][0].Machine.DeviceReferences == null
|
if (Items[game][0].Machine.DeviceReferences == null
|
||||||
|| Items[game][0].Machine.DeviceReferences.Count == 0
|
|| Items[game][0].Machine.DeviceReferences.Count == 0
|
||||||
|| (slotoptions && Items[game][0].Machine.SlotOptions == null)
|
|| (slotoptions && Items[game][0].Machine.Slots == null)
|
||||||
|| (slotoptions && Items[game][0].Machine.SlotOptions.Count == 0))
|
|| (slotoptions && Items[game][0].Machine.Slots.Count == 0))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@@ -1577,36 +1578,39 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// If we're checking slotoptions too
|
// If we're checking slotoptions too
|
||||||
if (slotoptions)
|
if (slotoptions)
|
||||||
{
|
{
|
||||||
// Determine if the game has any slotoptions or not
|
// Determine if the game has any slots or not
|
||||||
List<string> slotopts = Items[game][0].Machine.SlotOptions;
|
List<ListXmlSlot> slots = Items[game][0].Machine.Slots;
|
||||||
List<string> newslotopts = new List<string>();
|
List<ListXmlSlot> newSlots = new List<ListXmlSlot>();
|
||||||
foreach (string slotopt in slotopts)
|
foreach (ListXmlSlot slot in slots)
|
||||||
{
|
{
|
||||||
// If the slotoption doesn't exist then we continue
|
foreach (ListXmlSlotOption slotOption in slot.SlotOptions)
|
||||||
if (Items[slotopt].Count == 0)
|
|
||||||
continue;
|
|
||||||
|
|
||||||
// Otherwise, copy the items from the slotoption to the current game
|
|
||||||
DatItem copyFrom = Items[game][0];
|
|
||||||
List<DatItem> slotItems = Items[slotopt];
|
|
||||||
foreach (DatItem item in slotItems)
|
|
||||||
{
|
{
|
||||||
DatItem datItem = (DatItem)item.Clone();
|
// If the slotoption doesn't exist then we continue
|
||||||
newslotopts.AddRange(datItem.Machine.SlotOptions ?? new List<string>());
|
if (Items[slotOption.Name].Count == 0)
|
||||||
datItem.CopyMachineInformation(copyFrom);
|
continue;
|
||||||
if (Items[game].Where(i => i.Name.ToLowerInvariant() == datItem.Name.ToLowerInvariant()).Count() == 0)
|
|
||||||
|
// Otherwise, copy the items from the slotoption to the current game
|
||||||
|
DatItem copyFrom = Items[game][0];
|
||||||
|
List<DatItem> slotItems = Items[slotOption.Name];
|
||||||
|
foreach (DatItem item in slotItems)
|
||||||
{
|
{
|
||||||
foundnew = true;
|
DatItem datItem = (DatItem)item.Clone();
|
||||||
Items.Add(game, datItem);
|
newSlots.AddRange(datItem.Machine.Slots ?? new List<ListXmlSlot>());
|
||||||
|
|
||||||
|
datItem.CopyMachineInformation(copyFrom);
|
||||||
|
if (Items[game].Where(i => i.Name.ToLowerInvariant() == datItem.Name.ToLowerInvariant()).Count() == 0)
|
||||||
|
{
|
||||||
|
foundnew = true;
|
||||||
|
Items.Add(game, datItem);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now that every slotoption is accounted for, add the new list of slotoptions, if they don't already exist
|
// Now that every slotoption is accounted for, add the new list of slots, if they don't already exist
|
||||||
foreach (string slotopt in newslotopts)
|
foreach (ListXmlSlot slot in newSlots)
|
||||||
{
|
{
|
||||||
if (!Items[game][0].Machine.SlotOptions.Contains(slotopt))
|
Items[game][0].Machine.Slots.Add(slot);
|
||||||
Items[game][0].Machine.SlotOptions.Add(slotopt);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -550,15 +550,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case "slotoptions":
|
|
||||||
machine.SlotOptions = new List<string>();
|
|
||||||
jtr.Read(); // Start Array
|
|
||||||
while (!sr.EndOfStream && jtr.TokenType != JsonToken.EndArray)
|
|
||||||
{
|
|
||||||
machine.SlotOptions.Add(jtr.ReadAsString());
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
// TODO: Add `slot`
|
||||||
|
|
||||||
case "infos":
|
case "infos":
|
||||||
machine.Infos = new List<ListXmlInfo>();
|
machine.Infos = new List<ListXmlInfo>();
|
||||||
jtr.Read(); // Start Array
|
jtr.Read(); // Start Array
|
||||||
@@ -654,12 +648,14 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (jtr.TokenType == JsonToken.EndArray)
|
if (jtr.TokenType == JsonToken.EndArray)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
var sharedFeature = new SoftwareListSharedFeature();
|
||||||
|
|
||||||
jtr.Read(); // Key
|
jtr.Read(); // Key
|
||||||
string key = jtr.Value as string;
|
sharedFeature.Name = jtr.Value as string;
|
||||||
string value = jtr.ReadAsString();
|
sharedFeature.Value = jtr.ReadAsString();
|
||||||
jtr.Read(); // End object
|
jtr.Read(); // End object
|
||||||
|
|
||||||
machine.SharedFeatures.Add(new SoftwareListSharedFeature(key, value));
|
machine.SharedFeatures.Add(sharedFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -850,7 +846,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
datItem.AltName = altName;
|
datItem.AltName = altName;
|
||||||
datItem.AltTitle = altTitle;
|
datItem.AltTitle = altTitle;
|
||||||
|
|
||||||
datItem.Original = new OpenMSXOriginal() { Name = original };
|
datItem.Original = new OpenMSXOriginal() { Content = original };
|
||||||
datItem.OpenMSXSubType = subType;
|
datItem.OpenMSXSubType = subType;
|
||||||
datItem.OpenMSXType = msxType;
|
datItem.OpenMSXType = msxType;
|
||||||
datItem.Remark = remark;
|
datItem.Remark = remark;
|
||||||
@@ -998,12 +994,14 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (jtr.TokenType == JsonToken.EndArray)
|
if (jtr.TokenType == JsonToken.EndArray)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
var feature = new SoftwareListFeature();
|
||||||
|
|
||||||
jtr.Read(); // Key
|
jtr.Read(); // Key
|
||||||
string key = jtr.Value as string;
|
feature.Name = jtr.Value as string;
|
||||||
string featureValue = jtr.ReadAsString();
|
feature.Value = jtr.ReadAsString();
|
||||||
jtr.Read(); // End object
|
jtr.Read(); // End object
|
||||||
|
|
||||||
features.Add(new SoftwareListFeature(key, featureValue));
|
features.Add(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -1724,7 +1722,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Devices, Header.ExcludeFields)))
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.DeviceReferences, Header.ExcludeFields)))
|
||||||
{
|
{
|
||||||
jtw.WritePropertyName("devices");
|
jtw.WritePropertyName("devices");
|
||||||
jtw.WriteStartArray();
|
jtw.WriteStartArray();
|
||||||
@@ -1735,17 +1733,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
jtw.WriteEndArray();
|
jtw.WriteEndArray();
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.SlotOptions, Header.ExcludeFields)))
|
|
||||||
{
|
// TODO: Add Field.Slots
|
||||||
jtw.WritePropertyName("slotoptions");
|
|
||||||
jtw.WriteStartArray();
|
|
||||||
foreach (string slotoption in datItem.Machine.SlotOptions)
|
|
||||||
{
|
|
||||||
jtw.WriteValue(slotoption);
|
|
||||||
}
|
|
||||||
|
|
||||||
jtw.WriteEndArray();
|
|
||||||
}
|
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Infos, Header.ExcludeFields)))
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Infos, Header.ExcludeFields)))
|
||||||
{
|
{
|
||||||
jtw.WritePropertyName("infos");
|
jtw.WritePropertyName("infos");
|
||||||
@@ -2231,7 +2221,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Original, Header.ExcludeFields)))
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.Original, Header.ExcludeFields)))
|
||||||
{
|
{
|
||||||
jtw.WritePropertyName("original");
|
jtw.WritePropertyName("original");
|
||||||
jtw.WriteValue(datItem.Original.Name);
|
jtw.WriteValue(datItem.Original.Content);
|
||||||
}
|
}
|
||||||
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.OpenMSXSubType, Header.ExcludeFields)))
|
if (!string.IsNullOrWhiteSpace(datItem.GetField(Field.OpenMSXSubType, Header.ExcludeFields)))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
|
|
||||||
@@ -125,10 +126,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Otherwise, add what is possible
|
// Otherwise, add what is possible
|
||||||
reader.MoveToContent();
|
reader.MoveToContent();
|
||||||
|
|
||||||
string key = string.Empty;
|
|
||||||
string temptype = reader.Name;
|
|
||||||
bool containsItems = false;
|
|
||||||
|
|
||||||
// Create a new machine
|
// Create a new machine
|
||||||
MachineType machineType = MachineType.NULL;
|
MachineType machineType = MachineType.NULL;
|
||||||
if (reader.GetAttribute("isbios").AsYesNo() == true)
|
if (reader.GetAttribute("isbios").AsYesNo() == true)
|
||||||
@@ -143,21 +140,29 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Machine machine = new Machine
|
Machine machine = new Machine
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Description = reader.GetAttribute("name"),
|
|
||||||
SourceFile = reader.GetAttribute("sourcefile"),
|
|
||||||
Runnable = reader.GetAttribute("runnable").AsRunnable(),
|
|
||||||
|
|
||||||
Comment = string.Empty,
|
Comment = string.Empty,
|
||||||
|
Description = reader.GetAttribute("name"),
|
||||||
CloneOf = reader.GetAttribute("cloneof") ?? string.Empty,
|
CloneOf = reader.GetAttribute("cloneof") ?? string.Empty,
|
||||||
RomOf = reader.GetAttribute("romof") ?? string.Empty,
|
RomOf = reader.GetAttribute("romof") ?? string.Empty,
|
||||||
SampleOf = reader.GetAttribute("sampleof") ?? string.Empty,
|
SampleOf = reader.GetAttribute("sampleof") ?? string.Empty,
|
||||||
DeviceReferences = new List<ListXmlDeviceReference>(),
|
|
||||||
SlotOptions = new List<string>(),
|
|
||||||
|
|
||||||
MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType),
|
MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType),
|
||||||
|
|
||||||
|
SourceFile = reader.GetAttribute("sourcefile"),
|
||||||
|
Runnable = reader.GetAttribute("runnable").AsRunnable(),
|
||||||
|
DeviceReferences = new List<ListXmlDeviceReference>(),
|
||||||
|
Chips = new List<ListXmlChip>(),
|
||||||
|
Displays = new List<ListXmlDisplay>(),
|
||||||
|
Sounds = new List<ListXmlSound>(),
|
||||||
|
Conditions = new List<ListXmlCondition>(),
|
||||||
|
Inputs = new List<ListXmlInput>(),
|
||||||
|
DipSwitches = new List<ListXmlDipSwitch>(),
|
||||||
|
Configurations = new List<ListXmlConfiguration>(),
|
||||||
|
Slots = new List<ListXmlSlot>(),
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Get list for new DatItems
|
||||||
|
List<DatItem> datItems = new List<DatItem>();
|
||||||
|
|
||||||
while (!reader.EOF)
|
while (!reader.EOF)
|
||||||
{
|
{
|
||||||
// We only want elements
|
// We only want elements
|
||||||
@@ -183,9 +188,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "biosset":
|
case "biosset":
|
||||||
containsItems = true;
|
datItems.Add(new BiosSet
|
||||||
|
|
||||||
DatItem biosset = new BiosSet
|
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Description = reader.GetAttribute("description"),
|
Description = reader.GetAttribute("description"),
|
||||||
@@ -196,20 +199,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Index = indexId,
|
Index = indexId,
|
||||||
Name = filename,
|
Name = filename,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
biosset.CopyMachineInformation(machine);
|
|
||||||
|
|
||||||
// Now process and add the rom
|
|
||||||
key = ParseAddHelper(biosset);
|
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "rom":
|
case "rom":
|
||||||
containsItems = true;
|
datItems.Add(new Rom
|
||||||
|
|
||||||
DatItem rom = new Rom
|
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
Bios = reader.GetAttribute("bios"),
|
Bios = reader.GetAttribute("bios"),
|
||||||
@@ -234,20 +230,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Index = indexId,
|
Index = indexId,
|
||||||
Name = filename,
|
Name = filename,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
rom.CopyMachineInformation(machine);
|
|
||||||
|
|
||||||
// Now process and add the rom
|
|
||||||
key = ParseAddHelper(rom);
|
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "disk":
|
case "disk":
|
||||||
containsItems = true;
|
datItems.Add(new Disk
|
||||||
|
|
||||||
DatItem disk = new Disk
|
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
MD5 = reader.GetAttribute("md5"),
|
MD5 = reader.GetAttribute("md5"),
|
||||||
@@ -270,18 +259,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Index = indexId,
|
Index = indexId,
|
||||||
Name = filename,
|
Name = filename,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
disk.CopyMachineInformation(machine);
|
|
||||||
|
|
||||||
// Now process and add the rom
|
|
||||||
key = ParseAddHelper(disk);
|
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "device_ref":
|
case "device_ref":
|
||||||
// TODO: Use these device references
|
|
||||||
var deviceReference = new ListXmlDeviceReference();
|
var deviceReference = new ListXmlDeviceReference();
|
||||||
deviceReference.Name = reader.GetAttribute("name");
|
deviceReference.Name = reader.GetAttribute("name");
|
||||||
|
|
||||||
@@ -291,9 +274,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "sample":
|
case "sample":
|
||||||
containsItems = true;
|
datItems.Add(new Sample
|
||||||
|
|
||||||
DatItem samplerom = new Sample
|
|
||||||
{
|
{
|
||||||
Name = reader.GetAttribute("name"),
|
Name = reader.GetAttribute("name"),
|
||||||
|
|
||||||
@@ -302,29 +283,24 @@ namespace SabreTools.Library.DatFiles
|
|||||||
Index = indexId,
|
Index = indexId,
|
||||||
Name = filename,
|
Name = filename,
|
||||||
},
|
},
|
||||||
};
|
});
|
||||||
|
|
||||||
samplerom.CopyMachineInformation(machine);
|
|
||||||
|
|
||||||
// Now process and add the rom
|
|
||||||
key = ParseAddHelper(samplerom);
|
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "chip":
|
case "chip":
|
||||||
// TODO: Use these chips
|
|
||||||
var chip = new ListXmlChip();
|
var chip = new ListXmlChip();
|
||||||
chip.Name = reader.GetAttribute("name");
|
chip.Name = reader.GetAttribute("name");
|
||||||
chip.Tag = reader.GetAttribute("tag");
|
chip.Tag = reader.GetAttribute("tag");
|
||||||
chip.Type = reader.GetAttribute("type");
|
chip.Type = reader.GetAttribute("type");
|
||||||
chip.Clock = reader.GetAttribute("clock");
|
chip.Clock = reader.GetAttribute("clock");
|
||||||
|
|
||||||
|
machine.Chips.Add(chip);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "display":
|
case "display":
|
||||||
// TODO: Use these displays
|
|
||||||
var display = new ListXmlDisplay();
|
var display = new ListXmlDisplay();
|
||||||
display.Tag = reader.GetAttribute("tag");
|
display.Tag = reader.GetAttribute("tag");
|
||||||
display.Type = reader.GetAttribute("type");
|
display.Type = reader.GetAttribute("type");
|
||||||
@@ -341,30 +317,33 @@ namespace SabreTools.Library.DatFiles
|
|||||||
display.VBend = reader.GetAttribute("vbend");
|
display.VBend = reader.GetAttribute("vbend");
|
||||||
display.VStart = reader.GetAttribute("vstart");
|
display.VStart = reader.GetAttribute("vstart");
|
||||||
|
|
||||||
|
machine.Displays.Add(display);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "sound":
|
case "sound":
|
||||||
// TODO: Use these sounds
|
|
||||||
var sound = new ListXmlSound();
|
var sound = new ListXmlSound();
|
||||||
sound.Channels = reader.GetAttribute("channels");
|
sound.Channels = reader.GetAttribute("channels");
|
||||||
|
|
||||||
|
machine.Sounds.Add(sound);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "condition":
|
case "condition":
|
||||||
// TODO: Use these conditions
|
|
||||||
var condition = new ListXmlCondition();
|
var condition = new ListXmlCondition();
|
||||||
condition.Tag = reader.GetAttribute("tag");
|
condition.Tag = reader.GetAttribute("tag");
|
||||||
condition.Mask = reader.GetAttribute("mask");
|
condition.Mask = reader.GetAttribute("mask");
|
||||||
condition.Relation = reader.GetAttribute("relation");
|
condition.Relation = reader.GetAttribute("relation");
|
||||||
condition.Value = reader.GetAttribute("value");
|
condition.Value = reader.GetAttribute("value");
|
||||||
|
|
||||||
|
machine.Conditions.Add(condition);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "input":
|
case "input":
|
||||||
// TODO: Use these inputs
|
|
||||||
var input = new ListXmlInput();
|
var input = new ListXmlInput();
|
||||||
input.Service = reader.GetAttribute("service").AsYesNo();
|
input.Service = reader.GetAttribute("service").AsYesNo();
|
||||||
input.Tilt = reader.GetAttribute("tilt").AsYesNo();
|
input.Tilt = reader.GetAttribute("tilt").AsYesNo();
|
||||||
@@ -374,12 +353,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
ReadInput(reader.ReadSubtree(), input);
|
ReadInput(reader.ReadSubtree(), input);
|
||||||
|
|
||||||
|
machine.Inputs.Add(input);
|
||||||
|
|
||||||
// Skip the input now that we've processed it
|
// Skip the input now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "dipswitch":
|
case "dipswitch":
|
||||||
// TODO: Use these dipswitches
|
|
||||||
var dipSwitch = new ListXmlDipSwitch();
|
var dipSwitch = new ListXmlDipSwitch();
|
||||||
dipSwitch.Name = reader.GetAttribute("name");
|
dipSwitch.Name = reader.GetAttribute("name");
|
||||||
dipSwitch.Tag = reader.GetAttribute("tag");
|
dipSwitch.Tag = reader.GetAttribute("tag");
|
||||||
@@ -388,12 +368,13 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
ReadDipSwitch(reader.ReadSubtree(), dipSwitch);
|
ReadDipSwitch(reader.ReadSubtree(), dipSwitch);
|
||||||
|
|
||||||
|
machine.DipSwitches.Add(dipSwitch);
|
||||||
|
|
||||||
// Skip the dipswitch now that we've processed it
|
// Skip the dipswitch now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "configuration":
|
case "configuration":
|
||||||
// TODO: Use these configurations
|
|
||||||
var configuration = new ListXmlConfiguration();
|
var configuration = new ListXmlConfiguration();
|
||||||
configuration.Name = reader.GetAttribute("name");
|
configuration.Name = reader.GetAttribute("name");
|
||||||
configuration.Tag = reader.GetAttribute("tag");
|
configuration.Tag = reader.GetAttribute("tag");
|
||||||
@@ -402,6 +383,8 @@ namespace SabreTools.Library.DatFiles
|
|||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
ReadConfiguration(reader.ReadSubtree(), configuration);
|
ReadConfiguration(reader.ReadSubtree(), configuration);
|
||||||
|
|
||||||
|
machine.Configurations.Add(configuration);
|
||||||
|
|
||||||
// Skip the configuration now that we've processed it
|
// Skip the configuration now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
break;
|
break;
|
||||||
@@ -451,6 +434,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "device":
|
case "device":
|
||||||
// TODO: Use these devices
|
// TODO: Use these devices
|
||||||
var device = new ListXmlDevice();
|
var device = new ListXmlDevice();
|
||||||
@@ -468,12 +452,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "slot":
|
case "slot":
|
||||||
// TODO: Use these slots
|
|
||||||
var slot = new ListXmlSlot();
|
var slot = new ListXmlSlot();
|
||||||
slot.Name = reader.GetAttribute("name");
|
slot.Name = reader.GetAttribute("name");
|
||||||
|
|
||||||
// Now read the internal tags
|
// Now read the internal tags
|
||||||
ReadSlot(reader.ReadSubtree(), slot, machine);
|
ReadSlot(reader.ReadSubtree(), slot, machine);
|
||||||
|
machine.Slots.Add(slot);
|
||||||
|
|
||||||
// Skip the slot now that we've processed it
|
// Skip the slot now that we've processed it
|
||||||
reader.Skip();
|
reader.Skip();
|
||||||
@@ -503,8 +487,18 @@ namespace SabreTools.Library.DatFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If we found items, copy the machine info and add them
|
||||||
|
if (datItems.Any())
|
||||||
|
{
|
||||||
|
foreach (DatItem datItem in datItems)
|
||||||
|
{
|
||||||
|
datItem.CopyMachineInformation(machine);
|
||||||
|
ParseAddHelper(datItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// If no items were found for this machine, add a Blank placeholder
|
// If no items were found for this machine, add a Blank placeholder
|
||||||
if (!containsItems)
|
else
|
||||||
{
|
{
|
||||||
Blank blank = new Blank()
|
Blank blank = new Blank()
|
||||||
{
|
{
|
||||||
@@ -558,10 +552,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
slotOption.DeviceName = reader.GetAttribute("devname");
|
slotOption.DeviceName = reader.GetAttribute("devname");
|
||||||
slotOption.Default = reader.GetAttribute("default").AsYesNo();
|
slotOption.Default = reader.GetAttribute("default").AsYesNo();
|
||||||
|
|
||||||
// TODO: Retire this direct machine setter
|
|
||||||
if (!machine.SlotOptions.Contains(slotOption.DeviceName))
|
|
||||||
machine.SlotOptions.Add(slotOption.DeviceName);
|
|
||||||
|
|
||||||
slot.SlotOptions.Add(slotOption);
|
slot.SlotOptions.Add(slotOption);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case "original":
|
case "original":
|
||||||
original = new OpenMSXOriginal();
|
original = new OpenMSXOriginal();
|
||||||
original.Value = reader.GetAttribute("value").AsYesNo();
|
original.Value = reader.GetAttribute("value").AsYesNo();
|
||||||
original.Name = reader.ReadElementContentAsString();
|
original.Content = reader.ReadElementContentAsString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@@ -730,7 +730,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
{
|
{
|
||||||
xtw.WriteStartElement("original");
|
xtw.WriteStartElement("original");
|
||||||
xtw.WriteAttributeString("value", rom.Original.Value == true ? "true" : "false");
|
xtw.WriteAttributeString("value", rom.Original.Value == true ? "true" : "false");
|
||||||
xtw.WriteString(rom.Original.Name);
|
xtw.WriteString(rom.Original.Content);
|
||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -389,15 +389,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Machine.SlotOptions":
|
// TODO: Add Machine.Slot
|
||||||
machine.SlotOptions = new List<string>();
|
|
||||||
var slotOptions = value.Split(';');
|
|
||||||
foreach (var slotOption in slotOptions)
|
|
||||||
{
|
|
||||||
machine.SlotOptions.Add(slotOption);
|
|
||||||
}
|
|
||||||
|
|
||||||
break;
|
|
||||||
|
|
||||||
case "Machine.Infos":
|
case "Machine.Infos":
|
||||||
machine.Infos = new List<ListXmlInfo>();
|
machine.Infos = new List<ListXmlInfo>();
|
||||||
@@ -494,18 +486,20 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case "Machine.SharedFeatures":
|
case "Machine.SharedFeatures":
|
||||||
machine.SharedFeatures = new List<SoftwareListSharedFeature>();
|
machine.SharedFeatures = new List<SoftwareListSharedFeature>();
|
||||||
var sharedFeatures = value.Split(';');
|
var sharedFeatures = value.Split(';');
|
||||||
foreach (var sharedFeature in sharedFeatures)
|
foreach (var pair in sharedFeatures)
|
||||||
{
|
{
|
||||||
var featurePair = sharedFeature.Split('=');
|
var featurePair = pair.Split('=');
|
||||||
machine.SharedFeatures.Add(new SoftwareListSharedFeature(featurePair[0], featurePair[1]));
|
|
||||||
|
var sharedFeature = new SoftwareListSharedFeature();
|
||||||
|
sharedFeature.Name = featurePair[0];
|
||||||
|
sharedFeature.Value = featurePair[1];
|
||||||
|
|
||||||
|
machine.SharedFeatures.Add(sharedFeature);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "Machine.DipSwitches":
|
// TODO: Implement Machine.DipSwitches
|
||||||
machine.DipSwitches = new List<ListXmlDipSwitch>();
|
|
||||||
// TODO: There is no way this would work... Just use empty for now
|
|
||||||
break;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
@@ -577,7 +571,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
foreach (var splitFeature in splitFeatures)
|
foreach (var splitFeature in splitFeatures)
|
||||||
{
|
{
|
||||||
var featurePair = splitFeature.Split('=');
|
var featurePair = splitFeature.Split('=');
|
||||||
features.Add(new SoftwareListFeature(featurePair[0], featurePair[1]));
|
|
||||||
|
var feature = new SoftwareListFeature();
|
||||||
|
feature.Name = featurePair[0];
|
||||||
|
feature.Value = featurePair[1];
|
||||||
|
|
||||||
|
features.Add(feature);
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
@@ -720,7 +719,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
Original = new OpenMSXOriginal() { Name = original },
|
Original = new OpenMSXOriginal() { Content = original },
|
||||||
OpenMSXSubType = subType,
|
OpenMSXSubType = subType,
|
||||||
OpenMSXType = msxType,
|
OpenMSXType = msxType,
|
||||||
Remark = remark,
|
Remark = remark,
|
||||||
@@ -755,7 +754,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
Original = new OpenMSXOriginal() { Name = original },
|
Original = new OpenMSXOriginal() { Content = original },
|
||||||
OpenMSXSubType = subType,
|
OpenMSXSubType = subType,
|
||||||
OpenMSXType = msxType,
|
OpenMSXType = msxType,
|
||||||
Remark = remark,
|
Remark = remark,
|
||||||
@@ -793,7 +792,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
Original = new OpenMSXOriginal() { Name = original },
|
Original = new OpenMSXOriginal() { Content = original },
|
||||||
OpenMSXSubType = subType,
|
OpenMSXSubType = subType,
|
||||||
OpenMSXType = msxType,
|
OpenMSXType = msxType,
|
||||||
Remark = remark,
|
Remark = remark,
|
||||||
@@ -843,7 +842,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
Original = new OpenMSXOriginal() { Name = original },
|
Original = new OpenMSXOriginal() { Content = original },
|
||||||
OpenMSXSubType = subType,
|
OpenMSXSubType = subType,
|
||||||
OpenMSXType = msxType,
|
OpenMSXType = msxType,
|
||||||
Remark = remark,
|
Remark = remark,
|
||||||
@@ -883,7 +882,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
Original = new OpenMSXOriginal() { Name = original },
|
Original = new OpenMSXOriginal() { Content = original },
|
||||||
OpenMSXSubType = subType,
|
OpenMSXSubType = subType,
|
||||||
OpenMSXType = msxType,
|
OpenMSXType = msxType,
|
||||||
Remark = remark,
|
Remark = remark,
|
||||||
@@ -937,7 +936,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
AltName = altName,
|
AltName = altName,
|
||||||
AltTitle = altTitle,
|
AltTitle = altTitle,
|
||||||
|
|
||||||
Original = new OpenMSXOriginal() { Name = original },
|
Original = new OpenMSXOriginal() { Content = original },
|
||||||
OpenMSXSubType = subType,
|
OpenMSXSubType = subType,
|
||||||
OpenMSXType = msxType,
|
OpenMSXType = msxType,
|
||||||
Remark = remark,
|
Remark = remark,
|
||||||
@@ -1265,10 +1264,7 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case "devices":
|
case "devices":
|
||||||
return "Machine.Devices";
|
return "Machine.Devices";
|
||||||
|
|
||||||
case "slotoptions":
|
// TODO: Add Machine.Slot
|
||||||
case "slot options":
|
|
||||||
case "slot-options":
|
|
||||||
return "Machine.SlotOptions";
|
|
||||||
|
|
||||||
case "infos":
|
case "infos":
|
||||||
return "Machine.Infos";
|
return "Machine.Infos";
|
||||||
|
|||||||
@@ -191,7 +191,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "sharedfeat":
|
case "sharedfeat":
|
||||||
machine.SharedFeatures.Add(new SoftwareListSharedFeature(reader.GetAttribute("name"), reader.GetAttribute("value")));
|
var sharedFeature = new SoftwareListSharedFeature();
|
||||||
|
sharedFeature.Name = reader.GetAttribute("name");
|
||||||
|
sharedFeature.Value = reader.GetAttribute("value");
|
||||||
|
|
||||||
|
machine.SharedFeatures.Add(sharedFeature);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -284,7 +289,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "feature":
|
case "feature":
|
||||||
features.Add(new SoftwareListFeature(reader.GetAttribute("name"), reader.GetAttribute("value")));
|
var feature = new SoftwareListFeature();
|
||||||
|
feature.Name = reader.GetAttribute("name");
|
||||||
|
feature.Value = reader.GetAttribute("value");
|
||||||
|
|
||||||
|
features.Add(feature);
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// This holds all of the auxiliary types needed for proper parsing
|
/// This holds all of the auxiliary types needed for proper parsing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -12,151 +14,248 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML adjuster
|
/// Represents one ListXML adjuster
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("adjuster")]
|
||||||
public class ListXmlAdjuster
|
public class ListXmlAdjuster
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public bool? Default { get; set; }
|
|
||||||
public List<ListXmlCondition> Conditions { get; set; }
|
|
||||||
|
|
||||||
public ListXmlAdjuster()
|
[JsonProperty("default")]
|
||||||
{
|
public bool? Default { get; set; }
|
||||||
Conditions = new List<ListXmlCondition>();
|
|
||||||
}
|
[JsonProperty("conditions")]
|
||||||
|
public List<ListXmlCondition> Conditions { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML analog
|
/// Represents one ListXML analog
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("analog")]
|
||||||
public class ListXmlAnalog
|
public class ListXmlAnalog
|
||||||
{
|
{
|
||||||
|
[JsonProperty("mask")]
|
||||||
public string Mask { get; set; }
|
public string Mask { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML chip
|
/// Represents one ListXML chip
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("chip")]
|
||||||
public class ListXmlChip
|
public class ListXmlChip
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("tag")]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; } // TODO: (cpu|audio)
|
public string Type { get; set; } // TODO: (cpu|audio)
|
||||||
|
|
||||||
|
[JsonProperty("clock")]
|
||||||
public string Clock { get; set; }
|
public string Clock { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML condition
|
/// Represents one ListXML condition
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("condition")]
|
||||||
public class ListXmlCondition
|
public class ListXmlCondition
|
||||||
{
|
{
|
||||||
|
[JsonProperty("tag")]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("mask")]
|
||||||
public string Mask { get; set; }
|
public string Mask { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("relation")]
|
||||||
public string Relation { get; set; } // TODO: (eq|ne|gt|le|lt|ge)
|
public string Relation { get; set; } // TODO: (eq|ne|gt|le|lt|ge)
|
||||||
|
|
||||||
|
[JsonProperty("value")]
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML configuration
|
/// Represents one ListXML configuration
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("configuration")]
|
||||||
public class ListXmlConfiguration
|
public class ListXmlConfiguration
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Tag { get; set; }
|
|
||||||
public string Mask { get; set; }
|
|
||||||
public List<ListXmlConfLocation> Locations { get; set; }
|
|
||||||
public List<ListXmlConfSetting> Settings { get; set; }
|
|
||||||
|
|
||||||
public ListXmlConfiguration()
|
[JsonProperty("tag")]
|
||||||
{
|
public string Tag { get; set; }
|
||||||
Locations = new List<ListXmlConfLocation>();
|
|
||||||
Settings = new List<ListXmlConfSetting>();
|
[JsonProperty("mask")]
|
||||||
}
|
public string Mask { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("locations")]
|
||||||
|
public List<ListXmlConfLocation> Locations { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("settings")]
|
||||||
|
public List<ListXmlConfSetting> Settings { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML conflocation
|
/// Represents one ListXML conflocation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("conflocation")]
|
||||||
public class ListXmlConfLocation
|
public class ListXmlConfLocation
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("number")]
|
||||||
public string Number { get; set; }
|
public string Number { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("inverted")]
|
||||||
public bool? Inverted { get; set; }
|
public bool? Inverted { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML confsetting
|
/// Represents one ListXML confsetting
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("confsetting")]
|
||||||
public class ListXmlConfSetting
|
public class ListXmlConfSetting
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("value")]
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("default")]
|
||||||
public bool? Default { get; set; }
|
public bool? Default { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML control
|
/// Represents one ListXML control
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("control")]
|
||||||
public class ListXmlControl
|
public class ListXmlControl
|
||||||
{
|
{
|
||||||
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("player")]
|
||||||
public string Player { get; set; } // TODO: Int32?
|
public string Player { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("buttons")]
|
||||||
public string Buttons { get; set; } // TODO: Int32?
|
public string Buttons { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("regbuttons")]
|
||||||
public string RegButtons { get; set; } // TODO: Int32?
|
public string RegButtons { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("minimum")]
|
||||||
public string Minimum { get; set; } // TODO: Int32? Float?
|
public string Minimum { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("maximum")]
|
||||||
public string Maximum { get; set; } // TODO: Int32? Float?
|
public string Maximum { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("sensitivity")]
|
||||||
public string Sensitivity { get; set; } // TODO: Int32? Float?
|
public string Sensitivity { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("keydelta")]
|
||||||
public string KeyDelta { get; set; } // TODO: Int32? Float?
|
public string KeyDelta { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("reverse")]
|
||||||
public bool? Reverse { get; set; }
|
public bool? Reverse { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("ways")]
|
||||||
public string Ways { get; set; } // TODO: Int32? Float?
|
public string Ways { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("ways2")]
|
||||||
public string Ways2 { get; set; } // TODO: Int32? Float?
|
public string Ways2 { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("ways3")]
|
||||||
public string Ways3 { get; set; } // TODO: Int32? Float?
|
public string Ways3 { get; set; } // TODO: Int32? Float?
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML device
|
/// Represents one ListXML device
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("device")]
|
||||||
public class ListXmlDevice
|
public class ListXmlDevice
|
||||||
{
|
{
|
||||||
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; }
|
public string Type { get; set; }
|
||||||
public string Tag { get; set; }
|
|
||||||
public string FixedImage { get; set; }
|
|
||||||
public string Mandatory { get; set; } // TODO: bool?
|
|
||||||
public string Interface { get; set; }
|
|
||||||
public List<ListXmlInstance> Instances { get; set; }
|
|
||||||
public List<ListXmlExtension> Extensions { get; set; }
|
|
||||||
|
|
||||||
public ListXmlDevice()
|
[JsonProperty("tag")]
|
||||||
{
|
public string Tag { get; set; }
|
||||||
Instances = new List<ListXmlInstance>();
|
|
||||||
Extensions = new List<ListXmlExtension>();
|
[JsonProperty("fixed_image")]
|
||||||
}
|
public string FixedImage { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("mandatory")]
|
||||||
|
public string Mandatory { get; set; } // TODO: bool?
|
||||||
|
|
||||||
|
[JsonProperty("interface")]
|
||||||
|
public string Interface { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("instances")]
|
||||||
|
public List<ListXmlInstance> Instances { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("extensions")]
|
||||||
|
public List<ListXmlExtension> Extensions { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML deviceref
|
/// Represents one ListXML deviceref
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("deviceref")]
|
||||||
public class ListXmlDeviceReference
|
public class ListXmlDeviceReference
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML display
|
/// Represents one ListXML display
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("display")]
|
||||||
public class ListXmlDisplay
|
public class ListXmlDisplay
|
||||||
{
|
{
|
||||||
|
[JsonProperty("tag")]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; } // TODO: (raster|vector|lcd|svg|unknown)
|
public string Type { get; set; } // TODO: (raster|vector|lcd|svg|unknown)
|
||||||
|
|
||||||
|
[JsonProperty("rotate")]
|
||||||
public string Rotate { get; set; } // TODO: (0|90|180|270) Int32?
|
public string Rotate { get; set; } // TODO: (0|90|180|270) Int32?
|
||||||
|
|
||||||
|
[JsonProperty("flipx")]
|
||||||
public bool? FlipX { get; set; }
|
public bool? FlipX { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("width")]
|
||||||
public string Width { get; set; } // TODO: Int32?
|
public string Width { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("height")]
|
||||||
public string Height { get; set; } // TODO: Int32?
|
public string Height { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("refresh")]
|
||||||
public string Refresh { get; set; } // TODO: Int32? Float?
|
public string Refresh { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("pixclock")]
|
||||||
public string PixClock { get; set; } // TODO: Int32? Float?
|
public string PixClock { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("htotal")]
|
||||||
public string HTotal { get; set; } // TODO: Int32? Float?
|
public string HTotal { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("hbend")]
|
||||||
public string HBend { get; set; } // TODO: Int32? Float?
|
public string HBend { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("hstart")]
|
||||||
public string HStart { get; set; } // TODO: Int32? Float?
|
public string HStart { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("vtotal")]
|
||||||
public string VTotal { get; set; } // TODO: Int32? Float?
|
public string VTotal { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("vbend")]
|
||||||
public string VBend { get; set; } // TODO: Int32? Float?
|
public string VBend { get; set; } // TODO: Int32? Float?
|
||||||
|
|
||||||
|
[JsonProperty("vstart")]
|
||||||
public string VStart { get; set; } // TODO: Int32? Float?
|
public string VStart { get; set; } // TODO: Int32? Float?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -164,28 +263,38 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// Represents one ListXML dipswitch
|
/// Represents one ListXML dipswitch
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Also used by SoftwareList</remarks>
|
/// <remarks>Also used by SoftwareList</remarks>
|
||||||
|
[JsonObject("dipswitch")]
|
||||||
public class ListXmlDipSwitch
|
public class ListXmlDipSwitch
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Tag { get; set; }
|
|
||||||
public string Mask { get; set; }
|
|
||||||
public List<ListXmlDipLocation> Locations { get; set; }
|
|
||||||
public List<ListXmlDipValue> Values { get; set; }
|
|
||||||
|
|
||||||
public ListXmlDipSwitch()
|
[JsonProperty("tag")]
|
||||||
{
|
public string Tag { get; set; }
|
||||||
Locations = new List<ListXmlDipLocation>();
|
|
||||||
Values = new List<ListXmlDipValue>();
|
[JsonProperty("tag")]
|
||||||
}
|
public string Mask { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("locations")]
|
||||||
|
public List<ListXmlDipLocation> Locations { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("values")]
|
||||||
|
public List<ListXmlDipValue> Values { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML diplocation
|
/// Represents one ListXML diplocation
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("diplocation")]
|
||||||
public class ListXmlDipLocation
|
public class ListXmlDipLocation
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("number")]
|
||||||
public string Number { get; set; }
|
public string Number { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("inverted")]
|
||||||
public bool? Inverted { get; set; }
|
public bool? Inverted { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -193,138 +302,187 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// Represents one ListXML dipvalue
|
/// Represents one ListXML dipvalue
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <remarks>Also used by SoftwareList</remarks>
|
/// <remarks>Also used by SoftwareList</remarks>
|
||||||
|
[JsonObject("dipvalue")]
|
||||||
public class ListXmlDipValue
|
public class ListXmlDipValue
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("value")]
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("default")]
|
||||||
public bool? Default { get; set; }
|
public bool? Default { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML driver
|
/// Represents one ListXML driver
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("driver")]
|
||||||
public class ListXmlDriver
|
public class ListXmlDriver
|
||||||
{
|
{
|
||||||
|
[JsonProperty("status")]
|
||||||
public string Status { get; set; } // TODO: (good|imperfect|preliminary)
|
public string Status { get; set; } // TODO: (good|imperfect|preliminary)
|
||||||
|
|
||||||
|
[JsonProperty("emulation")]
|
||||||
public string Emulation { get; set; } // TODO: (good|imperfect|preliminary)
|
public string Emulation { get; set; } // TODO: (good|imperfect|preliminary)
|
||||||
|
|
||||||
|
[JsonProperty("cocktail")]
|
||||||
public string Cocktail { get; set; } // TODO: bool? (good|imperfect|preliminary)?
|
public string Cocktail { get; set; } // TODO: bool? (good|imperfect|preliminary)?
|
||||||
|
|
||||||
|
[JsonProperty("savestate")]
|
||||||
public string SaveState { get; set; } // TODO: (supported|unsupported)
|
public string SaveState { get; set; } // TODO: (supported|unsupported)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML extension
|
/// Represents one ListXML extension
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("extension")]
|
||||||
public class ListXmlExtension
|
public class ListXmlExtension
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML feature
|
/// Represents one ListXML feature
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("feature")]
|
||||||
public class ListXmlFeature
|
public class ListXmlFeature
|
||||||
{
|
{
|
||||||
|
[JsonProperty("type")]
|
||||||
public string Type { get; set; } // TODO: (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing)
|
public string Type { get; set; } // TODO: (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing)
|
||||||
|
|
||||||
|
[JsonProperty("status")]
|
||||||
public string Status { get; set; } // TODO: (unemulated|imperfect)
|
public string Status { get; set; } // TODO: (unemulated|imperfect)
|
||||||
|
|
||||||
|
[JsonProperty("overall")]
|
||||||
public string Overall { get; set; } // TODO: (unemulated|imperfect)
|
public string Overall { get; set; } // TODO: (unemulated|imperfect)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML info
|
/// Represents one ListXML info
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("info")]
|
||||||
public class ListXmlInfo
|
public class ListXmlInfo
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("value")]
|
||||||
public string Value { get; set; }
|
public string Value { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML input
|
/// Represents one ListXML input
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("input")]
|
||||||
public class ListXmlInput
|
public class ListXmlInput
|
||||||
{
|
{
|
||||||
|
[JsonProperty("service")]
|
||||||
public bool? Service { get; set; }
|
public bool? Service { get; set; }
|
||||||
public bool? Tilt { get; set; }
|
|
||||||
public string Players { get; set; } // TODO: Int32?
|
|
||||||
public string Coins { get; set; } // TODO: Int32?
|
|
||||||
public List<ListXmlControl> Controls { get; set; }
|
|
||||||
|
|
||||||
public ListXmlInput()
|
[JsonProperty("tilt")]
|
||||||
{
|
public bool? Tilt { get; set; }
|
||||||
Controls = new List<ListXmlControl>();
|
|
||||||
}
|
[JsonProperty("players")]
|
||||||
|
public string Players { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("coins")]
|
||||||
|
public string Coins { get; set; } // TODO: Int32?
|
||||||
|
|
||||||
|
[JsonProperty("controls")]
|
||||||
|
public List<ListXmlControl> Controls { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML instance
|
/// Represents one ListXML instance
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("instance")]
|
||||||
public class ListXmlInstance
|
public class ListXmlInstance
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("briefname")]
|
||||||
public string BriefName { get; set; }
|
public string BriefName { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML port
|
/// Represents one ListXML port
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("port")]
|
||||||
public class ListXmlPort
|
public class ListXmlPort
|
||||||
{
|
{
|
||||||
|
[JsonProperty("tag")]
|
||||||
public string Tag { get; set; }
|
public string Tag { get; set; }
|
||||||
public List<ListXmlAnalog> Analogs { get; set; }
|
|
||||||
|
|
||||||
public ListXmlPort()
|
[JsonProperty("analogs")]
|
||||||
{
|
public List<ListXmlAnalog> Analogs { get; set; }
|
||||||
Analogs = new List<ListXmlAnalog>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML ramoption
|
/// Represents one ListXML ramoption
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("ramoption")]
|
||||||
public class ListXmlRamOption
|
public class ListXmlRamOption
|
||||||
{
|
{
|
||||||
|
[JsonProperty("default")]
|
||||||
public bool? Default { get; set; }
|
public bool? Default { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML slot
|
/// Represents one ListXML slot
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("slot")]
|
||||||
public class ListXmlSlot
|
public class ListXmlSlot
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public List<ListXmlSlotOption> SlotOptions { get; set; }
|
|
||||||
|
|
||||||
public ListXmlSlot()
|
[JsonProperty("slotoptions")]
|
||||||
{
|
public List<ListXmlSlotOption> SlotOptions { get; set; }
|
||||||
SlotOptions = new List<ListXmlSlotOption>();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML slotoption
|
/// Represents one ListXML slotoption
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("slotoption")]
|
||||||
public class ListXmlSlotOption
|
public class ListXmlSlotOption
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("devname")]
|
||||||
public string DeviceName { get; set; }
|
public string DeviceName { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("default")]
|
||||||
public bool? Default { get; set; }
|
public bool? Default { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML softwarelist
|
/// Represents one ListXML softwarelist
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("softwarelist")]
|
||||||
public class ListXmlSoftwareList
|
public class ListXmlSoftwareList
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("status")]
|
||||||
public string Status { get; set; } // TODO: (original|compatible)
|
public string Status { get; set; } // TODO: (original|compatible)
|
||||||
|
|
||||||
|
[JsonProperty("filter")]
|
||||||
public string Filter { get; set; }
|
public string Filter { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one ListXML sound
|
/// Represents one ListXML sound
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("sound")]
|
||||||
public class ListXmlSound
|
public class ListXmlSound
|
||||||
{
|
{
|
||||||
|
[JsonProperty("channels")]
|
||||||
public string Channels { get; set; } // TODO: Int32?
|
public string Channels { get; set; } // TODO: Int32?
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -335,10 +493,14 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents the OpenMSX original value
|
/// Represents the OpenMSX original value
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("original")]
|
||||||
public class OpenMSXOriginal
|
public class OpenMSXOriginal
|
||||||
{
|
{
|
||||||
public string Name { get; set; }
|
[JsonProperty("value")]
|
||||||
public bool? Value { get; set; }
|
public bool? Value { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("content")]
|
||||||
|
public string Content { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -348,16 +510,14 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one SoftwareList shared feature object
|
/// Represents one SoftwareList shared feature object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("sharedfeat")]
|
||||||
public class SoftwareListSharedFeature
|
public class SoftwareListSharedFeature
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Value { get; set; }
|
|
||||||
|
|
||||||
public SoftwareListSharedFeature(string name, string value)
|
[JsonProperty("value")]
|
||||||
{
|
public string Value { get; set; }
|
||||||
Name = name;
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -371,16 +531,14 @@ namespace SabreTools.Library.DatItems
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one SoftwareList feature object
|
/// Represents one SoftwareList feature object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
[JsonObject("feature")]
|
||||||
public class SoftwareListFeature
|
public class SoftwareListFeature
|
||||||
{
|
{
|
||||||
|
[JsonProperty("name")]
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Value { get; set; }
|
|
||||||
|
|
||||||
public SoftwareListFeature(string name, string value)
|
[JsonProperty("value")]
|
||||||
{
|
public string Value { get; set; }
|
||||||
Name = name;
|
|
||||||
Value = value;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -276,8 +276,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
// ListXML
|
// ListXML
|
||||||
Field.SourceFile,
|
Field.SourceFile,
|
||||||
Field.Runnable,
|
Field.Runnable,
|
||||||
Field.Devices,
|
Field.DeviceReferences,
|
||||||
Field.SlotOptions,
|
Field.Slots,
|
||||||
Field.Infos,
|
Field.Infos,
|
||||||
|
|
||||||
// Logiqx
|
// Logiqx
|
||||||
@@ -352,7 +352,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
#region OpenMSX
|
#region OpenMSX
|
||||||
|
|
||||||
case Field.Original:
|
case Field.Original:
|
||||||
fieldValue = Original.Name;
|
fieldValue = Original.Content;
|
||||||
break;
|
break;
|
||||||
case Field.OpenMSXSubType:
|
case Field.OpenMSXSubType:
|
||||||
fieldValue = OpenMSXSubType.ToString();
|
fieldValue = OpenMSXSubType.ToString();
|
||||||
@@ -442,7 +442,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
#region OpenMSX
|
#region OpenMSX
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.Original))
|
if (mappings.Keys.Contains(Field.Original))
|
||||||
Original = new OpenMSXOriginal() { Name = mappings[Field.Original] };
|
Original = new OpenMSXOriginal() { Content = mappings[Field.Original] };
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.OpenMSXSubType))
|
if (mappings.Keys.Contains(Field.OpenMSXSubType))
|
||||||
OpenMSXSubType = mappings[Field.OpenMSXSubType].AsOpenMSXSubType();
|
OpenMSXSubType = mappings[Field.OpenMSXSubType].AsOpenMSXSubType();
|
||||||
@@ -475,7 +475,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
foreach (string pair in pairs)
|
foreach (string pair in pairs)
|
||||||
{
|
{
|
||||||
string[] split = pair.Split('=');
|
string[] split = pair.Split('=');
|
||||||
Features.Add(new SoftwareListFeature(split[0], split[1]));
|
|
||||||
|
var feature = new SoftwareListFeature();
|
||||||
|
feature.Name = split[0];
|
||||||
|
feature.Value = split[1];
|
||||||
|
|
||||||
|
Features.Add(feature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -725,9 +730,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
#region OpenMSX
|
#region OpenMSX
|
||||||
|
|
||||||
// Filter on original
|
// Filter on original
|
||||||
if (filter.Original.MatchesPositiveSet(Original.Name) == false)
|
if (filter.Original.MatchesPositiveSet(Original.Content) == false)
|
||||||
return false;
|
return false;
|
||||||
if (filter.Original.MatchesNegativeSet(Original.Name) == true)
|
if (filter.Original.MatchesNegativeSet(Original.Content) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
// Filter on OpenMSX subtype
|
// Filter on OpenMSX subtype
|
||||||
|
|||||||
@@ -60,8 +60,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
SourceFile,
|
SourceFile,
|
||||||
Runnable,
|
Runnable,
|
||||||
Devices,
|
DeviceReferences, // TODO: Double-check DeviceReferences usage
|
||||||
SlotOptions,
|
Chips, // TODO: Implement Chips usage
|
||||||
|
Displays, // TODO: Implement Displays usage
|
||||||
|
Sounds, // TODO: Implement Sounds usage
|
||||||
|
Conditions, // TODO: Implement Conditions usage
|
||||||
|
Slots, // TODO: Fix Slots usage
|
||||||
Infos,
|
Infos,
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -155,12 +155,55 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonProperty("devices")]
|
[JsonProperty("devices")]
|
||||||
public List<ListXmlDeviceReference> DeviceReferences { get; set; } = null;
|
public List<ListXmlDeviceReference> DeviceReferences { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated chips
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("chips")]
|
||||||
|
public List<ListXmlChip> Chips { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated displays
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("displays")]
|
||||||
|
public List<ListXmlDisplay> Displays { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated sounds
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("sounds")]
|
||||||
|
public List<ListXmlSound> Sounds { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated conditions
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("conditions")]
|
||||||
|
public List<ListXmlCondition> Conditions { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated inputs
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("inputs")]
|
||||||
|
public List<ListXmlInput> Inputs { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated dipswitches
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>Also in SoftwareList</remarks>
|
||||||
|
/// TODO: Order ListXML and SoftwareList outputs by area names
|
||||||
|
[JsonProperty("dipswitches")]
|
||||||
|
public List<ListXmlDipSwitch> DipSwitches { get; set; } = null;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// List of associated configurations
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("configurations")]
|
||||||
|
public List<ListXmlConfiguration> Configurations { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of slot options
|
/// List of slot options
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// TODO: Use ListXmlSlot for this...
|
[JsonProperty("slots")]
|
||||||
[JsonProperty("slotoptions")]
|
public List<ListXmlSlot> Slots { get; set; } = null;
|
||||||
public List<string> SlotOptions { get; set; } = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of info items
|
/// List of info items
|
||||||
@@ -281,15 +324,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonProperty("sharedfeat")]
|
[JsonProperty("sharedfeat")]
|
||||||
public List<SoftwareListSharedFeature> SharedFeatures { get; set; } = null;
|
public List<SoftwareListSharedFeature> SharedFeatures { get; set; } = null;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of shared feature items
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>Also in SoftwareList</remarks>
|
|
||||||
/// TODO: Move to ListXML section
|
|
||||||
/// TODO: Order ListXML and SoftwareList outputs by area names
|
|
||||||
[JsonProperty("dipswitches")]
|
|
||||||
public List<ListXmlDipSwitch> DipSwitches { get; set; } = null;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -380,11 +414,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
case Field.Runnable:
|
case Field.Runnable:
|
||||||
fieldValue = Runnable.ToString();
|
fieldValue = Runnable.ToString();
|
||||||
break;
|
break;
|
||||||
case Field.Devices:
|
case Field.DeviceReferences:
|
||||||
fieldValue = string.Join(";", DeviceReferences ?? new List<ListXmlDeviceReference>());
|
fieldValue = string.Join(";", DeviceReferences ?? new List<ListXmlDeviceReference>());
|
||||||
break;
|
break;
|
||||||
case Field.SlotOptions:
|
case Field.Slots:
|
||||||
fieldValue = string.Join(";", SlotOptions ?? new List<string>());
|
fieldValue = string.Join(";", Slots ?? new List<ListXmlSlot>());
|
||||||
break;
|
break;
|
||||||
case Field.Infos:
|
case Field.Infos:
|
||||||
fieldValue = string.Join(";", (Infos ?? new List<ListXmlInfo>()).Select(i => $"{i.Name}={i.Value}"));
|
fieldValue = string.Join(";", (Infos ?? new List<ListXmlInfo>()).Select(i => $"{i.Name}={i.Value}"));
|
||||||
@@ -551,23 +585,16 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (mappings.Keys.Contains(Field.Runnable))
|
if (mappings.Keys.Contains(Field.Runnable))
|
||||||
Runnable = mappings[Field.Runnable].AsRunnable();
|
Runnable = mappings[Field.Runnable].AsRunnable();
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.Devices))
|
if (mappings.Keys.Contains(Field.DeviceReferences))
|
||||||
{
|
{
|
||||||
if (DeviceReferences == null)
|
if (DeviceReferences == null)
|
||||||
DeviceReferences = new List<ListXmlDeviceReference>();
|
DeviceReferences = new List<ListXmlDeviceReference>();
|
||||||
|
|
||||||
var devices = mappings[Field.Devices].Split(';').Select(d => new ListXmlDeviceReference() { Name = d, });
|
var devices = mappings[Field.DeviceReferences].Split(';').Select(d => new ListXmlDeviceReference() { Name = d, });
|
||||||
DeviceReferences.AddRange(devices);
|
DeviceReferences.AddRange(devices);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.SlotOptions))
|
// TODO: Add Field.Slot
|
||||||
{
|
|
||||||
if (SlotOptions == null)
|
|
||||||
SlotOptions = new List<string>();
|
|
||||||
|
|
||||||
string[] slotOptions = mappings[Field.SlotOptions].Split(';');
|
|
||||||
SlotOptions.AddRange(slotOptions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mappings.Keys.Contains(Field.Infos))
|
if (mappings.Keys.Contains(Field.Infos))
|
||||||
{
|
{
|
||||||
@@ -657,7 +684,12 @@ namespace SabreTools.Library.DatItems
|
|||||||
foreach (string pair in pairs)
|
foreach (string pair in pairs)
|
||||||
{
|
{
|
||||||
string[] split = pair.Split('=');
|
string[] split = pair.Split('=');
|
||||||
SharedFeatures.Add(new SoftwareListSharedFeature(split[0], split[1]));
|
|
||||||
|
var sharedFeature = new SoftwareListSharedFeature();
|
||||||
|
sharedFeature.Name = split[0];
|
||||||
|
sharedFeature.Value = split[1];
|
||||||
|
|
||||||
|
SharedFeatures.Add(sharedFeature);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -738,7 +770,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
SourceFile = this.SourceFile,
|
SourceFile = this.SourceFile,
|
||||||
Runnable = this.Runnable,
|
Runnable = this.Runnable,
|
||||||
DeviceReferences = this.DeviceReferences,
|
DeviceReferences = this.DeviceReferences,
|
||||||
SlotOptions = this.SlotOptions,
|
Slots = this.Slots,
|
||||||
Infos = this.Infos,
|
Infos = this.Infos,
|
||||||
MachineType = this.MachineType,
|
MachineType = this.MachineType,
|
||||||
|
|
||||||
@@ -946,20 +978,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Filter on slot options
|
// TODO: Add Slot filter
|
||||||
if (SlotOptions != null && SlotOptions.Any())
|
|
||||||
{
|
|
||||||
bool anyPositiveSlotOption = false;
|
|
||||||
bool anyNegativeSlotOption = false;
|
|
||||||
foreach (string slotOption in SlotOptions)
|
|
||||||
{
|
|
||||||
anyPositiveSlotOption |= filter.SlotOptions.MatchesPositiveSet(slotOption) != false;
|
|
||||||
anyNegativeSlotOption |= filter.SlotOptions.MatchesNegativeSet(slotOption) == false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositiveSlotOption || anyNegativeSlotOption)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter on machine type
|
// Filter on machine type
|
||||||
if (filter.MachineTypes.MatchesPositive(MachineType.NULL, MachineType) == false)
|
if (filter.MachineTypes.MatchesPositive(MachineType.NULL, MachineType) == false)
|
||||||
@@ -1152,11 +1171,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (fields.Contains(Field.Runnable))
|
if (fields.Contains(Field.Runnable))
|
||||||
Runnable = Runnable.NULL;
|
Runnable = Runnable.NULL;
|
||||||
|
|
||||||
if (fields.Contains(Field.Devices))
|
if (fields.Contains(Field.DeviceReferences))
|
||||||
DeviceReferences = null;
|
DeviceReferences = null;
|
||||||
|
|
||||||
if (fields.Contains(Field.SlotOptions))
|
if (fields.Contains(Field.Slots))
|
||||||
SlotOptions = null;
|
Slots = null;
|
||||||
|
|
||||||
if (fields.Contains(Field.Infos))
|
if (fields.Contains(Field.Infos))
|
||||||
Infos = null;
|
Infos = null;
|
||||||
@@ -1316,11 +1335,11 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (fields.Contains(Field.Runnable))
|
if (fields.Contains(Field.Runnable))
|
||||||
Runnable = machine.Runnable;
|
Runnable = machine.Runnable;
|
||||||
|
|
||||||
if (fields.Contains(Field.Devices))
|
if (fields.Contains(Field.DeviceReferences))
|
||||||
DeviceReferences = machine.DeviceReferences;
|
DeviceReferences = machine.DeviceReferences;
|
||||||
|
|
||||||
if (fields.Contains(Field.SlotOptions))
|
if (fields.Contains(Field.Slots))
|
||||||
SlotOptions = machine.SlotOptions;
|
Slots = machine.Slots;
|
||||||
|
|
||||||
if (fields.Contains(Field.Infos))
|
if (fields.Contains(Field.Infos))
|
||||||
Infos = machine.Infos;
|
Infos = machine.Infos;
|
||||||
|
|||||||
@@ -709,14 +709,14 @@ namespace SabreTools.Library.Filtering
|
|||||||
Runnables.Positive |= value.AsRunnable();
|
Runnables.Positive |= value.AsRunnable();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.Devices:
|
case Field.DeviceReferences:
|
||||||
if (negate)
|
if (negate)
|
||||||
Devices.NegativeSet.Add(value);
|
Devices.NegativeSet.Add(value);
|
||||||
else
|
else
|
||||||
Devices.PositiveSet.Add(value);
|
Devices.PositiveSet.Add(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Field.SlotOptions:
|
case Field.Slots:
|
||||||
if (negate)
|
if (negate)
|
||||||
SlotOptions.NegativeSet.Add(value);
|
SlotOptions.NegativeSet.Add(value);
|
||||||
else
|
else
|
||||||
|
|||||||
23
SabreTools.Library/IO/XmlTextWriterExtensions.cs
Normal file
23
SabreTools.Library/IO/XmlTextWriterExtensions.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using System.Xml;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.IO
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Additional methods for XmlTextWriter
|
||||||
|
/// </summary>
|
||||||
|
public static class XmlTextWriterExtensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Force writing separate open and start tags, even for empty elements
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="xmlTextWriter">XmlTextWriter to write out with</param>
|
||||||
|
/// <param name="localName">Name of the element</param>
|
||||||
|
/// <param name="value">Value to write in the element</param>
|
||||||
|
public static void WriteFullElementString(this XmlTextWriter xmlTextWriter, string localName, string value)
|
||||||
|
{
|
||||||
|
xmlTextWriter.WriteStartElement(localName);
|
||||||
|
xmlTextWriter.WriteRaw(value);
|
||||||
|
xmlTextWriter.WriteFullEndElement();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -232,12 +232,12 @@ namespace SabreTools.Library.Tools
|
|||||||
return Field.Runnable;
|
return Field.Runnable;
|
||||||
|
|
||||||
case "devices":
|
case "devices":
|
||||||
return Field.Devices;
|
return Field.DeviceReferences;
|
||||||
|
|
||||||
case "slotoptions":
|
case "slotoptions":
|
||||||
case "slot options":
|
case "slot options":
|
||||||
case "slot-options":
|
case "slot-options":
|
||||||
return Field.SlotOptions;
|
return Field.Slots;
|
||||||
|
|
||||||
case "infos":
|
case "infos":
|
||||||
return Field.Infos;
|
return Field.Infos;
|
||||||
|
|||||||
Reference in New Issue
Block a user