diff --git a/SabreTools.Metadata.Filter.Test/FilterObjectTests.cs b/SabreTools.Metadata.Filter.Test/FilterObjectTests.cs index 0891efee..069351a8 100644 --- a/SabreTools.Metadata.Filter.Test/FilterObjectTests.cs +++ b/SabreTools.Metadata.Filter.Test/FilterObjectTests.cs @@ -1982,5 +1982,122 @@ namespace SabreTools.Metadata.Filter.Test } #endregion + + #region Sound + + [Theory] + [InlineData("sound.channels", "12345")] + public void Matches_Sound(string itemField, string value) + { + var filter = new FilterObject(itemField, value, Operation.Equals); + Sound obj = new Sound + { + Channels = 12345, + }; + + bool actual = filter.Matches(obj); + Assert.True(actual); + } + + #endregion + + #region SourceDetails + + [Theory] + [InlineData("sourcedetails.appendtonumber", "appendtonumber")] + [InlineData("sourcedetails.comment1", "comment1")] + [InlineData("sourcedetails.comment2", "comment2")] + [InlineData("sourcedetails.dumpdate", "dumpdate")] + [InlineData("sourcedetails.dumpdateinfo", "1")] + [InlineData("sourcedetails.dumper", "dumper")] + [InlineData("sourcedetails.id", "id")] + [InlineData("sourcedetails.link1", "link1")] + [InlineData("sourcedetails.link1public", "1")] + [InlineData("sourcedetails.link2", "link2")] + [InlineData("sourcedetails.link2public", "1")] + [InlineData("sourcedetails.link3", "link3")] + [InlineData("sourcedetails.link3public", "1")] + [InlineData("sourcedetails.mediatitle", "mediatitle")] + [InlineData("sourcedetails.nodump", "1")] + [InlineData("sourcedetails.origin", "origin")] + [InlineData("sourcedetails.originalformat", "originalformat")] + [InlineData("sourcedetails.project", "project")] + [InlineData("sourcedetails.region", "region")] + [InlineData("sourcedetails.releasedate", "releasedate")] + [InlineData("sourcedetails.releasedateinfo", "1")] + [InlineData("sourcedetails.rominfo", "rominfo")] + [InlineData("sourcedetails.section", "section")] + [InlineData("sourcedetails.tool", "tool")] + public void Matches_SourceDetails(string itemField, string value) + { + var filter = new FilterObject(itemField, value, Operation.Equals); + SourceDetails obj = new SourceDetails + { + AppendToNumber = "appendtonumber", + Comment1 = "comment1", + Comment2 = "comment2", + DumpDate = "dumpdate", + DumpDateInfo = true, + Dumper = "dumper", + Id = "id", + Link1 = "link1", + Link1Public = true, + Link2 = "link2", + Link2Public = true, + Link3 = "link3", + Link3Public = true, + MediaTitle = "mediatitle", + Nodump = true, + Origin = "origin", + OriginalFormat = "originalformat", + Project = "project", + Region = "region", + ReleaseDate = "releasedate", + ReleaseDateInfo = true, + RomInfo = "rominfo", + Section = "section", + Tool = "tool", + }; + + bool actual = filter.Matches(obj); + Assert.True(actual); + } + + #endregion + + #region Video + + [Theory] + [InlineData("video.aspectx", "12345")] + [InlineData("video.aspecty", "12345")] + [InlineData("video.height", "12345")] + [InlineData("video.y", "12345")] + [InlineData("video.orientation", "horizontal")] + [InlineData("video.rotate", "horizontal")] + [InlineData("video.refresh", "123.45")] + [InlineData("video.freq", "123.45")] + [InlineData("video.displaytype", "vector")] + [InlineData("video.screen", "vector")] + [InlineData("video.width", "12345")] + [InlineData("video.x", "12345")] + public void Matches_Video(string itemField, string value) + { + var filter = new FilterObject(itemField, value, Operation.Equals); + Video obj = new Video + { + AspectX = 12345, + AspectY = 12345, + Height = 12345, + Orientation = Rotation.East, + Refresh = 123.45, + Screen = DisplayType.Vector, + Width = 12345, + }; + + bool actual = filter.Matches(obj); + Assert.True(actual); + } + + #endregion } } diff --git a/SabreTools.Metadata.Filter/FilterKey.cs b/SabreTools.Metadata.Filter/FilterKey.cs index 5e54de55..012a745c 100644 --- a/SabreTools.Metadata.Filter/FilterKey.cs +++ b/SabreTools.Metadata.Filter/FilterKey.cs @@ -771,6 +771,64 @@ namespace SabreTools.Metadata.Filter "tag", ]; + /// + /// Known keys for Sound + /// + private static readonly string[] _soundKeys = + [ + "channels", + ]; + + /// + /// Known keys for SourceDetails + /// + private static readonly string[] _sourceDetailsKeys = + [ + "appendtonumber", + "comment1", + "comment2", + "dumpdate", + "dumpdateinfo", + "dumper", + "id", + "link1", + "link1public", + "link2", + "link2public", + "link3", + "link3public", + "mediatitle", + "nodump", + "origin", + "originalformat", + "project", + "region", + "releasedate", + "releasedateinfo", + "rominfo", + "section", + "tool", + ]; + + /// + /// Known keys for Video + /// + private static readonly string[] _videoKeys = + [ + "aspectx", + "aspecty", + "displaytype", + "freq", + "height", + "orientation", + "refresh", + "rotate", + "screen", + "width", + "x", + "y", + ]; + #endregion /// @@ -988,6 +1046,9 @@ namespace SabreTools.Metadata.Filter "slot" => _slotKeys, "slotoption" => _slotOptionKeys, "softwarelist" => _softwareListKeys, + "sound" => _soundKeys, + "sourcedetails" => _sourceDetailsKeys, + "video" => _videoKeys, _ => null, }; if (properties is null) diff --git a/SabreTools.Metadata.Filter/FilterObject.cs b/SabreTools.Metadata.Filter/FilterObject.cs index 721584fd..4e95bc33 100644 --- a/SabreTools.Metadata.Filter/FilterObject.cs +++ b/SabreTools.Metadata.Filter/FilterObject.cs @@ -2426,12 +2426,13 @@ namespace SabreTools.Metadata.Filter return true; case "orientation": case "rotate": - checkValue = obj.Orientation?.AsStringValue(); + checkValue = obj.Orientation?.AsStringValue(useSecond: true); return true; case "refresh": case "freq": checkValue = obj.Refresh?.ToString(); return true; + case "displaytype": case "screen": checkValue = obj.Screen?.AsStringValue(); return true;