mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Promote Info
This commit is contained in:
@@ -161,6 +161,12 @@ namespace SabreTools.Library.DatFiles
|
|||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public long FeatureCount { get; private set; } = 0;
|
public long FeatureCount { get; private set; } = 0;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Number of Info items
|
||||||
|
/// </summary>
|
||||||
|
[JsonIgnore]
|
||||||
|
public long InfoCount { get; private set; } = 0;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Number of Input items
|
/// Number of Input items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -599,6 +605,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Feature:
|
case ItemType.Feature:
|
||||||
FeatureCount++;
|
FeatureCount++;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Info:
|
||||||
|
InfoCount++;
|
||||||
|
break;
|
||||||
case ItemType.Input:
|
case ItemType.Input:
|
||||||
InputCount++;
|
InputCount++;
|
||||||
break;
|
break;
|
||||||
@@ -776,6 +785,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Feature:
|
case ItemType.Feature:
|
||||||
FeatureCount--;
|
FeatureCount--;
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Info:
|
||||||
|
InfoCount--;
|
||||||
|
break;
|
||||||
case ItemType.Input:
|
case ItemType.Input:
|
||||||
InputCount--;
|
InputCount--;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -259,6 +259,9 @@ namespace SabreTools.Library.DatFiles
|
|||||||
case ItemType.Feature:
|
case ItemType.Feature:
|
||||||
datItem = datItemObj.ToObject<Feature>();
|
datItem = datItemObj.ToObject<Feature>();
|
||||||
break;
|
break;
|
||||||
|
case ItemType.Info:
|
||||||
|
datItem = datItemObj.ToObject<Info>();
|
||||||
|
break;
|
||||||
case ItemType.Input:
|
case ItemType.Input:
|
||||||
datItem = datItemObj.ToObject<Input>();
|
datItem = datItemObj.ToObject<Input>();
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -1473,6 +1473,15 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Info:
|
||||||
|
var info = datItem as Info;
|
||||||
|
xtw.WriteStartElement("file");
|
||||||
|
xtw.WriteAttributeString("type", "info");
|
||||||
|
xtw.WriteRequiredAttributeString("name", info.Name);
|
||||||
|
xtw.WriteRequiredAttributeString("value", info.InfoValue);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Input:
|
case ItemType.Input:
|
||||||
var input = datItem as Input;
|
var input = datItem as Input;
|
||||||
xtw.WriteStartElement("file");
|
xtw.WriteStartElement("file");
|
||||||
|
|||||||
@@ -164,23 +164,27 @@ namespace SabreTools.Library.DatFiles
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case "info":
|
case "info":
|
||||||
var info = new Info();
|
ParseAddHelper(new Info
|
||||||
info.Name = reader.GetAttribute("name");
|
{
|
||||||
info.Value = reader.GetAttribute("value");
|
Name = reader.GetAttribute("name"),
|
||||||
|
InfoValue = reader.GetAttribute("value"),
|
||||||
|
|
||||||
// Ensure the list exists
|
Source = new Source
|
||||||
if (machine.Infos == null)
|
{
|
||||||
machine.Infos = new List<Info>();
|
Index = indexId,
|
||||||
|
Name = filename,
|
||||||
machine.Infos.Add(info);
|
},
|
||||||
|
});
|
||||||
|
|
||||||
reader.Read();
|
reader.Read();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "sharedfeat":
|
case "sharedfeat":
|
||||||
var sharedFeature = new SharedFeature();
|
var sharedFeature = new SharedFeature
|
||||||
sharedFeature.Name = reader.GetAttribute("name");
|
{
|
||||||
sharedFeature.Value = reader.GetAttribute("value");
|
Name = reader.GetAttribute("name"),
|
||||||
|
Value = reader.GetAttribute("value"),
|
||||||
|
};
|
||||||
|
|
||||||
// Ensure the list exists
|
// Ensure the list exists
|
||||||
if (machine.SharedFeatures == null)
|
if (machine.SharedFeatures == null)
|
||||||
@@ -699,17 +703,6 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteOptionalElementString("publisher", datItem.Machine.Publisher);
|
xtw.WriteOptionalElementString("publisher", datItem.Machine.Publisher);
|
||||||
xtw.WriteOptionalElementString("category", datItem.Machine.Category);
|
xtw.WriteOptionalElementString("category", datItem.Machine.Category);
|
||||||
|
|
||||||
if (datItem.Machine.Infos != null && datItem.Machine.Infos.Count > 0)
|
|
||||||
{
|
|
||||||
foreach (Info kvp in datItem.Machine.Infos)
|
|
||||||
{
|
|
||||||
xtw.WriteStartElement("info");
|
|
||||||
xtw.WriteRequiredAttributeString("name", kvp.Name);
|
|
||||||
xtw.WriteRequiredAttributeString("value", kvp.Value);
|
|
||||||
xtw.WriteEndElement();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (datItem.Machine.SharedFeatures != null && datItem.Machine.SharedFeatures.Count > 0)
|
if (datItem.Machine.SharedFeatures != null && datItem.Machine.SharedFeatures.Count > 0)
|
||||||
{
|
{
|
||||||
foreach (SharedFeature kvp in datItem.Machine.SharedFeatures)
|
foreach (SharedFeature kvp in datItem.Machine.SharedFeatures)
|
||||||
@@ -828,6 +821,14 @@ namespace SabreTools.Library.DatFiles
|
|||||||
xtw.WriteEndElement();
|
xtw.WriteEndElement();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
case ItemType.Info:
|
||||||
|
var info = datItem as Info;
|
||||||
|
xtw.WriteStartElement("info");
|
||||||
|
xtw.WriteRequiredAttributeString("name", info.Name);
|
||||||
|
xtw.WriteRequiredAttributeString("value", info.InfoValue);
|
||||||
|
xtw.WriteEndElement();
|
||||||
|
break;
|
||||||
|
|
||||||
case ItemType.Rom:
|
case ItemType.Rom:
|
||||||
var rom = datItem as Rom;
|
var rom = datItem as Rom;
|
||||||
if (string.IsNullOrWhiteSpace(areaName))
|
if (string.IsNullOrWhiteSpace(areaName))
|
||||||
|
|||||||
@@ -15,38 +15,8 @@ namespace SabreTools.Library.DatItems
|
|||||||
{
|
{
|
||||||
#region Machine
|
#region Machine
|
||||||
|
|
||||||
#region OpenMSX
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents the OpenMSX original value
|
|
||||||
/// </summary>
|
|
||||||
[JsonObject("original")]
|
|
||||||
public class Original
|
|
||||||
{
|
|
||||||
[JsonProperty("value")]
|
|
||||||
public bool? Value { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("content")]
|
|
||||||
public string Content { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents one SoftwareList info
|
|
||||||
/// </summary>
|
|
||||||
[JsonObject("info")]
|
|
||||||
public class Info
|
|
||||||
{
|
|
||||||
[JsonProperty("name")]
|
|
||||||
public string Name { get; set; }
|
|
||||||
|
|
||||||
[JsonProperty("value")]
|
|
||||||
public string Value { get; set; }
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents one SoftwareList shared feature object
|
/// Represents one SoftwareList shared feature object
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -66,6 +36,23 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
#region DatItem
|
#region DatItem
|
||||||
|
|
||||||
|
#region OpenMSX
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Represents the OpenMSX original value
|
||||||
|
/// </summary>
|
||||||
|
[JsonObject("original")]
|
||||||
|
public class Original
|
||||||
|
{
|
||||||
|
[JsonProperty("value")]
|
||||||
|
public bool? Value { get; set; }
|
||||||
|
|
||||||
|
[JsonProperty("content")]
|
||||||
|
public string Content { get; set; }
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -326,7 +326,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
// ListXML
|
// ListXML
|
||||||
Field.Machine_SourceFile,
|
Field.Machine_SourceFile,
|
||||||
Field.Machine_Runnable,
|
Field.Machine_Runnable,
|
||||||
Field.Machine_Infos,
|
|
||||||
|
|
||||||
// Logiqx
|
// Logiqx
|
||||||
Field.Machine_Board,
|
Field.Machine_Board,
|
||||||
@@ -506,6 +505,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
case ItemType.Feature:
|
case ItemType.Feature:
|
||||||
return new Feature();
|
return new Feature();
|
||||||
|
|
||||||
|
case ItemType.Info:
|
||||||
|
return new Info();
|
||||||
|
|
||||||
case ItemType.Input:
|
case ItemType.Input:
|
||||||
return new Input();
|
return new Input();
|
||||||
|
|
||||||
@@ -570,6 +572,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
ItemType.Driver => new Driver(),
|
ItemType.Driver => new Driver(),
|
||||||
ItemType.Extension => new Extension(),
|
ItemType.Extension => new Extension(),
|
||||||
ItemType.Feature => new Feature(),
|
ItemType.Feature => new Feature(),
|
||||||
|
ItemType.Info => new Info(),
|
||||||
ItemType.Instance => new Instance(),
|
ItemType.Instance => new Instance(),
|
||||||
ItemType.Location => new Location(),
|
ItemType.Location => new Location(),
|
||||||
ItemType.Media => new Media(),
|
ItemType.Media => new Media(),
|
||||||
|
|||||||
@@ -221,11 +221,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
|
|
||||||
Machine_Supported,
|
Machine_Supported,
|
||||||
|
|
||||||
// Infos
|
|
||||||
Machine_Infos, // TODO: Fix usage of Infos
|
|
||||||
Machine_Info_Name,
|
|
||||||
Machine_Info_Value,
|
|
||||||
|
|
||||||
// SharedFeatures
|
// SharedFeatures
|
||||||
Machine_SharedFeatures, // TODO: Fix usage of SharedFeatures
|
Machine_SharedFeatures, // TODO: Fix usage of SharedFeatures
|
||||||
Machine_SharedFeature_Name,
|
Machine_SharedFeature_Name,
|
||||||
@@ -396,6 +391,9 @@ namespace SabreTools.Library.DatItems
|
|||||||
DatItem_FeatureStatus,
|
DatItem_FeatureStatus,
|
||||||
DatItem_FeatureOverall,
|
DatItem_FeatureOverall,
|
||||||
|
|
||||||
|
// Info
|
||||||
|
DatItem_InfoValue,
|
||||||
|
|
||||||
// Inputs
|
// Inputs
|
||||||
DatItem_Service,
|
DatItem_Service,
|
||||||
DatItem_Tilt,
|
DatItem_Tilt,
|
||||||
@@ -491,6 +489,7 @@ namespace SabreTools.Library.DatItems
|
|||||||
Driver,
|
Driver,
|
||||||
Extension,
|
Extension,
|
||||||
Feature,
|
Feature,
|
||||||
|
Info,
|
||||||
Input,
|
Input,
|
||||||
Instance,
|
Instance,
|
||||||
Location,
|
Location,
|
||||||
|
|||||||
243
SabreTools.Library/DatItems/Info.cs
Normal file
243
SabreTools.Library/DatItems/Info.cs
Normal file
@@ -0,0 +1,243 @@
|
|||||||
|
using System.Collections.Generic;
|
||||||
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
using SabreTools.Library.Filtering;
|
||||||
|
using Newtonsoft.Json;
|
||||||
|
using SabreTools.Library.Tools;
|
||||||
|
|
||||||
|
namespace SabreTools.Library.DatItems
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Represents special information about a machine
|
||||||
|
/// </summary>
|
||||||
|
[JsonObject("info")]
|
||||||
|
public class Info : DatItem
|
||||||
|
{
|
||||||
|
#region Fields
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Name of the item
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("name")]
|
||||||
|
public string Name { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Information value
|
||||||
|
/// </summary>
|
||||||
|
[JsonProperty("value")]
|
||||||
|
public string InfoValue { get; set; }
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Accessors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets the name to use for a DatItem
|
||||||
|
/// </summary>
|
||||||
|
/// <returns>Name if available, null otherwise</returns>
|
||||||
|
public override string GetName()
|
||||||
|
{
|
||||||
|
return Name;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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 Info-specific fields
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_Name))
|
||||||
|
Name = mappings[Field.DatItem_Name];
|
||||||
|
|
||||||
|
if (mappings.Keys.Contains(Field.DatItem_InfoValue))
|
||||||
|
InfoValue = mappings[Field.DatItem_InfoValue];
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Create a default, empty Info object
|
||||||
|
/// </summary>
|
||||||
|
public Info()
|
||||||
|
{
|
||||||
|
Name = string.Empty;
|
||||||
|
ItemType = ItemType.Info;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Cloning Methods
|
||||||
|
|
||||||
|
public override object Clone()
|
||||||
|
{
|
||||||
|
return new Info()
|
||||||
|
{
|
||||||
|
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,
|
||||||
|
|
||||||
|
InfoValue = this.InfoValue,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Comparision Methods
|
||||||
|
|
||||||
|
public override bool Equals(DatItem other)
|
||||||
|
{
|
||||||
|
// If we don't have a sample, return false
|
||||||
|
if (ItemType != other.ItemType)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Otherwise, treat it as a Info
|
||||||
|
Info newOther = other as Info;
|
||||||
|
|
||||||
|
// If the archive information matches
|
||||||
|
return (Name == newOther.Name && InfoValue == newOther.InfoValue);
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Filtering
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Clean a DatItem according to the cleaner
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="cleaner">Cleaner to implement</param>
|
||||||
|
public override void Clean(Cleaner cleaner)
|
||||||
|
{
|
||||||
|
// Clean common items first
|
||||||
|
base.Clean(cleaner);
|
||||||
|
|
||||||
|
// If we're stripping unicode characters, strip item name
|
||||||
|
if (cleaner?.RemoveUnicode == true)
|
||||||
|
Name = Sanitizer.RemoveUnicodeCharacters(Name);
|
||||||
|
|
||||||
|
// If we are in NTFS trim mode, trim the game name
|
||||||
|
if (cleaner?.Trim == true)
|
||||||
|
{
|
||||||
|
// Windows max name length is 260
|
||||||
|
int usableLength = 260 - Machine.Name.Length - (cleaner.Root?.Length ?? 0);
|
||||||
|
if (Name.Length > usableLength)
|
||||||
|
{
|
||||||
|
string ext = Path.GetExtension(Name);
|
||||||
|
Name = Name.Substring(0, usableLength - ext.Length);
|
||||||
|
Name += ext;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <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;
|
||||||
|
|
||||||
|
// Filter on item name
|
||||||
|
if (filter.DatItem_Name.MatchesPositiveSet(Name) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_Name.MatchesNegativeSet(Name) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// Filter on info value
|
||||||
|
if (filter.DatItem_InfoValue.MatchesPositiveSet(InfoValue) == false)
|
||||||
|
return false;
|
||||||
|
if (filter.DatItem_InfoValue.MatchesNegativeSet(InfoValue) == true)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
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_Name))
|
||||||
|
Name = null;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_InfoValue))
|
||||||
|
InfoValue = null;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Set internal names to match One Rom Per Game (ORPG) logic
|
||||||
|
/// </summary>
|
||||||
|
public override void SetOneRomPerGame()
|
||||||
|
{
|
||||||
|
string[] splitname = Name.Split('.');
|
||||||
|
Machine.Name += $"/{string.Join(".", splitname.Take(splitname.Length > 1 ? splitname.Length - 1 : 1))}";
|
||||||
|
Name = Path.GetFileName(Name);
|
||||||
|
}
|
||||||
|
|
||||||
|
#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 Info to replace from, ignore specific fields
|
||||||
|
if (item.ItemType != ItemType.Info)
|
||||||
|
return;
|
||||||
|
|
||||||
|
// Cast for easier access
|
||||||
|
Info newItem = item as Info;
|
||||||
|
|
||||||
|
// Replace the fields
|
||||||
|
if (fields.Contains(Field.DatItem_Name))
|
||||||
|
Name = newItem.Name;
|
||||||
|
|
||||||
|
if (fields.Contains(Field.DatItem_InfoValue))
|
||||||
|
InfoValue = newItem.InfoValue;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -259,13 +259,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
[JsonProperty("supported", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
[JsonProperty("supported", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||||
public Supported Supported { get; set; } = Supported.NULL;
|
public Supported Supported { get; set; } = Supported.NULL;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// List of info items
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>Also in SoftwareList</remarks>
|
|
||||||
[JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
|
||||||
public List<Info> Infos { get; set; } = null;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// List of shared feature items
|
/// List of shared feature items
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -522,7 +515,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
#region SoftwareList
|
#region SoftwareList
|
||||||
|
|
||||||
Supported = this.Supported,
|
Supported = this.Supported,
|
||||||
Infos = this.Infos,
|
|
||||||
SharedFeatures = this.SharedFeatures,
|
SharedFeatures = this.SharedFeatures,
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -790,54 +782,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (filter.Machine_Supported.MatchesNegative(Supported.NULL, Supported) == true)
|
if (filter.Machine_Supported.MatchesNegative(Supported.NULL, Supported) == true)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
#region Infos
|
|
||||||
|
|
||||||
// Machine_Infos
|
|
||||||
if (filter.Machine_Infos.MatchesNeutral(null, Infos?.Any() ?? null) == false)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
// Machine_Info_Name
|
|
||||||
if (Infos?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var info in Infos)
|
|
||||||
{
|
|
||||||
if (filter.Machine_Info_Name.MatchesPositiveSet(info?.Name) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_Info_Name.MatchesNegativeSet(info?.Name) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Machine_Info_Value
|
|
||||||
if (Infos?.Any() == true)
|
|
||||||
{
|
|
||||||
bool anyPositive = false;
|
|
||||||
bool anyNegative = false;
|
|
||||||
|
|
||||||
foreach (var info in Infos)
|
|
||||||
{
|
|
||||||
if (filter.Machine_Info_Value.MatchesPositiveSet(info?.Value) != false)
|
|
||||||
anyPositive = true;
|
|
||||||
if (filter.Machine_Info_Value.MatchesNegativeSet(info?.Value) == true)
|
|
||||||
anyNegative = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!anyPositive)
|
|
||||||
return false;
|
|
||||||
if (anyNegative)
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region SharedFeatures
|
#region SharedFeatures
|
||||||
|
|
||||||
// Machine_SharedFeatures
|
// Machine_SharedFeatures
|
||||||
@@ -968,9 +912,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (fields.Contains(Field.Machine_Runnable))
|
if (fields.Contains(Field.Machine_Runnable))
|
||||||
Runnable = Runnable.NULL;
|
Runnable = Runnable.NULL;
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_Infos))
|
|
||||||
Infos = null;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
@@ -1124,9 +1065,6 @@ namespace SabreTools.Library.DatItems
|
|||||||
if (fields.Contains(Field.Machine_Runnable))
|
if (fields.Contains(Field.Machine_Runnable))
|
||||||
Runnable = machine.Runnable;
|
Runnable = machine.Runnable;
|
||||||
|
|
||||||
if (fields.Contains(Field.Machine_Infos))
|
|
||||||
Infos = machine.Infos;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
|
|||||||
@@ -86,11 +86,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
|
|
||||||
public FilterItem<Supported> Machine_Supported { get; private set; } = new FilterItem<Supported>() { Positive = Supported.NULL, Negative = Supported.NULL };
|
public FilterItem<Supported> Machine_Supported { get; private set; } = new FilterItem<Supported>() { Positive = Supported.NULL, Negative = Supported.NULL };
|
||||||
|
|
||||||
// Infos
|
|
||||||
public FilterItem<bool?> Machine_Infos { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
|
||||||
public FilterItem<string> Machine_Info_Name { get; private set; } = new FilterItem<string>();
|
|
||||||
public FilterItem<string> Machine_Info_Value { get; private set; } = new FilterItem<string>();
|
|
||||||
|
|
||||||
// SharedFeatures
|
// SharedFeatures
|
||||||
public FilterItem<bool?> Machine_SharedFeatures { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> Machine_SharedFeatures { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
public FilterItem<string> Machine_SharedFeature_Name { get; private set; } = new FilterItem<string>();
|
public FilterItem<string> Machine_SharedFeature_Name { get; private set; } = new FilterItem<string>();
|
||||||
@@ -261,6 +256,9 @@ namespace SabreTools.Library.Filtering
|
|||||||
public FilterItem<FeatureStatus> DatItem_FeatureStatus { get; private set; } = new FilterItem<FeatureStatus>() { Positive = FeatureStatus.NULL, Negative = FeatureStatus.NULL };
|
public FilterItem<FeatureStatus> DatItem_FeatureStatus { get; private set; } = new FilterItem<FeatureStatus>() { Positive = FeatureStatus.NULL, Negative = FeatureStatus.NULL };
|
||||||
public FilterItem<FeatureStatus> DatItem_FeatureOverall { get; private set; } = new FilterItem<FeatureStatus>() { Positive = FeatureStatus.NULL, Negative = FeatureStatus.NULL };
|
public FilterItem<FeatureStatus> DatItem_FeatureOverall { get; private set; } = new FilterItem<FeatureStatus>() { Positive = FeatureStatus.NULL, Negative = FeatureStatus.NULL };
|
||||||
|
|
||||||
|
// Info
|
||||||
|
public FilterItem<string> DatItem_InfoValue { get; private set; } = new FilterItem<string>();
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
public FilterItem<bool?> DatItem_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_Service { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
public FilterItem<bool?> DatItem_Tilt { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
public FilterItem<bool?> DatItem_Tilt { get; private set; } = new FilterItem<bool?>() { Neutral = null };
|
||||||
@@ -653,28 +651,6 @@ namespace SabreTools.Library.Filtering
|
|||||||
Machine_Supported.Positive |= value.AsSupported();
|
Machine_Supported.Positive |= value.AsSupported();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// Infos
|
|
||||||
case Field.Machine_Infos:
|
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
|
||||||
Machine_Infos.Neutral = false;
|
|
||||||
else
|
|
||||||
Machine_Infos.Neutral = true;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Info_Name:
|
|
||||||
if (negate)
|
|
||||||
Machine_Info_Name.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Info_Name.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
case Field.Machine_Info_Value:
|
|
||||||
if (negate)
|
|
||||||
Machine_Info_Value.NegativeSet.Add(value);
|
|
||||||
else
|
|
||||||
Machine_Info_Value.PositiveSet.Add(value);
|
|
||||||
break;
|
|
||||||
|
|
||||||
// SharedFeatures
|
// SharedFeatures
|
||||||
case Field.Machine_SharedFeatures:
|
case Field.Machine_SharedFeatures:
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
@@ -1491,6 +1467,14 @@ namespace SabreTools.Library.Filtering
|
|||||||
DatItem_FeatureOverall.Positive |= value.AsFeatureStatus();
|
DatItem_FeatureOverall.Positive |= value.AsFeatureStatus();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
// Info
|
||||||
|
case Field.DatItem_InfoValue:
|
||||||
|
if (negate)
|
||||||
|
DatItem_InfoValue.NegativeSet.Add(value);
|
||||||
|
else
|
||||||
|
DatItem_InfoValue.PositiveSet.Add(value);
|
||||||
|
break;
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
case Field.DatItem_Service:
|
case Field.DatItem_Service:
|
||||||
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
|
||||||
|
|||||||
@@ -644,15 +644,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "supported":
|
case "supported":
|
||||||
return Field.Machine_Supported;
|
return Field.Machine_Supported;
|
||||||
|
|
||||||
case "infos":
|
|
||||||
return Field.Machine_Infos;
|
|
||||||
|
|
||||||
case "info_name":
|
|
||||||
return Field.Machine_Info_Name;
|
|
||||||
|
|
||||||
case "info_value":
|
|
||||||
return Field.Machine_Info_Value;
|
|
||||||
|
|
||||||
case "sharedfeatures":
|
case "sharedfeatures":
|
||||||
return Field.Machine_SharedFeatures;
|
return Field.Machine_SharedFeatures;
|
||||||
|
|
||||||
@@ -1044,6 +1035,10 @@ namespace SabreTools.Library.Tools
|
|||||||
case "featureoverall":
|
case "featureoverall":
|
||||||
return Field.DatItem_FeatureOverall;
|
return Field.DatItem_FeatureOverall;
|
||||||
|
|
||||||
|
// Info
|
||||||
|
case "infovalue":
|
||||||
|
return Field.DatItem_InfoValue;
|
||||||
|
|
||||||
// Input
|
// Input
|
||||||
case "service":
|
case "service":
|
||||||
return Field.DatItem_Service;
|
return Field.DatItem_Service;
|
||||||
@@ -1136,9 +1131,9 @@ namespace SabreTools.Library.Tools
|
|||||||
case "channels":
|
case "channels":
|
||||||
return Field.DatItem_Channels;
|
return Field.DatItem_Channels;
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#endregion // Item-Specific
|
#endregion // Item-Specific
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1255,9 +1250,6 @@ namespace SabreTools.Library.Tools
|
|||||||
case "runnable":
|
case "runnable":
|
||||||
return Field.Machine_Runnable;
|
return Field.Machine_Runnable;
|
||||||
|
|
||||||
case "infos":
|
|
||||||
return Field.Machine_Infos;
|
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
#region Logiqx
|
#region Logiqx
|
||||||
@@ -1673,6 +1665,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return ItemType.Extension;
|
return ItemType.Extension;
|
||||||
case "feature":
|
case "feature":
|
||||||
return ItemType.Feature;
|
return ItemType.Feature;
|
||||||
|
case "info":
|
||||||
|
return ItemType.Info;
|
||||||
case "input":
|
case "input":
|
||||||
return ItemType.Input;
|
return ItemType.Input;
|
||||||
case "instance":
|
case "instance":
|
||||||
@@ -1724,6 +1718,7 @@ namespace SabreTools.Library.Tools
|
|||||||
"driver" => ItemType.Driver,
|
"driver" => ItemType.Driver,
|
||||||
"extension" => ItemType.Extension,
|
"extension" => ItemType.Extension,
|
||||||
"feature" => ItemType.Feature,
|
"feature" => ItemType.Feature,
|
||||||
|
"info" => ItemType.Info,
|
||||||
"input" => ItemType.Input,
|
"input" => ItemType.Input,
|
||||||
"instance" => ItemType.Instance,
|
"instance" => ItemType.Instance,
|
||||||
"location" => ItemType.Location,
|
"location" => ItemType.Location,
|
||||||
@@ -2314,6 +2309,8 @@ namespace SabreTools.Library.Tools
|
|||||||
return "extension";
|
return "extension";
|
||||||
case ItemType.Feature:
|
case ItemType.Feature:
|
||||||
return "feature";
|
return "feature";
|
||||||
|
case ItemType.Info:
|
||||||
|
return "info";
|
||||||
case ItemType.Input:
|
case ItemType.Input:
|
||||||
return "input";
|
return "input";
|
||||||
case ItemType.Instance:
|
case ItemType.Instance:
|
||||||
@@ -2365,6 +2362,7 @@ namespace SabreTools.Library.Tools
|
|||||||
ItemType.Driver => "driver",
|
ItemType.Driver => "driver",
|
||||||
ItemType.Extension => "extension",
|
ItemType.Extension => "extension",
|
||||||
ItemType.Feature => "feature",
|
ItemType.Feature => "feature",
|
||||||
|
ItemType.Info => "info",
|
||||||
ItemType.Input => "input",
|
ItemType.Input => "input",
|
||||||
ItemType.Instance => "instance",
|
ItemType.Instance => "instance",
|
||||||
ItemType.Location => "location",
|
ItemType.Location => "location",
|
||||||
|
|||||||
Reference in New Issue
Block a user