mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Slot to DatItem
This commit is contained in:
@@ -26,7 +26,7 @@ Unpacked files will be stored as individual entries. Prior to unpacking a zip
|
||||
file, the external SHA1 is checked against the DAT index.
|
||||
If -only-needed is set, only those files are put in the ROM archive that
|
||||
have a current entry in the DAT index.";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
Features = new Dictionary<string, SabreTools.Library.Help.Feature>();
|
||||
|
||||
AddFeature(OnlyNeededFlag);
|
||||
AddFeature(ResumeStringInput);
|
||||
@@ -39,7 +39,7 @@ have a current entry in the DAT index.";
|
||||
AddFeature(NoDbFlag);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Library.Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
|
||||
|
||||
@@ -19,11 +19,11 @@ namespace RombaSharp.Features
|
||||
#region Private Flag features
|
||||
|
||||
internal const string CopyValue = "copy";
|
||||
internal static Feature CopyFlag
|
||||
internal static SabreTools.Library.Help.Feature CopyFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
CopyValue,
|
||||
"-copy",
|
||||
"Copy files to output instead of rebuilding",
|
||||
@@ -32,11 +32,11 @@ namespace RombaSharp.Features
|
||||
} // Unique to RombaSharp
|
||||
|
||||
internal const string FixdatOnlyValue = "fixdat-only";
|
||||
internal static Feature FixdatOnlyFlag
|
||||
internal static SabreTools.Library.Help.Feature FixdatOnlyFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
FixdatOnlyValue,
|
||||
"-fixdatOnly",
|
||||
"only fix dats and don't generate torrentzips",
|
||||
@@ -45,11 +45,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string LogOnlyValue = "log-only";
|
||||
internal static Feature LogOnlyFlag
|
||||
internal static SabreTools.Library.Help.Feature LogOnlyFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
LogOnlyValue,
|
||||
"-log-only",
|
||||
"Only write out actions to log",
|
||||
@@ -58,11 +58,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string NoDbValue = "no-db";
|
||||
internal static Feature NoDbFlag
|
||||
internal static SabreTools.Library.Help.Feature NoDbFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
NoDbValue,
|
||||
"-no-db",
|
||||
"archive into depot but do not touch DB index and ignore only-needed flag",
|
||||
@@ -71,11 +71,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string OnlyNeededValue = "only-needed";
|
||||
internal static Feature OnlyNeededFlag
|
||||
internal static SabreTools.Library.Help.Feature OnlyNeededFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
OnlyNeededValue,
|
||||
"-only-needed",
|
||||
"only archive ROM files actually referenced by DAT files from the DAT index",
|
||||
@@ -84,11 +84,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string SkipInitialScanValue = "skip-initial-scan";
|
||||
internal static Feature SkipInitialScanFlag
|
||||
internal static SabreTools.Library.Help.Feature SkipInitialScanFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
SkipInitialScanValue,
|
||||
"-skip-initial-scan",
|
||||
"skip the initial scan of the files to determine amount of work",
|
||||
@@ -97,11 +97,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string UseGolangZipValue = "use-golang-zip";
|
||||
internal static Feature UseGolangZipFlag
|
||||
internal static SabreTools.Library.Help.Feature UseGolangZipFlag
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
UseGolangZipValue,
|
||||
"-use-golang-zip",
|
||||
"use go zip implementation instead of zlib",
|
||||
@@ -114,11 +114,11 @@ namespace RombaSharp.Features
|
||||
#region Private Int32 features
|
||||
|
||||
internal const string Include7ZipsInt32Value = "include-7zips";
|
||||
internal static Feature Include7ZipsInt32Input
|
||||
internal static SabreTools.Library.Help.Feature Include7ZipsInt32Input
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
Include7ZipsInt32Value,
|
||||
"-include-7zips",
|
||||
"flag value == 0 means: add 7zip files themselves into the depot in addition to their contents, flag value == 2 means add 7zip files themselves but don't add content",
|
||||
@@ -127,11 +127,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string IncludeGZipsInt32Value = "include-gzips";
|
||||
internal static Feature IncludeGZipsInt32Input
|
||||
internal static SabreTools.Library.Help.Feature IncludeGZipsInt32Input
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
IncludeGZipsInt32Value,
|
||||
"-include-gzips",
|
||||
"flag value == 0 means: add gzip files themselves into the depot in addition to their contents, flag value == 2 means add gzip files themselves but don't add content",
|
||||
@@ -140,11 +140,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string IncludeZipsInt32Value = "include-zips";
|
||||
internal static Feature IncludeZipsInt32Input
|
||||
internal static SabreTools.Library.Help.Feature IncludeZipsInt32Input
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
IncludeZipsInt32Value,
|
||||
"-include-zips",
|
||||
"flag value == 0 means: add zip files themselves into the depot in addition to their contents, flag value == 2 means add zip files themselves but don't add content",
|
||||
@@ -153,11 +153,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string SubworkersInt32Value = "subworkers";
|
||||
internal static Feature SubworkersInt32Input
|
||||
internal static SabreTools.Library.Help.Feature SubworkersInt32Input
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
SubworkersInt32Value,
|
||||
"-subworkers",
|
||||
"how many subworkers to launch for each worker",
|
||||
@@ -166,11 +166,11 @@ namespace RombaSharp.Features
|
||||
} // Defaults to Workers count in config
|
||||
|
||||
internal const string WorkersInt32Value = "workers";
|
||||
internal static Feature WorkersInt32Input
|
||||
internal static SabreTools.Library.Help.Feature WorkersInt32Input
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
WorkersInt32Value,
|
||||
"-workers",
|
||||
"how many workers to launch for the job",
|
||||
@@ -183,11 +183,11 @@ namespace RombaSharp.Features
|
||||
#region Private Int64 features
|
||||
|
||||
internal const string SizeInt64Value = "size";
|
||||
internal static Feature SizeInt64Input
|
||||
internal static SabreTools.Library.Help.Feature SizeInt64Input
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
SizeInt64Value,
|
||||
"-size",
|
||||
"size of the rom to lookup",
|
||||
@@ -200,11 +200,11 @@ namespace RombaSharp.Features
|
||||
#region Private List<String> features
|
||||
|
||||
internal const string DatsListStringValue = "dats";
|
||||
internal static Feature DatsListStringInput
|
||||
internal static SabreTools.Library.Help.Feature DatsListStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
DatsListStringValue,
|
||||
"-dats",
|
||||
"purge only roms declared in these dats",
|
||||
@@ -213,11 +213,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string DepotListStringValue = "depot";
|
||||
internal static Feature DepotListStringInput
|
||||
internal static SabreTools.Library.Help.Feature DepotListStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
DepotListStringValue,
|
||||
"-depot",
|
||||
"work only on specified depot path",
|
||||
@@ -230,11 +230,11 @@ namespace RombaSharp.Features
|
||||
#region Private String features
|
||||
|
||||
internal const string BackupStringValue = "backup";
|
||||
internal static Feature BackupStringInput
|
||||
internal static SabreTools.Library.Help.Feature BackupStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
BackupStringValue,
|
||||
"-backup",
|
||||
"backup directory where backup files are moved to",
|
||||
@@ -243,11 +243,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string DescriptionStringValue = "description";
|
||||
internal static Feature DescriptionStringInput
|
||||
internal static SabreTools.Library.Help.Feature DescriptionStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
DescriptionStringValue,
|
||||
"-description",
|
||||
"description value in DAT header",
|
||||
@@ -256,11 +256,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string MissingSha1sStringValue = "missing-sha1s";
|
||||
internal static Feature MissingSha1sStringInput
|
||||
internal static SabreTools.Library.Help.Feature MissingSha1sStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
MissingSha1sStringValue,
|
||||
"-missingSha1s",
|
||||
"write paths of dats with missing sha1s into this file",
|
||||
@@ -269,11 +269,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string NameStringValue = "name";
|
||||
internal static Feature NameStringInput
|
||||
internal static SabreTools.Library.Help.Feature NameStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
NameStringValue,
|
||||
"-name",
|
||||
"name value in DAT header",
|
||||
@@ -282,11 +282,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string NewStringValue = "new";
|
||||
internal static Feature NewStringInput
|
||||
internal static SabreTools.Library.Help.Feature NewStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
NewStringValue,
|
||||
"-new",
|
||||
"new DAT file",
|
||||
@@ -295,11 +295,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string OldStringValue = "old";
|
||||
internal static Feature OldStringInput
|
||||
internal static SabreTools.Library.Help.Feature OldStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
OldStringValue,
|
||||
"-old",
|
||||
"old DAT file",
|
||||
@@ -308,11 +308,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string OutStringValue = "out";
|
||||
internal static Feature OutStringInput
|
||||
internal static SabreTools.Library.Help.Feature OutStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
OutStringValue,
|
||||
"-out",
|
||||
"output file",
|
||||
@@ -321,11 +321,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string ResumeStringValue = "resume";
|
||||
internal static Feature ResumeStringInput
|
||||
internal static SabreTools.Library.Help.Feature ResumeStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
ResumeStringValue,
|
||||
"-resume",
|
||||
"resume a previously interrupted operation from the specified path",
|
||||
@@ -334,11 +334,11 @@ namespace RombaSharp.Features
|
||||
}
|
||||
|
||||
internal const string SourceStringValue = "source";
|
||||
internal static Feature SourceStringInput
|
||||
internal static SabreTools.Library.Help.Feature SourceStringInput
|
||||
{
|
||||
get
|
||||
{
|
||||
return new Feature(
|
||||
return new SabreTools.Library.Help.Feature(
|
||||
SourceStringValue,
|
||||
"-source",
|
||||
"source directory",
|
||||
@@ -370,7 +370,7 @@ namespace RombaSharp.Features
|
||||
internal const string _dbSchema = "rombasharp";
|
||||
internal static string _connectionString;
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Library.Help.Feature> features)
|
||||
{
|
||||
InitializeConfiguration();
|
||||
DatabaseTools.EnsureDatabase(_dbSchema, _db, _connectionString);
|
||||
|
||||
@@ -24,13 +24,13 @@ namespace RombaSharp.Features
|
||||
Detects any changes in the DAT master directory tree and updates the DAT index
|
||||
accordingly, marking deleted or overwritten dats as orphaned and updating
|
||||
contents of any changed dats.";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
Features = new Dictionary<string, SabreTools.Library.Help.Feature>();
|
||||
|
||||
AddFeature(WorkersInt32Input);
|
||||
AddFeature(MissingSha1sStringInput);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Library.Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
|
||||
|
||||
@@ -21,10 +21,10 @@ namespace RombaSharp.Features
|
||||
Description = "Rescan a specific depot to get new information";
|
||||
_featureType = FeatureType.Flag;
|
||||
LongDescription = "Rescan a specific depot to get new information";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
Features = new Dictionary<string, SabreTools.Library.Help.Feature>();
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, SabreTools.Library.Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
Globals.Logger.Error("This feature is not yet implemented: rescan-depots");
|
||||
|
||||
@@ -1441,17 +1441,18 @@ namespace SabreTools.Library.DatFiles
|
||||
if (slotoptions)
|
||||
{
|
||||
// If the game has no slot options, we continue
|
||||
if (Items[game][0].Machine.Slots == null
|
||||
|| Items[game][0].Machine.Slots
|
||||
.SelectMany(s => s.SlotOptions ?? new List<ListXmlSlotOption>()).Count() == 0)
|
||||
if (Items[game]
|
||||
.Where(i => i.ItemType == ItemType.Slot)
|
||||
.SelectMany(s => (s as Slot).SlotOptions ?? new List<SlotOption>()).Count() == 0)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Determine if the game has any slot options or not
|
||||
List<string> slotOptions = Items[game][0].Machine.Slots
|
||||
.Where(s => s.SlotOptions != null && s.SlotOptions.Count != 0)
|
||||
.SelectMany(s => s.SlotOptions)
|
||||
List<string> slotOptions = Items[game]
|
||||
.Where(i => i.ItemType == ItemType.Slot)
|
||||
.Where(s => (s as Slot).SlotOptions != null && (s as Slot).SlotOptions.Count != 0)
|
||||
.SelectMany(s => (s as Slot).SlotOptions)
|
||||
.Select(o => o.DeviceName)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
@@ -1465,18 +1466,15 @@ namespace SabreTools.Library.DatFiles
|
||||
// Otherwise, copy the items from the slot option to the current game
|
||||
DatItem copyFrom = Items[game][0];
|
||||
List<DatItem> slotOptionItems = Items[slotOption];
|
||||
newSlotOptions.AddRange((Items[slotOption] ?? new List<DatItem>())
|
||||
.Where(i => i.ItemType == ItemType.Slot)
|
||||
.Where(s => (s as Slot).SlotOptions != null && (s as Slot).SlotOptions.Count != 0)
|
||||
.SelectMany(s => (s as Slot).SlotOptions)
|
||||
.Select(o => o.DeviceName));
|
||||
|
||||
foreach (DatItem item in slotOptionItems)
|
||||
{
|
||||
DatItem datItem = (DatItem)item.Clone();
|
||||
List<string> machineSlotOptions =
|
||||
(datItem.Machine.Slots ?? new List<ListXmlSlot>())
|
||||
.Where(s => s.SlotOptions != null && s.SlotOptions.Count != 0)
|
||||
.SelectMany(s => s.SlotOptions)
|
||||
.Select(o => o.DeviceName)
|
||||
.Distinct()
|
||||
.ToList();
|
||||
|
||||
newSlotOptions.AddRange(machineSlotOptions);
|
||||
datItem.CopyMachineInformation(copyFrom);
|
||||
if (Items[game].Where(i => i.ItemType == datItem.ItemType && i.Name == datItem.Name).Count() == 0)
|
||||
{
|
||||
@@ -1493,7 +1491,7 @@ namespace SabreTools.Library.DatFiles
|
||||
foreach (string slotOption in newSlotOptions)
|
||||
{
|
||||
if (!slotOptions.Contains(slotOption))
|
||||
Items[game][0].Machine.Slots.Add(new ListXmlSlot() { SlotOptions = new List<ListXmlSlotOption> { new ListXmlSlotOption { DeviceName = slotOption } } });
|
||||
Items[game].Add(new Slot() { SlotOptions = new List<SlotOption> { new SlotOption { DeviceName = slotOption } } });
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,6 +155,12 @@ namespace SabreTools.Library.DatFiles
|
||||
[JsonIgnore]
|
||||
public long SampleCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of Slot items
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public long SlotCount { get; private set; } = 0;
|
||||
|
||||
/// <summary>
|
||||
/// Number of SoftwareList items
|
||||
/// </summary>
|
||||
@@ -558,6 +564,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Sample:
|
||||
SampleCount++;
|
||||
break;
|
||||
case ItemType.Slot:
|
||||
SlotCount++;
|
||||
break;
|
||||
case ItemType.SoftwareList:
|
||||
SoftwareListCount++;
|
||||
break;
|
||||
@@ -705,6 +714,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Sample:
|
||||
SampleCount--;
|
||||
break;
|
||||
case ItemType.Slot:
|
||||
SlotCount--;
|
||||
break;
|
||||
case ItemType.SoftwareList:
|
||||
SoftwareListCount--;
|
||||
break;
|
||||
|
||||
@@ -250,6 +250,9 @@ namespace SabreTools.Library.DatFiles
|
||||
case ItemType.Sample:
|
||||
datItem = datItemObj.ToObject<Sample>();
|
||||
break;
|
||||
case ItemType.Slot:
|
||||
datItem = datItemObj.ToObject<Slot>();
|
||||
break;
|
||||
case ItemType.SoftwareList:
|
||||
datItem = datItemObj.ToObject<DatItems.SoftwareList>();
|
||||
break;
|
||||
|
||||
@@ -171,7 +171,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Default = reader.GetAttribute("default").AsYesNo(),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Conditions = new List<Condition>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -224,9 +224,9 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
Mask = reader.GetAttribute("mask"),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Locations = new List<ListXmlConfLocation>(),
|
||||
Settings = new List<ListXmlConfSetting>(),
|
||||
Conditions = new List<Condition>(),
|
||||
Locations = new List<Location>(),
|
||||
Settings = new List<Setting>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -253,14 +253,16 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
Mask = reader.GetAttribute("mask"),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Locations = new List<ListXmlDipLocation>(),
|
||||
Values = new List<ListXmlDipValue>(),
|
||||
Conditions = new List<Condition>(),
|
||||
Locations = new List<Location>(),
|
||||
Values = new List<Setting>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
ReadDipSwitch(reader.ReadSubtree(), dipSwitch);
|
||||
|
||||
datItems.Add(dipSwitch);
|
||||
|
||||
// Skip the dipswitch now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
@@ -336,6 +338,22 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Read();
|
||||
break;
|
||||
|
||||
case "slot":
|
||||
var slot = new Slot
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
SlotOptions = new List<SlotOption>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
ReadSlot(reader.ReadSubtree(), slot);
|
||||
|
||||
datItems.Add(slot);
|
||||
|
||||
// Skip the slot now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "softwarelist":
|
||||
datItems.Add(new DatItems.SoftwareList
|
||||
{
|
||||
@@ -355,7 +373,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "display":
|
||||
var display = new ListXmlDisplay();
|
||||
var display = new Display();
|
||||
display.Tag = reader.GetAttribute("tag");
|
||||
display.Type = reader.GetAttribute("type");
|
||||
display.Rotate = reader.GetAttribute("rotate");
|
||||
@@ -373,7 +391,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Displays == null)
|
||||
machine.Displays = new List<ListXmlDisplay>();
|
||||
machine.Displays = new List<Display>();
|
||||
|
||||
machine.Displays.Add(display);
|
||||
|
||||
@@ -381,12 +399,12 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "sound":
|
||||
var sound = new ListXmlSound();
|
||||
var sound = new Sound();
|
||||
sound.Channels = reader.GetAttribute("channels");
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Sounds == null)
|
||||
machine.Sounds = new List<ListXmlSound>();
|
||||
machine.Sounds = new List<Sound>();
|
||||
|
||||
machine.Sounds.Add(sound);
|
||||
|
||||
@@ -394,7 +412,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -402,7 +420,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Conditions == null)
|
||||
machine.Conditions = new List<ListXmlCondition>();
|
||||
machine.Conditions = new List<Condition>();
|
||||
|
||||
machine.Conditions.Add(condition);
|
||||
|
||||
@@ -410,7 +428,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "input":
|
||||
var input = new ListXmlInput();
|
||||
var input = new Input();
|
||||
input.Service = reader.GetAttribute("service").AsYesNo();
|
||||
input.Tilt = reader.GetAttribute("tilt").AsYesNo();
|
||||
input.Players = reader.GetAttribute("players");
|
||||
@@ -421,7 +439,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Inputs == null)
|
||||
machine.Inputs = new List<ListXmlInput>();
|
||||
machine.Inputs = new List<Input>();
|
||||
|
||||
machine.Inputs.Add(input);
|
||||
|
||||
@@ -430,7 +448,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "port":
|
||||
var port = new ListXmlPort();
|
||||
var port = new Port();
|
||||
port.Tag = reader.GetAttribute("tag");
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -438,7 +456,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Ports == null)
|
||||
machine.Ports = new List<ListXmlPort>();
|
||||
machine.Ports = new List<Port>();
|
||||
|
||||
machine.Ports.Add(port);
|
||||
|
||||
@@ -447,7 +465,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "driver":
|
||||
var driver = new ListXmlDriver();
|
||||
var driver = new Driver();
|
||||
driver.Status = reader.GetAttribute("status");
|
||||
driver.Emulation = reader.GetAttribute("emulation");
|
||||
driver.Cocktail = reader.GetAttribute("cocktail");
|
||||
@@ -455,7 +473,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Drivers == null)
|
||||
machine.Drivers = new List<ListXmlDriver>();
|
||||
machine.Drivers = new List<Driver>();
|
||||
|
||||
machine.Drivers.Add(driver);
|
||||
|
||||
@@ -463,14 +481,14 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "feature":
|
||||
var feature = new ListXmlFeature();
|
||||
var feature = new Feature();
|
||||
feature.Type = reader.GetAttribute("type");
|
||||
feature.Status = reader.GetAttribute("status");
|
||||
feature.Overall = reader.GetAttribute("overall");
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Features == null)
|
||||
machine.Features = new List<ListXmlFeature>();
|
||||
machine.Features = new List<Feature>();
|
||||
|
||||
machine.Features.Add(feature);
|
||||
|
||||
@@ -478,7 +496,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "device":
|
||||
var device = new ListXmlDevice();
|
||||
var device = new Device();
|
||||
device.Type = reader.GetAttribute("type");
|
||||
device.Tag = reader.GetAttribute("tag");
|
||||
device.FixedImage = reader.GetAttribute("fixed_image");
|
||||
@@ -490,7 +508,7 @@ namespace SabreTools.Library.DatFiles
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Devices == null)
|
||||
machine.Devices = new List<ListXmlDevice>();
|
||||
machine.Devices = new List<Device>();
|
||||
|
||||
machine.Devices.Add(device);
|
||||
|
||||
@@ -498,23 +516,6 @@ namespace SabreTools.Library.DatFiles
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
case "slot":
|
||||
var slot = new ListXmlSlot();
|
||||
slot.Name = reader.GetAttribute("name");
|
||||
|
||||
// Now read the internal tags
|
||||
ReadSlot(reader.ReadSubtree(), slot);
|
||||
|
||||
// Ensure the list exists
|
||||
if (machine.Slots == null)
|
||||
machine.Slots = new List<ListXmlSlot>();
|
||||
|
||||
machine.Slots.Add(slot);
|
||||
|
||||
// Skip the slot now that we've processed it
|
||||
reader.Skip();
|
||||
break;
|
||||
|
||||
default:
|
||||
reader.Read();
|
||||
break;
|
||||
@@ -555,14 +556,14 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a machine block</param>
|
||||
/// <param name="slot">ListXmlSlot to populate</param>
|
||||
private void ReadSlot(XmlReader reader, ListXmlSlot slot)
|
||||
private void ReadSlot(XmlReader reader, Slot slot)
|
||||
{
|
||||
// If we have an empty machine, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
slot.SlotOptions = new List<ListXmlSlotOption>();
|
||||
slot.SlotOptions = new List<SlotOption>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -580,7 +581,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "slotoption":
|
||||
var slotOption = new ListXmlSlotOption();
|
||||
var slotOption = new SlotOption();
|
||||
slotOption.Name = reader.GetAttribute("name");
|
||||
slotOption.DeviceName = reader.GetAttribute("devname");
|
||||
slotOption.Default = reader.GetAttribute("default").AsYesNo();
|
||||
@@ -602,14 +603,14 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="input">ListXmlInput to populate</param>
|
||||
private void ReadInput(XmlReader reader, ListXmlInput input)
|
||||
private void ReadInput(XmlReader reader, Input input)
|
||||
{
|
||||
// If we have an empty input, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
input.Controls = new List<ListXmlControl>();
|
||||
input.Controls = new List<Control>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -627,7 +628,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "control":
|
||||
var control = new ListXmlControl();
|
||||
var control = new Control();
|
||||
control.Type = reader.GetAttribute("type");
|
||||
control.Player = reader.GetAttribute("player");
|
||||
control.Buttons = reader.GetAttribute("buttons");
|
||||
@@ -665,9 +666,9 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
dipSwitch.Conditions = new List<ListXmlCondition>();
|
||||
dipSwitch.Locations = new List<ListXmlDipLocation>();
|
||||
dipSwitch.Values = new List<ListXmlDipValue>();
|
||||
dipSwitch.Conditions = new List<Condition>();
|
||||
dipSwitch.Locations = new List<Location>();
|
||||
dipSwitch.Values = new List<Setting>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -685,7 +686,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -697,7 +698,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "diplocation":
|
||||
var dipLocation = new ListXmlDipLocation();
|
||||
var dipLocation = new Location();
|
||||
dipLocation.Name = reader.GetAttribute("name");
|
||||
dipLocation.Number = reader.GetAttribute("number");
|
||||
dipLocation.Inverted = reader.GetAttribute("inverted").AsYesNo();
|
||||
@@ -708,7 +709,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "dipvalue":
|
||||
var dipValue = new ListXmlDipValue();
|
||||
var dipValue = new Setting();
|
||||
dipValue.Name = reader.GetAttribute("name");
|
||||
dipValue.Value = reader.GetAttribute("value");
|
||||
dipValue.Default = reader.GetAttribute("default").AsYesNo();
|
||||
@@ -733,15 +734,15 @@ namespace SabreTools.Library.DatFiles
|
||||
/// Read DipValue information
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="dipValue">ListXmlDipValue to populate</param>
|
||||
private void ReadDipValue(XmlReader reader, ListXmlDipValue dipValue)
|
||||
/// <param name="dipValue">Setting to populate</param>
|
||||
private void ReadDipValue(XmlReader reader, Setting dipValue)
|
||||
{
|
||||
// If we have an empty dipvalue, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
dipValue.Conditions = new List<ListXmlCondition>();
|
||||
dipValue.Conditions = new List<Condition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -759,7 +760,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -789,9 +790,9 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
configuration.Conditions = new List<ListXmlCondition>();
|
||||
configuration.Locations = new List<ListXmlConfLocation>();
|
||||
configuration.Settings = new List<ListXmlConfSetting>();
|
||||
configuration.Conditions = new List<Condition>();
|
||||
configuration.Locations = new List<Location>();
|
||||
configuration.Settings = new List<Setting>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -809,7 +810,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -821,7 +822,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "conflocation":
|
||||
var confLocation = new ListXmlConfLocation();
|
||||
var confLocation = new Location();
|
||||
confLocation.Name = reader.GetAttribute("name");
|
||||
confLocation.Number = reader.GetAttribute("number");
|
||||
confLocation.Inverted = reader.GetAttribute("inverted").AsYesNo();
|
||||
@@ -832,7 +833,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "confsetting":
|
||||
var confSetting = new ListXmlConfSetting();
|
||||
var confSetting = new Setting();
|
||||
confSetting.Name = reader.GetAttribute("name");
|
||||
confSetting.Value = reader.GetAttribute("value");
|
||||
confSetting.Default = reader.GetAttribute("default").AsYesNo();
|
||||
@@ -857,15 +858,15 @@ namespace SabreTools.Library.DatFiles
|
||||
/// Read ConfSetting information
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="confSetting">ListXmlConfSetting to populate</param>
|
||||
private void ReadConfSetting(XmlReader reader, ListXmlConfSetting confSetting)
|
||||
/// <param name="confSetting">Setting to populate</param>
|
||||
private void ReadConfSetting(XmlReader reader, Setting confSetting)
|
||||
{
|
||||
// If we have an empty confsetting, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
confSetting.Conditions = new List<ListXmlCondition>();
|
||||
confSetting.Conditions = new List<Condition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -883,7 +884,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -906,14 +907,14 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="port">ListXmlPort to populate</param>
|
||||
private void ReadPort(XmlReader reader, ListXmlPort port)
|
||||
private void ReadPort(XmlReader reader, Port port)
|
||||
{
|
||||
// If we have an empty port, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
port.Analogs = new List<ListXmlAnalog>();
|
||||
port.Analogs = new List<Analog>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -931,7 +932,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "analog":
|
||||
var analog = new ListXmlAnalog();
|
||||
var analog = new Analog();
|
||||
analog.Mask = reader.GetAttribute("mask");
|
||||
|
||||
port.Analogs.Add(analog);
|
||||
@@ -958,7 +959,7 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
adjuster.Conditions = new List<ListXmlCondition>();
|
||||
adjuster.Conditions = new List<Condition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -976,7 +977,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -999,15 +1000,15 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="device">ListXmlDevice to populate</param>
|
||||
private void ReadDevice(XmlReader reader, ListXmlDevice device)
|
||||
private void ReadDevice(XmlReader reader, Device device)
|
||||
{
|
||||
// If we have an empty port, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
device.Instances = new List<ListXmlInstance>();
|
||||
device.Extensions = new List<ListXmlExtension>();
|
||||
device.Instances = new List<Instance>();
|
||||
device.Extensions = new List<Extension>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -1025,7 +1026,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "instance":
|
||||
var instance = new ListXmlInstance();
|
||||
var instance = new Instance();
|
||||
instance.Name = reader.GetAttribute("name");
|
||||
instance.BriefName = reader.GetAttribute("briefname");
|
||||
|
||||
@@ -1035,7 +1036,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "extension":
|
||||
var extension = new ListXmlExtension();
|
||||
var extension = new Extension();
|
||||
extension.Name = reader.GetAttribute("name");
|
||||
|
||||
device.Extensions.Add(extension);
|
||||
@@ -1384,33 +1385,6 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
if (datItem.Machine.Slots != null)
|
||||
{
|
||||
foreach (var slot in datItem.Machine.Slots)
|
||||
{
|
||||
xtw.WriteStartElement("slot");
|
||||
|
||||
xtw.WriteOptionalAttributeString("name", slot.Name);
|
||||
|
||||
if (slot.SlotOptions != null)
|
||||
{
|
||||
foreach (var slotOption in slot.SlotOptions)
|
||||
{
|
||||
xtw.WriteStartElement("slotoption");
|
||||
|
||||
xtw.WriteOptionalAttributeString("name", slotOption.Name);
|
||||
xtw.WriteOptionalAttributeString("devname", slotOption.DeviceName);
|
||||
xtw.WriteOptionalAttributeString("default", slotOption.Default.FromYesNo());
|
||||
|
||||
// End slotoption
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
// End slot
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
|
||||
xtw.Flush();
|
||||
}
|
||||
@@ -1651,6 +1625,24 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Slot:
|
||||
var slot = datItem as Slot;
|
||||
xtw.WriteStartElement("slot");
|
||||
xtw.WriteOptionalAttributeString("name", slot.Name);
|
||||
if (slot.SlotOptions != null)
|
||||
{
|
||||
foreach (var slotOption in slot.SlotOptions)
|
||||
{
|
||||
xtw.WriteStartElement("slotoption");
|
||||
xtw.WriteOptionalAttributeString("name", slotOption.Name);
|
||||
xtw.WriteOptionalAttributeString("devname", slotOption.DeviceName);
|
||||
xtw.WriteOptionalAttributeString("default", slotOption.Default.FromYesNo());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.SoftwareList:
|
||||
var softwareList = datItem as DatItems.SoftwareList;
|
||||
xtw.WriteStartElement("softwarelist");
|
||||
|
||||
@@ -356,7 +356,7 @@ namespace SabreTools.Library.DatFiles
|
||||
{
|
||||
Name = reader.GetAttribute("name"),
|
||||
Default = reader.GetAttribute("default").AsYesNo(),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Conditions = new List<Condition>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -416,9 +416,9 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
Mask = reader.GetAttribute("mask"),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Locations = new List<ListXmlConfLocation>(),
|
||||
Settings = new List<ListXmlConfSetting>(),
|
||||
Conditions = new List<Condition>(),
|
||||
Locations = new List<Location>(),
|
||||
Settings = new List<Setting>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -443,9 +443,9 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
Mask = reader.GetAttribute("mask"),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Locations = new List<ListXmlDipLocation>(),
|
||||
Values = new List<ListXmlDipValue>(),
|
||||
Conditions = new List<Condition>(),
|
||||
Locations = new List<Location>(),
|
||||
Values = new List<Setting>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -643,7 +643,7 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
(adjuster as Adjuster).Conditions = new List<ListXmlCondition>();
|
||||
(adjuster as Adjuster).Conditions = new List<Condition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -661,7 +661,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -695,9 +695,9 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
(configuration as Configuration).Conditions = new List<ListXmlCondition>();
|
||||
(configuration as Configuration).Locations = new List<ListXmlConfLocation>();
|
||||
(configuration as Configuration).Settings = new List<ListXmlConfSetting>();
|
||||
(configuration as Configuration).Conditions = new List<Condition>();
|
||||
(configuration as Configuration).Locations = new List<Location>();
|
||||
(configuration as Configuration).Settings = new List<Setting>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -715,7 +715,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -727,7 +727,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "conflocation":
|
||||
var confLocation = new ListXmlConfLocation();
|
||||
var confLocation = new Location();
|
||||
confLocation.Name = reader.GetAttribute("name");
|
||||
confLocation.Number = reader.GetAttribute("number");
|
||||
confLocation.Inverted = reader.GetAttribute("inverted").AsYesNo();
|
||||
@@ -738,7 +738,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "confsetting":
|
||||
var confSetting = new ListXmlConfSetting();
|
||||
var confSetting = new Setting();
|
||||
confSetting.Name = reader.GetAttribute("name");
|
||||
confSetting.Value = reader.GetAttribute("value");
|
||||
confSetting.Default = reader.GetAttribute("default").AsYesNo();
|
||||
@@ -764,14 +764,14 @@ namespace SabreTools.Library.DatFiles
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="confSetting">ListXmlConfSetting to populate</param>
|
||||
private void ReadConfSetting(XmlReader reader, ListXmlConfSetting confSetting)
|
||||
private void ReadConfSetting(XmlReader reader, Setting confSetting)
|
||||
{
|
||||
// If we have an empty confsetting, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
confSetting.Conditions = new List<ListXmlCondition>();
|
||||
confSetting.Conditions = new List<Condition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -789,7 +789,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -823,9 +823,9 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get lists ready
|
||||
(dipSwitch as DipSwitch).Conditions = new List<ListXmlCondition>();
|
||||
(dipSwitch as DipSwitch).Locations = new List<ListXmlDipLocation>();
|
||||
(dipSwitch as DipSwitch).Values = new List<ListXmlDipValue>();
|
||||
(dipSwitch as DipSwitch).Conditions = new List<Condition>();
|
||||
(dipSwitch as DipSwitch).Locations = new List<Location>();
|
||||
(dipSwitch as DipSwitch).Values = new List<Setting>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -843,7 +843,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -855,7 +855,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "diplocation":
|
||||
var dipLocation = new ListXmlDipLocation();
|
||||
var dipLocation = new Location();
|
||||
dipLocation.Name = reader.GetAttribute("name");
|
||||
dipLocation.Number = reader.GetAttribute("number");
|
||||
dipLocation.Inverted = reader.GetAttribute("inverted").AsYesNo();
|
||||
@@ -866,7 +866,7 @@ namespace SabreTools.Library.DatFiles
|
||||
break;
|
||||
|
||||
case "dipvalue":
|
||||
var dipValue = new ListXmlDipValue();
|
||||
var dipValue = new Setting();
|
||||
dipValue.Name = reader.GetAttribute("name");
|
||||
dipValue.Value = reader.GetAttribute("value");
|
||||
dipValue.Default = reader.GetAttribute("default").AsYesNo();
|
||||
@@ -891,15 +891,15 @@ namespace SabreTools.Library.DatFiles
|
||||
/// Read DipValue information
|
||||
/// </summary>
|
||||
/// <param name="reader">XmlReader representing a diskarea block</param>
|
||||
/// <param name="dipValue">ListXmlDipValue to populate</param>
|
||||
private void ReadDipValue(XmlReader reader, ListXmlDipValue dipValue)
|
||||
/// <param name="dipValue">Setting to populate</param>
|
||||
private void ReadDipValue(XmlReader reader, Setting dipValue)
|
||||
{
|
||||
// If we have an empty dipvalue, skip it
|
||||
if (reader == null)
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
dipValue.Conditions = new List<ListXmlCondition>();
|
||||
dipValue.Conditions = new List<Condition>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -917,7 +917,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "condition":
|
||||
var condition = new ListXmlCondition();
|
||||
var condition = new Condition();
|
||||
condition.Tag = reader.GetAttribute("tag");
|
||||
condition.Mask = reader.GetAttribute("mask");
|
||||
condition.Relation = reader.GetAttribute("relation");
|
||||
@@ -1458,6 +1458,25 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.Slot:
|
||||
var slot = datItem as Slot;
|
||||
xtw.WriteStartElement("file");
|
||||
xtw.WriteAttributeString("type", "slot");
|
||||
xtw.WriteOptionalAttributeString("name", slot.Name);
|
||||
if (slot.SlotOptions != null)
|
||||
{
|
||||
foreach (var slotOption in slot.SlotOptions)
|
||||
{
|
||||
xtw.WriteStartElement("slotoption");
|
||||
xtw.WriteOptionalAttributeString("name", slotOption.Name);
|
||||
xtw.WriteOptionalAttributeString("devname", slotOption.DeviceName);
|
||||
xtw.WriteOptionalAttributeString("default", slotOption.Default.FromYesNo());
|
||||
xtw.WriteEndElement();
|
||||
}
|
||||
}
|
||||
xtw.WriteEndElement();
|
||||
break;
|
||||
|
||||
case ItemType.SoftwareList:
|
||||
var softwareList = datItem as DatItems.SoftwareList;
|
||||
xtw.WriteStartElement("file");
|
||||
|
||||
@@ -341,9 +341,9 @@ namespace SabreTools.Library.DatFiles
|
||||
Name = reader.GetAttribute("name"),
|
||||
Tag = reader.GetAttribute("tag"),
|
||||
Mask = reader.GetAttribute("mask"),
|
||||
Conditions = new List<ListXmlCondition>(),
|
||||
Locations = new List<ListXmlDipLocation>(),
|
||||
Values = new List<ListXmlDipValue>(),
|
||||
Conditions = new List<Condition>(),
|
||||
Locations = new List<Location>(),
|
||||
Values = new List<Setting>(),
|
||||
};
|
||||
|
||||
// Now read the internal tags
|
||||
@@ -526,7 +526,7 @@ namespace SabreTools.Library.DatFiles
|
||||
return;
|
||||
|
||||
// Get list ready
|
||||
dipSwitch.Values = new List<ListXmlDipValue>();
|
||||
dipSwitch.Values = new List<Setting>();
|
||||
|
||||
// Otherwise, add what is possible
|
||||
reader.MoveToContent();
|
||||
@@ -544,7 +544,7 @@ namespace SabreTools.Library.DatFiles
|
||||
switch (reader.Name)
|
||||
{
|
||||
case "dipvalue":
|
||||
var dipValue = new ListXmlDipValue();
|
||||
var dipValue = new Setting();
|
||||
dipValue.Name = reader.GetAttribute("name");
|
||||
dipValue.Value = reader.GetAttribute("value");
|
||||
dipValue.Default = reader.GetAttribute("default").AsYesNo();
|
||||
@@ -795,7 +795,7 @@ namespace SabreTools.Library.DatFiles
|
||||
xtw.WriteRequiredAttributeString("mask", dipSwitch.Mask);
|
||||
if (dipSwitch.Values != null)
|
||||
{
|
||||
foreach (ListXmlDipValue dipValue in dipSwitch.Values)
|
||||
foreach (Setting dipValue in dipSwitch.Values)
|
||||
{
|
||||
xtw.WriteStartElement("dipvalue");
|
||||
xtw.WriteRequiredAttributeString("name", dipValue.Name);
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Conditions associated with the adjustment
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML analog
|
||||
/// </summary>
|
||||
[JsonObject("analog")]
|
||||
public class ListXmlAnalog
|
||||
public class Analog
|
||||
{
|
||||
[JsonProperty("mask")]
|
||||
public string Mask { get; set; }
|
||||
@@ -26,7 +26,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level? (Both used at ListXML level AND under a lot of stuff)
|
||||
[JsonObject("condition")]
|
||||
public class ListXmlCondition
|
||||
public class Condition
|
||||
{
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
@@ -41,46 +41,11 @@ namespace SabreTools.Library.DatItems
|
||||
public string Value { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML conflocation
|
||||
/// </summary>
|
||||
[JsonObject("conflocation")]
|
||||
public class ListXmlConfLocation
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("inverted")]
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML confsetting
|
||||
/// </summary>
|
||||
[JsonObject("confsetting")]
|
||||
public class ListXmlConfSetting
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML control
|
||||
/// </summary>
|
||||
[JsonObject("control")]
|
||||
public class ListXmlControl
|
||||
public class Control
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
@@ -124,7 +89,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("device")]
|
||||
public class ListXmlDevice
|
||||
public class Device
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; }
|
||||
@@ -142,10 +107,10 @@ namespace SabreTools.Library.DatItems
|
||||
public string Interface { get; set; }
|
||||
|
||||
[JsonProperty("instances")]
|
||||
public List<ListXmlInstance> Instances { get; set; }
|
||||
public List<Instance> Instances { get; set; }
|
||||
|
||||
[JsonProperty("extensions")]
|
||||
public List<ListXmlExtension> Extensions { get; set; }
|
||||
public List<Extension> Extensions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -153,7 +118,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("display")]
|
||||
public class ListXmlDisplay
|
||||
public class Display
|
||||
{
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
@@ -198,48 +163,12 @@ namespace SabreTools.Library.DatItems
|
||||
public string VBStart { get; set; } // TODO: Int32? Float?
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML diplocation
|
||||
/// </summary>
|
||||
[JsonObject("diplocation")]
|
||||
public class ListXmlDipLocation
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("inverted")]
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML dipvalue
|
||||
/// </summary>
|
||||
/// <remarks>Also used by SoftwareList</remarks>
|
||||
[JsonObject("dipvalue")]
|
||||
public class ListXmlDipValue
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML driver
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("driver")]
|
||||
public class ListXmlDriver
|
||||
public class Driver
|
||||
{
|
||||
[JsonProperty("status")]
|
||||
public string Status { get; set; } // TODO: (good|imperfect|preliminary)
|
||||
@@ -258,7 +187,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// Represents one ListXML extension
|
||||
/// </summary>
|
||||
[JsonObject("extension")]
|
||||
public class ListXmlExtension
|
||||
public class Extension
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -269,7 +198,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("feature")]
|
||||
public class ListXmlFeature
|
||||
public class Feature
|
||||
{
|
||||
[JsonProperty("type")]
|
||||
public string Type { get; set; } // TODO: (protection|palette|graphics|sound|controls|keyboard|mouse|microphone|camera|disk|printer|lan|wan|timing)
|
||||
@@ -286,7 +215,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("input")]
|
||||
public class ListXmlInput
|
||||
public class Input
|
||||
{
|
||||
[JsonProperty("service")]
|
||||
public bool? Service { get; set; }
|
||||
@@ -301,14 +230,14 @@ namespace SabreTools.Library.DatItems
|
||||
public string Coins { get; set; } // TODO: Int32?
|
||||
|
||||
[JsonProperty("controls")]
|
||||
public List<ListXmlControl> Controls { get; set; }
|
||||
public List<Control> Controls { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML instance
|
||||
/// </summary>
|
||||
[JsonObject("instance")]
|
||||
public class ListXmlInstance
|
||||
public class Instance
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -317,39 +246,60 @@ namespace SabreTools.Library.DatItems
|
||||
public string BriefName { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML conflocation or diplocation
|
||||
/// </summary>
|
||||
[JsonObject("location")]
|
||||
public class Location
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("number")]
|
||||
public string Number { get; set; }
|
||||
|
||||
[JsonProperty("inverted")]
|
||||
public bool? Inverted { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML port
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?) (contains list)
|
||||
[JsonObject("port")]
|
||||
public class ListXmlPort
|
||||
public class Port
|
||||
{
|
||||
[JsonProperty("tag")]
|
||||
public string Tag { get; set; }
|
||||
|
||||
[JsonProperty("analogs")]
|
||||
public List<ListXmlAnalog> Analogs { get; set; }
|
||||
public List<Analog> Analogs { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slot
|
||||
/// Represents one ListXML confsetting or dipvalue
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (contains list)
|
||||
[JsonObject("slot")]
|
||||
public class ListXmlSlot
|
||||
[JsonObject("setting")]
|
||||
public class Setting
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[JsonProperty("slotoptions")]
|
||||
public List<ListXmlSlotOption> SlotOptions { get; set; }
|
||||
[JsonProperty("value")]
|
||||
public string Value { get; set; }
|
||||
|
||||
[JsonProperty("default")]
|
||||
public bool? Default { get; set; }
|
||||
|
||||
[JsonProperty("conditions")]
|
||||
public List<Condition> Conditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents one ListXML slotoption
|
||||
/// </summary>
|
||||
[JsonObject("slotoption")]
|
||||
public class ListXmlSlotOption
|
||||
public class SlotOption
|
||||
{
|
||||
[JsonProperty("name")]
|
||||
public string Name { get; set; }
|
||||
@@ -366,7 +316,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
/// TODO: Promote to DatItem level (doesn't have "name" field?)
|
||||
[JsonObject("sound")]
|
||||
public class ListXmlSound
|
||||
public class Sound
|
||||
{
|
||||
[JsonProperty("channels")]
|
||||
public string Channels { get; set; } // TODO: Int32?
|
||||
|
||||
@@ -30,19 +30,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// Conditions associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locations associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("locations")]
|
||||
public List<ListXmlConfLocation> Locations { get; set; }
|
||||
public List<Location> Locations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Settings associated with the configuration
|
||||
/// </summary>
|
||||
[JsonProperty("settings")]
|
||||
public List<ListXmlConfSetting> Settings { get; set; }
|
||||
public List<Setting> Settings { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -289,6 +289,12 @@ namespace SabreTools.Library.DatItems
|
||||
// Ram Option
|
||||
Field.DatItem_Content,
|
||||
|
||||
// Slot.SlotOptions
|
||||
Field.DatItem_SlotOptions,
|
||||
Field.DatItem_SlotOption_Name,
|
||||
Field.DatItem_SlotOption_DeviceName,
|
||||
Field.DatItem_SlotOption_Default,
|
||||
|
||||
// Release
|
||||
Field.DatItem_Language,
|
||||
|
||||
@@ -327,7 +333,6 @@ namespace SabreTools.Library.DatItems
|
||||
// ListXML
|
||||
Field.Machine_SourceFile,
|
||||
Field.Machine_Runnable,
|
||||
Field.Machine_Slots,
|
||||
Field.Machine_Infos,
|
||||
|
||||
// Logiqx
|
||||
@@ -497,6 +502,9 @@ namespace SabreTools.Library.DatItems
|
||||
case ItemType.Sample:
|
||||
return new Sample();
|
||||
|
||||
case ItemType.Slot:
|
||||
return new Slot();
|
||||
|
||||
case ItemType.SoftwareList:
|
||||
return new SoftwareList();
|
||||
|
||||
|
||||
@@ -30,19 +30,19 @@ namespace SabreTools.Library.DatItems
|
||||
/// Conditions associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("conditions")]
|
||||
public List<ListXmlCondition> Conditions { get; set; }
|
||||
public List<Condition> Conditions { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Locations associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("locations")]
|
||||
public List<ListXmlDipLocation> Locations { get; set; }
|
||||
public List<Location> Locations { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Settings associated with the dipswitch
|
||||
/// </summary>
|
||||
[JsonProperty("values")]
|
||||
public List<ListXmlDipValue> Values { get; set; }
|
||||
public List<Setting> Values { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
@@ -217,16 +217,6 @@ namespace SabreTools.Library.DatItems
|
||||
Machine_Device_Extensions,
|
||||
Machine_Device_Extension_Name,
|
||||
|
||||
// Slots
|
||||
Machine_Slots,
|
||||
Machine_Slot_Name,
|
||||
|
||||
// Slots.SlotOptions
|
||||
Machine_Slot_SlotOptions,
|
||||
Machine_Slot_SlotOption_Name,
|
||||
Machine_Slot_SlotOption_DeviceName,
|
||||
Machine_Slot_SlotOption_Default,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -398,6 +388,12 @@ namespace SabreTools.Library.DatItems
|
||||
// Release
|
||||
DatItem_Language,
|
||||
|
||||
// Slot.SlotOptions
|
||||
DatItem_SlotOptions,
|
||||
DatItem_SlotOption_Name,
|
||||
DatItem_SlotOption_DeviceName,
|
||||
DatItem_SlotOption_Default,
|
||||
|
||||
// Software List
|
||||
DatItem_SoftwareListStatus,
|
||||
DatItem_Filter,
|
||||
@@ -448,6 +444,7 @@ namespace SabreTools.Library.DatItems
|
||||
RamOption,
|
||||
Release,
|
||||
Sample,
|
||||
Slot,
|
||||
SoftwareList,
|
||||
|
||||
Blank = 99, // This is not a real type, only used internally
|
||||
|
||||
@@ -156,55 +156,49 @@ namespace SabreTools.Library.DatItems
|
||||
/// List of associated displays
|
||||
/// </summary>
|
||||
[JsonProperty("displays", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDisplay> Displays { get; set; } = null;
|
||||
public List<Display> Displays { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated sounds
|
||||
/// </summary>
|
||||
[JsonProperty("sounds", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSound> Sounds { get; set; } = null;
|
||||
public List<Sound> Sounds { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated conditions
|
||||
/// </summary>
|
||||
[JsonProperty("conditions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlCondition> Conditions { get; set; } = null;
|
||||
public List<Condition> Conditions { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated inputs
|
||||
/// </summary>
|
||||
[JsonProperty("inputs", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlInput> Inputs { get; set; } = null;
|
||||
public List<Input> Inputs { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated ports
|
||||
/// </summary>
|
||||
[JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlPort> Ports { get; set; } = null;
|
||||
public List<Port> Ports { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated drivers
|
||||
/// </summary>
|
||||
[JsonProperty("drivers", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDriver> Drivers { get; set; } = null;
|
||||
public List<Driver> Drivers { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated features
|
||||
/// </summary>
|
||||
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlFeature> Features { get; set; } = null;
|
||||
public List<Feature> Features { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of associated devices
|
||||
/// </summary>
|
||||
[JsonProperty("devices", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlDevice> Devices { get; set; } = null;
|
||||
|
||||
/// <summary>
|
||||
/// List of slot options
|
||||
/// </summary>
|
||||
[JsonProperty("slots", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public List<ListXmlSlot> Slots { get; set; } = null;
|
||||
public List<Device> Devices { get; set; } = null;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -566,7 +560,6 @@ namespace SabreTools.Library.DatItems
|
||||
Drivers = this.Drivers,
|
||||
Features = this.Features,
|
||||
Devices = this.Devices,
|
||||
Slots = this.Slots,
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -1456,9 +1449,6 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.Machine_Runnable))
|
||||
Runnable = Runnable.NULL;
|
||||
|
||||
if (fields.Contains(Field.Machine_Slots))
|
||||
Slots = null;
|
||||
|
||||
if (fields.Contains(Field.Machine_Infos))
|
||||
Infos = null;
|
||||
|
||||
@@ -1615,9 +1605,6 @@ namespace SabreTools.Library.DatItems
|
||||
if (fields.Contains(Field.Machine_Runnable))
|
||||
Runnable = machine.Runnable;
|
||||
|
||||
if (fields.Contains(Field.Machine_Slots))
|
||||
Slots = machine.Slots;
|
||||
|
||||
if (fields.Contains(Field.Machine_Infos))
|
||||
Infos = machine.Infos;
|
||||
|
||||
|
||||
174
SabreTools.Library/DatItems/Slot.cs
Normal file
174
SabreTools.Library/DatItems/Slot.cs
Normal file
@@ -0,0 +1,174 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
using SabreTools.Library.Filtering;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Library.DatItems
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents which Slot(s) is associated with a set
|
||||
/// </summary>
|
||||
[JsonObject("slot")]
|
||||
public class Slot : DatItem
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// Slot options associated with the slot
|
||||
/// </summary>
|
||||
[JsonProperty("slotoptions")]
|
||||
public List<SlotOption> SlotOptions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Accessors
|
||||
|
||||
/// <summary>
|
||||
/// Set fields with given values
|
||||
/// </summary>
|
||||
/// <param name="mappings">Mappings dictionary</param>
|
||||
public override void SetFields(Dictionary<Field, string> mappings)
|
||||
{
|
||||
// Set base fields
|
||||
base.SetFields(mappings);
|
||||
|
||||
// Handle Slot-specific fields
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Constructors
|
||||
|
||||
/// <summary>
|
||||
/// Create a default, empty Slot object
|
||||
/// </summary>
|
||||
public Slot()
|
||||
{
|
||||
Name = string.Empty;
|
||||
ItemType = ItemType.Slot;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cloning Methods
|
||||
|
||||
public override object Clone()
|
||||
{
|
||||
return new Slot()
|
||||
{
|
||||
Name = this.Name,
|
||||
ItemType = this.ItemType,
|
||||
DupeType = this.DupeType,
|
||||
|
||||
AltName = this.AltName,
|
||||
AltTitle = this.AltTitle,
|
||||
|
||||
Original = this.Original,
|
||||
OpenMSXSubType = this.OpenMSXSubType,
|
||||
OpenMSXType = this.OpenMSXType,
|
||||
Remark = this.Remark,
|
||||
Boot = this.Boot,
|
||||
|
||||
Part = this.Part,
|
||||
Features = this.Features,
|
||||
AreaName = this.AreaName,
|
||||
AreaSize = this.AreaSize,
|
||||
AreaWidth = this.AreaWidth,
|
||||
AreaEndianness = this.AreaEndianness,
|
||||
Value = this.Value,
|
||||
LoadFlag = this.LoadFlag,
|
||||
|
||||
Machine = this.Machine.Clone() as Machine,
|
||||
Source = this.Source.Clone() as Source,
|
||||
Remove = this.Remove,
|
||||
|
||||
SlotOptions = this.SlotOptions,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Comparision Methods
|
||||
|
||||
public override bool Equals(DatItem other)
|
||||
{
|
||||
// If we don't have a Slot, return false
|
||||
if (ItemType != other.ItemType)
|
||||
return false;
|
||||
|
||||
// Otherwise, treat it as a Slot
|
||||
Slot newOther = other as Slot;
|
||||
|
||||
// If the Slot information matches
|
||||
return (Name == newOther.Name); // TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Filtering
|
||||
|
||||
/// <summary>
|
||||
/// Check to see if a DatItem passes the filter
|
||||
/// </summary>
|
||||
/// <param name="filter">Filter to check against</param>
|
||||
/// <returns>True if the item passed the filter, false otherwise</returns>
|
||||
public override bool PassesFilter(Filter filter)
|
||||
{
|
||||
// Check common fields first
|
||||
if (!base.PassesFilter(filter))
|
||||
return false;
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove fields from the DatItem
|
||||
/// </summary>
|
||||
/// <param name="fields">List of Fields to remove</param>
|
||||
public override void RemoveFields(List<Field> fields)
|
||||
{
|
||||
// Remove common fields first
|
||||
base.RemoveFields(fields);
|
||||
|
||||
// Remove the fields
|
||||
if (fields.Contains(Field.DatItem_SlotOptions))
|
||||
SlotOptions = null;
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Sorting and Merging
|
||||
|
||||
/// <summary>
|
||||
/// Replace fields from another item
|
||||
/// </summary>
|
||||
/// <param name="item">DatItem to pull new information from</param>
|
||||
/// <param name="fields">List of Fields representing what should be updated</param>
|
||||
public override void ReplaceFields(DatItem item, List<Field> fields)
|
||||
{
|
||||
// Replace common fields first
|
||||
base.ReplaceFields(item, fields);
|
||||
|
||||
// If we don't have a Slot to replace from, ignore specific fields
|
||||
if (item.ItemType != ItemType.Slot)
|
||||
return;
|
||||
|
||||
// Cast for easier access
|
||||
Slot newItem = item as Slot;
|
||||
|
||||
// Replace the fields
|
||||
if (fields.Contains(Field.DatItem_SlotOptions))
|
||||
SlotOptions = newItem.SlotOptions;
|
||||
|
||||
// TODO: Handle DatItem_SlotOption*
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -139,16 +139,6 @@ namespace SabreTools.Library.Filtering
|
||||
public FilterItem<bool?> Machine_Device_Extensions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Device_Extension_Name { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Slots
|
||||
public FilterItem<bool?> Machine_Slots { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Slot_Name { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Slots.SlotOptions
|
||||
public FilterItem<bool?> Machine_Slot_SlotOptions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> Machine_Slot_SlotOption_Name { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> Machine_Slot_SlotOption_DeviceName { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> Machine_Slot_SlotOption_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -320,6 +310,12 @@ namespace SabreTools.Library.Filtering
|
||||
// Release
|
||||
public FilterItem<string> DatItem_Language { get; private set; } = new FilterItem<string>();
|
||||
|
||||
// Slots.SlotOptions
|
||||
public FilterItem<bool?> DatItem_SlotOptions { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
public FilterItem<string> DatItem_SlotOption_Name { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<string> DatItem_SlotOption_DeviceName { get; private set; } = new FilterItem<string>();
|
||||
public FilterItem<bool?> DatItem_SlotOption_Default { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||
|
||||
// Software List
|
||||
public FilterItem<SoftwareListStatus> DatItem_SoftwareListStatus { get; private set; } = new FilterItem<SoftwareListStatus>() { Positive = SoftwareListStatus.NULL, Negative = SoftwareListStatus.NULL };
|
||||
public FilterItem<string> DatItem_Filter { get; private set; } = new FilterItem<string>();
|
||||
@@ -1011,50 +1007,6 @@ namespace SabreTools.Library.Filtering
|
||||
Machine_Device_Extension_Name.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Slots
|
||||
case Field.Machine_Slots:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Slots.Neutral = false;
|
||||
else
|
||||
Machine_Slots.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Slot_Name:
|
||||
if (negate)
|
||||
Machine_Slot_Name.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Slot_Name.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Slots.SlotOptions
|
||||
case Field.Machine_Slot_SlotOptions:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Slot_SlotOptions.Neutral = false;
|
||||
else
|
||||
Machine_Slot_SlotOptions.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.Machine_Slot_SlotOption_Name:
|
||||
if (negate)
|
||||
Machine_Slot_SlotOption_Name.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Slot_SlotOption_Name.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Slot_SlotOption_DeviceName:
|
||||
if (negate)
|
||||
Machine_Slot_SlotOption_DeviceName.NegativeSet.Add(value);
|
||||
else
|
||||
Machine_Slot_SlotOption_DeviceName.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.Machine_Slot_SlotOption_Default:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
Machine_Slot_SlotOption_Default.Neutral = false;
|
||||
else
|
||||
Machine_Slot_SlotOption_Default.Neutral = true;
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -1806,6 +1758,35 @@ namespace SabreTools.Library.Filtering
|
||||
DatItem_Language.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
// Slots.SlotOptions
|
||||
case Field.DatItem_SlotOptions:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_SlotOptions.Neutral = false;
|
||||
else
|
||||
DatItem_SlotOptions.Neutral = true;
|
||||
break;
|
||||
|
||||
case Field.DatItem_SlotOption_Name:
|
||||
if (negate)
|
||||
DatItem_SlotOption_Name.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_SlotOption_Name.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_SlotOption_DeviceName:
|
||||
if (negate)
|
||||
DatItem_SlotOption_DeviceName.NegativeSet.Add(value);
|
||||
else
|
||||
DatItem_SlotOption_DeviceName.PositiveSet.Add(value);
|
||||
break;
|
||||
|
||||
case Field.DatItem_SlotOption_Default:
|
||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||
DatItem_SlotOption_Default.Neutral = false;
|
||||
else
|
||||
DatItem_SlotOption_Default.Neutral = true;
|
||||
break;
|
||||
|
||||
// Software List
|
||||
case Field.DatItem_SoftwareListStatus:
|
||||
if (negate)
|
||||
|
||||
@@ -647,24 +647,6 @@ namespace SabreTools.Library.Tools
|
||||
case "device_extension_name":
|
||||
return Field.Machine_Device_Extension_Name;
|
||||
|
||||
case "slots":
|
||||
return Field.Machine_Slots;
|
||||
|
||||
case "slot_name":
|
||||
return Field.Machine_Slot_Name;
|
||||
|
||||
case "slot_slotoptions":
|
||||
return Field.Machine_Slot_SlotOptions;
|
||||
|
||||
case "slot_slotoption_name":
|
||||
return Field.Machine_Slot_SlotOption_Name;
|
||||
|
||||
case "slot_slotoption_devicename":
|
||||
return Field.Machine_Slot_SlotOption_DeviceName;
|
||||
|
||||
case "slot_slotoption_default":
|
||||
return Field.Machine_Slot_SlotOption_Default;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Logiqx
|
||||
@@ -1046,6 +1028,19 @@ namespace SabreTools.Library.Tools
|
||||
case "language":
|
||||
return Field.DatItem_Language;
|
||||
|
||||
// Slot
|
||||
case "slotoptions":
|
||||
return Field.DatItem_SlotOptions;
|
||||
|
||||
case "slotoption_name":
|
||||
return Field.DatItem_SlotOption_Name;
|
||||
|
||||
case "slotoption_devicename":
|
||||
return Field.DatItem_SlotOption_DeviceName;
|
||||
|
||||
case "slotoption_default":
|
||||
return Field.DatItem_SlotOption_Default;
|
||||
|
||||
// Software List
|
||||
case "softwareliststatus":
|
||||
case "softwarelist_status":
|
||||
@@ -1172,11 +1167,6 @@ namespace SabreTools.Library.Tools
|
||||
case "runnable":
|
||||
return Field.Machine_Runnable;
|
||||
|
||||
case "slotoptions":
|
||||
case "slot options":
|
||||
case "slot-options":
|
||||
return Field.Machine_Slots;
|
||||
|
||||
case "infos":
|
||||
return Field.Machine_Infos;
|
||||
|
||||
@@ -1589,6 +1579,8 @@ namespace SabreTools.Library.Tools
|
||||
return ItemType.Rom;
|
||||
case "sample":
|
||||
return ItemType.Sample;
|
||||
case "slot":
|
||||
return ItemType.Slot;
|
||||
case "softwarelist":
|
||||
return ItemType.SoftwareList;
|
||||
default:
|
||||
@@ -1611,6 +1603,7 @@ namespace SabreTools.Library.Tools
|
||||
"release" => ItemType.Release,
|
||||
"rom" => ItemType.Rom,
|
||||
"sample" => ItemType.Sample,
|
||||
"slot" => ItemType.Slot,
|
||||
"softwarelist" => ItemType.SoftwareList,
|
||||
_ => null,
|
||||
};
|
||||
@@ -2031,6 +2024,8 @@ namespace SabreTools.Library.Tools
|
||||
return "rom";
|
||||
case ItemType.Sample:
|
||||
return "sample";
|
||||
case ItemType.Slot:
|
||||
return "slot";
|
||||
case ItemType.SoftwareList:
|
||||
return "softwarelist";
|
||||
default:
|
||||
@@ -2053,6 +2048,7 @@ namespace SabreTools.Library.Tools
|
||||
ItemType.Release => "release",
|
||||
ItemType.Rom => "rom",
|
||||
ItemType.Sample => "sample",
|
||||
ItemType.Slot => "slot",
|
||||
ItemType.SoftwareList => "softwarelist",
|
||||
_ => null,
|
||||
};
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -43,10 +43,10 @@ Add new output format(s): format(datformat, ...);
|
||||
Set the output directory: output(outdir);
|
||||
Write the internal items: write([overwrite = true]);
|
||||
Reset the internal state: reset();";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
Features = new Dictionary<string, Library.Help.Feature>();
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, Library.Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
|
||||
|
||||
@@ -21,7 +21,7 @@ namespace SabreTools.Features
|
||||
Description = "Split input DATs by a given criteria";
|
||||
_featureType = FeatureType.Flag;
|
||||
LongDescription = "This feature allows the user to split input DATs by a number of different possible criteria. See the individual input information for details. More than one split type is allowed at a time.";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
Features = new Dictionary<string, Library.Help.Feature>();
|
||||
|
||||
AddFeature(OutputTypeListInput);
|
||||
this[OutputTypeListInput].AddFeature(DeprecatedFlag);
|
||||
@@ -39,7 +39,7 @@ namespace SabreTools.Features
|
||||
AddFeature(TypeFlag);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, Library.Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
SplittingMode splittingMode = GetSplittingMode(features);
|
||||
|
||||
@@ -23,7 +23,7 @@ namespace SabreTools.Features
|
||||
Description = "Update and manipulate DAT(s)";
|
||||
_featureType = FeatureType.Flag;
|
||||
LongDescription = "This is the multitool part of the program, allowing for almost every manipulation to a DAT, or set of DATs. This is also a combination of many different programs that performed DAT manipulation that work better together.";
|
||||
Features = new Dictionary<string, Feature>();
|
||||
Features = new Dictionary<string, Library.Help.Feature>();
|
||||
|
||||
// Output Formats
|
||||
AddFeature(OutputTypeListInput);
|
||||
@@ -98,7 +98,7 @@ namespace SabreTools.Features
|
||||
AddFeature(ThreadsInt32Input);
|
||||
}
|
||||
|
||||
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
||||
public override void ProcessFeatures(Dictionary<string, Library.Help.Feature> features)
|
||||
{
|
||||
base.ProcessFeatures(features);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user