mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Fix filtering, merging, blanks, and bucketing
This commit is contained in:
@@ -1226,24 +1226,10 @@ namespace SabreTools.Library.DatItems
|
||||
{
|
||||
if (x.Machine.Name == y.Machine.Name)
|
||||
{
|
||||
// Special case for comparing a Disk, Media, or Rom to another item type
|
||||
if ((x.ItemType == ItemType.Disk || x.ItemType == ItemType.Media || x.ItemType == ItemType.Rom)
|
||||
^ (y.ItemType == ItemType.Disk || y.ItemType == ItemType.Media || x.ItemType == ItemType.Rom))
|
||||
{
|
||||
if (x.ItemType == ItemType.Disk || x.ItemType == ItemType.Media || x.ItemType == ItemType.Rom)
|
||||
return -1;
|
||||
else
|
||||
return 1;
|
||||
}
|
||||
if (Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(x.Name)) == Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(y.Name)))
|
||||
return nc.Compare(Path.GetFileName(Sanitizer.RemovePathUnsafeCharacters(x.Name)), Path.GetFileName(Sanitizer.RemovePathUnsafeCharacters(y.Name)));
|
||||
|
||||
// Otherwise, we compare names naturally
|
||||
else
|
||||
{
|
||||
if (Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(x.Name)) == Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(y.Name)))
|
||||
return nc.Compare(Path.GetFileName(Sanitizer.RemovePathUnsafeCharacters(x.Name)), Path.GetFileName(Sanitizer.RemovePathUnsafeCharacters(y.Name)));
|
||||
|
||||
return nc.Compare(Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(x.Name)), Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(y.Name)));
|
||||
}
|
||||
return nc.Compare(Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(x.Name)), Path.GetDirectoryName(Sanitizer.RemovePathUnsafeCharacters(y.Name)));
|
||||
}
|
||||
|
||||
return nc.Compare(x.Machine.Name, y.Machine.Name);
|
||||
|
||||
@@ -439,7 +439,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0x00,
|
||||
NULL = 0,
|
||||
|
||||
None = 1 << 0,
|
||||
Good = 1 << 1,
|
||||
@@ -471,10 +471,14 @@ namespace SabreTools.Library.DatItems
|
||||
[Flags]
|
||||
public enum OpenMSXSubType
|
||||
{
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0,
|
||||
Rom = 1,
|
||||
MegaRom = 2,
|
||||
SCCPlusCart = 3,
|
||||
|
||||
Rom = 1 << 0,
|
||||
MegaRom = 1 << 1,
|
||||
SCCPlusCart = 1 << 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -483,10 +487,14 @@ namespace SabreTools.Library.DatItems
|
||||
[Flags]
|
||||
public enum MachineType
|
||||
{
|
||||
NULL = 0x00,
|
||||
Bios = 1 << 0,
|
||||
Device = 1 << 1,
|
||||
Mechanical = 1 << 2,
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 1 << 0,
|
||||
|
||||
Bios = 1 << 1,
|
||||
Device = 1 << 2,
|
||||
Mechanical = 1 << 3,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -495,10 +503,14 @@ namespace SabreTools.Library.DatItems
|
||||
[Flags]
|
||||
public enum Runnable
|
||||
{
|
||||
NULL,
|
||||
No,
|
||||
Partial,
|
||||
Yes,
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0,
|
||||
|
||||
No = 1 << 0,
|
||||
Partial = 1 << 1,
|
||||
Yes = 1 << 2,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -507,9 +519,13 @@ namespace SabreTools.Library.DatItems
|
||||
[Flags]
|
||||
public enum Supported
|
||||
{
|
||||
NULL,
|
||||
No,
|
||||
Partial,
|
||||
Yes,
|
||||
/// <summary>
|
||||
/// This is a fake flag that is used for filter only
|
||||
/// </summary>
|
||||
NULL = 0,
|
||||
|
||||
No = 1 << 0,
|
||||
Partial = 1 << 1,
|
||||
Yes = 1 << 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,7 +85,7 @@ namespace SabreTools.Library.DatItems
|
||||
/// </summary>
|
||||
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public MachineType MachineType { get; set; } = MachineType.NULL;
|
||||
public MachineType MachineType { get; set; } = 0x0;
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -740,9 +740,9 @@ namespace SabreTools.Library.DatItems
|
||||
return false;
|
||||
|
||||
// Machine_Type
|
||||
if (filter.Machine_Type.MatchesPositive(MachineType.NULL, MachineType) == false)
|
||||
if (filter.Machine_Type.MatchesPositive(0x0, MachineType) == false)
|
||||
return false;
|
||||
if (filter.Machine_Type.MatchesNegative(MachineType.NULL, MachineType) == true)
|
||||
if (filter.Machine_Type.MatchesNegative(0x0, MachineType) == true)
|
||||
return false;
|
||||
|
||||
#endregion
|
||||
@@ -1501,7 +1501,7 @@ namespace SabreTools.Library.DatItems
|
||||
SampleOf = null;
|
||||
|
||||
if (fields.Contains(Field.Machine_Type))
|
||||
MachineType = MachineType.NULL;
|
||||
MachineType = 0x0;
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user