mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-04-06 06:11:45 +00:00
Convert Display and Video fully over to properties
This commit is contained in:
@@ -1815,6 +1815,24 @@ namespace SabreTools.Data.Extensions.Test
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null)]
|
||||
[InlineData("0", Rotation.North)]
|
||||
[InlineData("north", Rotation.North)]
|
||||
[InlineData("vertical", Rotation.North)]
|
||||
[InlineData("90", Rotation.East)]
|
||||
[InlineData("east", Rotation.East)]
|
||||
[InlineData("horizontal", Rotation.East)]
|
||||
[InlineData("180", Rotation.South)]
|
||||
[InlineData("south", Rotation.South)]
|
||||
[InlineData("270", Rotation.West)]
|
||||
[InlineData("west", Rotation.West)]
|
||||
public void AsRotationTest(string? field, Rotation? expected)
|
||||
{
|
||||
Rotation? actual = field.AsRotation();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null)]
|
||||
[InlineData("no", Runnable.No)]
|
||||
@@ -2124,6 +2142,21 @@ namespace SabreTools.Data.Extensions.Test
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(Rotation.North, true, "vertical")]
|
||||
[InlineData(Rotation.North, false, "0")]
|
||||
[InlineData(Rotation.East, true, "horizontal")]
|
||||
[InlineData(Rotation.East, false, "90")]
|
||||
[InlineData(Rotation.South, true, "vertical")]
|
||||
[InlineData(Rotation.South, false, "180")]
|
||||
[InlineData(Rotation.West, true, "horizontal")]
|
||||
[InlineData(Rotation.West, false, "270")]
|
||||
public void FromRotationTest(Rotation field, bool useSecond, string? expected)
|
||||
{
|
||||
string? actual = field.AsStringValue(useSecond);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData((Runnable)int.MaxValue, null)]
|
||||
[InlineData(Runnable.No, "no")]
|
||||
|
||||
@@ -161,6 +161,8 @@ namespace SabreTools.Data.Extensions
|
||||
return deviceRef.Clone() as DeviceRef;
|
||||
else if (self is DipLocation dipLocation)
|
||||
return dipLocation.Clone() as DipLocation;
|
||||
else if (self is Display display)
|
||||
return display.Clone() as Display;
|
||||
else if (self is Extension extension)
|
||||
return extension.Clone() as Extension;
|
||||
// TODO: Reenable when PartFeature no longer needs nesting
|
||||
@@ -178,6 +180,8 @@ namespace SabreTools.Data.Extensions
|
||||
return slotOption.Clone() as SlotOption;
|
||||
else if (self is Sound sound)
|
||||
return sound.Clone() as Sound;
|
||||
else if (self is Video video)
|
||||
return video.Clone() as Video;
|
||||
|
||||
// If construction failed, we can't do anything
|
||||
if (Activator.CreateInstance(self.GetType()) is not DictionaryBase clone)
|
||||
@@ -232,24 +236,6 @@ namespace SabreTools.Data.Extensions
|
||||
cloneDisk.Status = selfDisk.Status;
|
||||
cloneDisk.Writable = selfDisk.Writable;
|
||||
}
|
||||
else if (self is Display selfDisplay && clone is Display cloneDisplay)
|
||||
{
|
||||
cloneDisplay.AspectX = selfDisplay.AspectX;
|
||||
cloneDisplay.AspectY = selfDisplay.AspectY;
|
||||
cloneDisplay.DisplayType = selfDisplay.DisplayType;
|
||||
cloneDisplay.FlipX = selfDisplay.FlipX;
|
||||
cloneDisplay.HBEnd = selfDisplay.HBEnd;
|
||||
cloneDisplay.HBStart = selfDisplay.HBStart;
|
||||
cloneDisplay.Height = selfDisplay.Height;
|
||||
cloneDisplay.HTotal = selfDisplay.HTotal;
|
||||
cloneDisplay.PixClock = selfDisplay.PixClock;
|
||||
cloneDisplay.Refresh = selfDisplay.Refresh;
|
||||
cloneDisplay.Tag = selfDisplay.Tag;
|
||||
cloneDisplay.VBEnd = selfDisplay.VBEnd;
|
||||
cloneDisplay.VBStart = selfDisplay.VBStart;
|
||||
cloneDisplay.VTotal = selfDisplay.VTotal;
|
||||
cloneDisplay.Width = selfDisplay.Width;
|
||||
}
|
||||
else if (self is Driver selfDriver && clone is Driver cloneDriver)
|
||||
{
|
||||
cloneDriver.Blit = selfDriver.Blit;
|
||||
@@ -365,15 +351,6 @@ namespace SabreTools.Data.Extensions
|
||||
cloneSoftwareList.Status = selfSoftwareList.Status;
|
||||
cloneSoftwareList.Tag = selfSoftwareList.Tag;
|
||||
}
|
||||
else if (self is Video selfVideo && clone is Video cloneVideo)
|
||||
{
|
||||
cloneVideo.AspectX = selfVideo.AspectX;
|
||||
cloneVideo.AspectY = selfVideo.AspectY;
|
||||
cloneVideo.Height = selfVideo.Height;
|
||||
cloneVideo.Refresh = selfVideo.Refresh;
|
||||
cloneVideo.Screen = selfVideo.Screen;
|
||||
cloneVideo.Width = selfVideo.Width;
|
||||
}
|
||||
|
||||
// Handle known properties
|
||||
clone.SetName(self.GetName());
|
||||
@@ -1412,6 +1389,23 @@ namespace SabreTools.Data.Extensions
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the enum value for an input string, if possible
|
||||
/// </summary>
|
||||
/// <param name="value">String value to parse/param>
|
||||
/// <returns>Enum value representing the input, null on error</returns>
|
||||
public static Rotation? AsRotation(this string? value)
|
||||
{
|
||||
return value?.ToLowerInvariant() switch
|
||||
{
|
||||
"0" or "north" or "vertical" => Rotation.North,
|
||||
"90" or "east" or "horizontal" => Rotation.East,
|
||||
"180" or "south" => Rotation.South,
|
||||
"270" or "west" => Rotation.West,
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the enum value for an input string, if possible
|
||||
/// </summary>
|
||||
@@ -1801,6 +1795,23 @@ namespace SabreTools.Data.Extensions
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string value for an input enum, if possible
|
||||
/// </summary>
|
||||
/// <param name="value">Enum value to parse/param>
|
||||
/// <returns>String value representing the input, null on error</returns>
|
||||
public static string? AsStringValue(this Rotation value, bool useSecond = false)
|
||||
{
|
||||
return value switch
|
||||
{
|
||||
Rotation.North => useSecond ? "vertical" : "0",
|
||||
Rotation.East => useSecond ? "horizontal" : "90",
|
||||
Rotation.South => useSecond ? "vertical" : "180",
|
||||
Rotation.West => useSecond ? "horizontal" : "270",
|
||||
_ => null,
|
||||
};
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string value for an input enum, if possible
|
||||
/// </summary>
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace SabreTools.Data.Models.ClrMamePro
|
||||
|
||||
/// <remarks>orientation, (vertical|horizontal)</remarks>
|
||||
[Required]
|
||||
public string? Orientation { get; set; }
|
||||
public Rotation? Orientation { get; set; }
|
||||
|
||||
/// <remarks>x</remarks>
|
||||
public long? X { get; set; }
|
||||
|
||||
@@ -17,7 +17,7 @@ namespace SabreTools.Data.Models.Listxml
|
||||
|
||||
/// <remarks>(0|90|180|270)</remarks>
|
||||
[XmlAttribute("rotate")]
|
||||
public string? Rotate { get; set; }
|
||||
public Rotation? Rotate { get; set; }
|
||||
|
||||
/// <remarks>(yes|no) "no"</remarks>
|
||||
[XmlAttribute("flipx")]
|
||||
|
||||
@@ -15,7 +15,7 @@ namespace SabreTools.Data.Models.Listxml
|
||||
/// <remarks>(vertical|horizontal)</remarks>
|
||||
[Required]
|
||||
[XmlAttribute("orientation")]
|
||||
public string? Orientation { get; set; }
|
||||
public Rotation? Orientation { get; set; }
|
||||
|
||||
[XmlAttribute("width")]
|
||||
public long? Width { get; set; }
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
[JsonObject("display"), XmlRoot("display")]
|
||||
public class Display : DatItem
|
||||
public class Display : DatItem, ICloneable, IEquatable<Display>, IEquatable<Video>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -32,6 +33,9 @@ namespace SabreTools.Data.Models.Metadata
|
||||
|
||||
public double? Refresh { get; set; }
|
||||
|
||||
/// <remarks>(0|90|180|270)</remarks>
|
||||
public Rotation? Rotate { get; set; }
|
||||
|
||||
public string? Tag { get; set; }
|
||||
|
||||
public long? VBEnd { get; set; }
|
||||
@@ -44,14 +48,118 @@ namespace SabreTools.Data.Models.Metadata
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keys
|
||||
|
||||
/// <remarks>(0|90|180|270)</remarks>
|
||||
/// TODO: Convert to enum
|
||||
public const string RotateKey = "rotate";
|
||||
|
||||
#endregion
|
||||
|
||||
public Display() => ItemType = ItemType.Display;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var obj = new Display();
|
||||
|
||||
obj.AspectX = AspectX;
|
||||
obj.AspectY = AspectY;
|
||||
obj.DisplayType = DisplayType;
|
||||
obj.FlipX = FlipX;
|
||||
obj.HBEnd = HBEnd;
|
||||
obj.HBStart = HBStart;
|
||||
obj.Height = Height;
|
||||
obj.HTotal = HTotal;
|
||||
obj.PixClock = PixClock;
|
||||
obj.Refresh = Refresh;
|
||||
obj.Rotate = Rotate;
|
||||
obj.Tag = Tag;
|
||||
obj.VBEnd = VBEnd;
|
||||
obj.VBStart = VBStart;
|
||||
obj.VTotal = VTotal;
|
||||
obj.Width = Width;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Display? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if (DisplayType != other.DisplayType)
|
||||
return false;
|
||||
|
||||
if (FlipX != other.FlipX)
|
||||
return false;
|
||||
|
||||
if (HBEnd != other.HBEnd)
|
||||
return false;
|
||||
|
||||
if (HBStart != other.HBStart)
|
||||
return false;
|
||||
|
||||
if (Height != other.Height)
|
||||
return false;
|
||||
|
||||
if (HTotal != other.HTotal)
|
||||
return false;
|
||||
|
||||
if (PixClock != other.PixClock)
|
||||
return false;
|
||||
|
||||
if (Refresh != other.Refresh)
|
||||
return false;
|
||||
|
||||
if (Rotate != other.Rotate)
|
||||
return false;
|
||||
|
||||
if ((Tag is null) ^ (other.Tag is null))
|
||||
return false;
|
||||
else if (Tag is not null && !Tag.Equals(other.Tag, StringComparison.OrdinalIgnoreCase))
|
||||
return false;
|
||||
|
||||
if (VBEnd != other.VBEnd)
|
||||
return false;
|
||||
|
||||
if (VBStart != other.VBStart)
|
||||
return false;
|
||||
|
||||
if (VTotal != other.VTotal)
|
||||
return false;
|
||||
|
||||
if (Width != other.Width)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Video? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if (AspectX != other.AspectX)
|
||||
return false;
|
||||
|
||||
if (AspectY != other.AspectY)
|
||||
return false;
|
||||
|
||||
if (DisplayType != other.Screen)
|
||||
return false;
|
||||
|
||||
if (Height != other.Height)
|
||||
return false;
|
||||
|
||||
if (Refresh != other.Refresh)
|
||||
return false;
|
||||
|
||||
if (Rotate != other.Orientation)
|
||||
return false;
|
||||
|
||||
if (Width != other.Width)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -495,6 +495,24 @@ namespace SabreTools.Data.Models.Metadata
|
||||
GreaterThanOrEqual,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine display rotation
|
||||
/// </summary>
|
||||
public enum Rotation
|
||||
{
|
||||
/// <summary>0</summary>
|
||||
North = 0,
|
||||
|
||||
/// <summary>90</summary>
|
||||
East = 90,
|
||||
|
||||
/// <summary>180</summary>
|
||||
South = 180,
|
||||
|
||||
/// <summary>270</summary>
|
||||
West = 270,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine machine runnable status
|
||||
/// </summary>
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
using System;
|
||||
using System.Xml.Serialization;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace SabreTools.Data.Models.Metadata
|
||||
{
|
||||
[JsonObject("video"), XmlRoot("video")]
|
||||
public class Video : DatItem
|
||||
public class Video : DatItem, ICloneable, IEquatable<Display>, IEquatable<Video>
|
||||
{
|
||||
#region Properties
|
||||
|
||||
@@ -15,6 +16,9 @@ namespace SabreTools.Data.Models.Metadata
|
||||
/// <remarks>Originally "y"</remarks>
|
||||
public long? Height { get; set; }
|
||||
|
||||
/// <remarks>(vertical|horizontal)</remarks>
|
||||
public Rotation? Orientation { get; set; }
|
||||
|
||||
/// <remarks>Originally "freq"</remarks>
|
||||
public double? Refresh { get; set; }
|
||||
|
||||
@@ -26,13 +30,86 @@ namespace SabreTools.Data.Models.Metadata
|
||||
|
||||
#endregion
|
||||
|
||||
#region Keys
|
||||
|
||||
/// <remarks>(vertical|horizontal)</remarks>
|
||||
public const string OrientationKey = "orientation";
|
||||
|
||||
#endregion
|
||||
|
||||
public Video() => ItemType = ItemType.Video;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public object Clone()
|
||||
{
|
||||
var obj = new Video();
|
||||
|
||||
obj.AspectX = AspectX;
|
||||
obj.AspectY = AspectY;
|
||||
obj.Height = Height;
|
||||
obj.Orientation = Orientation;
|
||||
obj.Refresh = Refresh;
|
||||
obj.Screen = Screen;
|
||||
obj.Width = Width;
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Display? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if (AspectX != other.AspectX)
|
||||
return false;
|
||||
|
||||
if (AspectY != other.AspectY)
|
||||
return false;
|
||||
|
||||
if (Height != other.Height)
|
||||
return false;
|
||||
|
||||
if (Orientation != other.Rotate)
|
||||
return false;
|
||||
|
||||
if (Refresh != other.Refresh)
|
||||
return false;
|
||||
|
||||
if (Screen != other.DisplayType)
|
||||
return false;
|
||||
|
||||
if (Width != other.Width)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public bool Equals(Video? other)
|
||||
{
|
||||
// Null never matches
|
||||
if (other is null)
|
||||
return false;
|
||||
|
||||
// Properties
|
||||
if (AspectX != other.AspectX)
|
||||
return false;
|
||||
|
||||
if (AspectY != other.AspectY)
|
||||
return false;
|
||||
|
||||
if (Height != other.Height)
|
||||
return false;
|
||||
|
||||
if (Orientation != other.Orientation)
|
||||
return false;
|
||||
|
||||
if (Refresh != other.Refresh)
|
||||
return false;
|
||||
|
||||
if (Screen != other.Screen)
|
||||
return false;
|
||||
|
||||
if (Width != other.Width)
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -585,7 +585,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
HTotal = 12345,
|
||||
PixClock = 12345,
|
||||
Refresh = 123.45,
|
||||
[Data.Models.Metadata.Display.RotateKey] = 90,
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
Tag = "tag",
|
||||
DisplayType = Data.Models.Metadata.DisplayType.Vector,
|
||||
VBEnd = 12345,
|
||||
@@ -1026,7 +1026,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
AspectX = 12345,
|
||||
AspectY = 12345,
|
||||
Height = 12345,
|
||||
[Data.Models.Metadata.Video.OrientationKey] = "vertical",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Refresh = 123.45,
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Width = 12345,
|
||||
@@ -1361,7 +1361,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.Equal(12345, display.HTotal);
|
||||
Assert.Equal(12345, display.PixClock);
|
||||
Assert.Equal(123.45, display.Refresh);
|
||||
Assert.Equal(90, display.ReadLong(Data.Models.Metadata.Display.RotateKey));
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.DisplayType);
|
||||
Assert.Equal(12345, display.VBEnd);
|
||||
@@ -1671,7 +1671,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.Equal(12345, display.Height);
|
||||
Assert.Equal(123.45, display.Refresh);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(90, display.ReadLong(Data.Models.Metadata.Display.RotateKey));
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -876,7 +876,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.Equal(12345, display.HTotal);
|
||||
Assert.Equal(12345, display.PixClock);
|
||||
Assert.Equal(123.45, display.Refresh);
|
||||
Assert.Equal(90, display.ReadLong(Data.Models.Metadata.Display.RotateKey));
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.DisplayType);
|
||||
Assert.Equal(12345, display.VBEnd);
|
||||
@@ -1259,7 +1259,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
Assert.Equal(12345, video.AspectY);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal("vertical", video.ReadString(Data.Models.Metadata.Video.OrientationKey));
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(123.45, video.Refresh);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal(12345, video.Width);
|
||||
|
||||
@@ -201,7 +201,7 @@ namespace SabreTools.Metadata.DatFiles.Test
|
||||
Assert.NotNull(actual);
|
||||
Assert.True(actual.SequenceEqual([
|
||||
nameof(Data.Models.Metadata.Display.DisplayType),
|
||||
Data.Models.Metadata.Display.RotateKey,
|
||||
nameof(Data.Models.Metadata.Display.Rotate),
|
||||
]));
|
||||
}
|
||||
|
||||
|
||||
@@ -936,26 +936,12 @@ namespace SabreTools.Metadata.DatFiles
|
||||
AspectX = displayItem.AspectX,
|
||||
AspectY = displayItem.AspectY,
|
||||
Height = displayItem.Height,
|
||||
Orientation = displayItem.Rotate,
|
||||
Refresh = displayItem.Refresh,
|
||||
Screen = displayItem.DisplayType,
|
||||
Width = displayItem.Width,
|
||||
};
|
||||
|
||||
switch (displayItem.ReadLong(Data.Models.Metadata.Display.RotateKey))
|
||||
{
|
||||
case 0:
|
||||
case 180:
|
||||
videoItem[Data.Models.Metadata.Video.OrientationKey] = "horizontal";
|
||||
break;
|
||||
case 90:
|
||||
case 270:
|
||||
videoItem[Data.Models.Metadata.Video.OrientationKey] = "vertical";
|
||||
break;
|
||||
default:
|
||||
// This should never happen
|
||||
break;
|
||||
}
|
||||
|
||||
EnsureMachineKey<Data.Models.Metadata.Video?>(machine, Data.Models.Metadata.Machine.VideoKey);
|
||||
AppendToMachineKey(machine, Data.Models.Metadata.Machine.VideoKey, videoItem);
|
||||
}
|
||||
|
||||
@@ -142,8 +142,8 @@ namespace SabreTools.Metadata.DatFiles.Formats
|
||||
case Display display:
|
||||
if (display.DisplayType is null)
|
||||
missingFields.Add(nameof(Data.Models.Metadata.Display.DisplayType));
|
||||
if (display.ReadLong(Data.Models.Metadata.Display.RotateKey) is null)
|
||||
missingFields.Add(Data.Models.Metadata.Display.RotateKey);
|
||||
if (display.Rotate is null)
|
||||
missingFields.Add(nameof(Data.Models.Metadata.Display.Rotate));
|
||||
break;
|
||||
|
||||
case Sound sound:
|
||||
|
||||
@@ -76,6 +76,12 @@ namespace SabreTools.Metadata.DatItems.Formats
|
||||
set => (_internal as Data.Models.Metadata.Display)?.Refresh = value;
|
||||
}
|
||||
|
||||
public Data.Models.Metadata.Rotation? Rotate
|
||||
{
|
||||
get => (_internal as Data.Models.Metadata.Display)?.Rotate;
|
||||
set => (_internal as Data.Models.Metadata.Display)?.Rotate = value;
|
||||
}
|
||||
|
||||
public string? Tag
|
||||
{
|
||||
get => (_internal as Data.Models.Metadata.Display)?.Tag;
|
||||
@@ -112,13 +118,7 @@ namespace SabreTools.Metadata.DatItems.Formats
|
||||
|
||||
public Display() : base() { }
|
||||
|
||||
public Display(Data.Models.Metadata.Display item) : base(item)
|
||||
{
|
||||
// Process flag values
|
||||
long? rotate = ReadLong(Data.Models.Metadata.Display.RotateKey);
|
||||
if (rotate is not null)
|
||||
Write<string?>(Data.Models.Metadata.Display.RotateKey, rotate.ToString());
|
||||
}
|
||||
public Display(Data.Models.Metadata.Display item) : base(item) { }
|
||||
|
||||
public Display(Data.Models.Metadata.Display item, Machine machine, Source source) : this(item)
|
||||
{
|
||||
@@ -133,20 +133,8 @@ namespace SabreTools.Metadata.DatItems.Formats
|
||||
DisplayType = item.Screen;
|
||||
Height = item.Height;
|
||||
Refresh = item.Refresh;
|
||||
Rotate = item.Orientation;
|
||||
Width = item.Width;
|
||||
|
||||
switch (item.ReadString(Data.Models.Metadata.Video.OrientationKey))
|
||||
{
|
||||
case "horizontal":
|
||||
Write<long?>(Data.Models.Metadata.Display.RotateKey, 0);
|
||||
break;
|
||||
case "vertical":
|
||||
Write<long?>(Data.Models.Metadata.Display.RotateKey, 90);
|
||||
break;
|
||||
default:
|
||||
// TODO: Log invalid values
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
public Display(Data.Models.Metadata.Video item, Machine machine, Source source) : this(item)
|
||||
|
||||
@@ -538,7 +538,10 @@ namespace SabreTools.Metadata.Filter
|
||||
case Display item when fieldName == "refresh" || fieldName == "freq":
|
||||
checkValue = item.Refresh?.ToString();
|
||||
return true;
|
||||
case Display item when fieldName == "type":
|
||||
case Display item when fieldName == "rotate" || fieldName == "orientation":
|
||||
checkValue = item.Rotate?.AsStringValue();
|
||||
return true;
|
||||
case Display item when fieldName == "type" || fieldName == "screen":
|
||||
checkValue = item.DisplayType?.AsStringValue();
|
||||
return true;
|
||||
case Display item when fieldName == "tag":
|
||||
@@ -832,10 +835,13 @@ namespace SabreTools.Metadata.Filter
|
||||
case Video item when fieldName == "height" || fieldName == "y":
|
||||
checkValue = item.Height?.ToString();
|
||||
return true;
|
||||
case Video item when fieldName == "orientation" || fieldName == "rotate":
|
||||
checkValue = item.Orientation?.AsStringValue();
|
||||
return true;
|
||||
case Video item when fieldName == "refresh" || fieldName == "freq":
|
||||
checkValue = item.Refresh?.ToString();
|
||||
return true;
|
||||
case Video item when fieldName == "screen":
|
||||
case Video item when fieldName == "screen" || fieldName == "type":
|
||||
checkValue = item.Screen?.AsStringValue();
|
||||
return true;
|
||||
case Video item when fieldName == "width" || fieldName == "x":
|
||||
|
||||
@@ -163,31 +163,7 @@ namespace SabreTools.Metadata
|
||||
}
|
||||
else if (self is Display selfDisplay && other is Display otherDisplay)
|
||||
{
|
||||
if (selfDisplay.DisplayType != otherDisplay.DisplayType)
|
||||
return false;
|
||||
if (selfDisplay.FlipX != otherDisplay.FlipX)
|
||||
return false;
|
||||
if (selfDisplay.HBEnd != otherDisplay.HBEnd)
|
||||
return false;
|
||||
if (selfDisplay.HBStart != otherDisplay.HBStart)
|
||||
return false;
|
||||
if (selfDisplay.Height != otherDisplay.Height)
|
||||
return false;
|
||||
if (selfDisplay.HTotal != otherDisplay.HTotal)
|
||||
return false;
|
||||
if (selfDisplay.PixClock != otherDisplay.PixClock)
|
||||
return false;
|
||||
if (selfDisplay.Refresh != otherDisplay.Refresh)
|
||||
return false;
|
||||
if (selfDisplay.Tag != otherDisplay.Tag)
|
||||
return false;
|
||||
if (selfDisplay.VBEnd != otherDisplay.VBEnd)
|
||||
return false;
|
||||
if (selfDisplay.VBStart != otherDisplay.VBStart)
|
||||
return false;
|
||||
if (selfDisplay.VTotal != otherDisplay.VTotal)
|
||||
return false;
|
||||
if (selfDisplay.Width != otherDisplay.Width)
|
||||
if (!selfDisplay.Equals(otherDisplay))
|
||||
return false;
|
||||
}
|
||||
else if (self is Driver selfDriver && other is Driver otherDriver)
|
||||
@@ -389,17 +365,7 @@ namespace SabreTools.Metadata
|
||||
}
|
||||
else if (self is Video selfVideo && other is Video otherVideo)
|
||||
{
|
||||
if (selfVideo.AspectX != otherVideo.AspectX)
|
||||
return false;
|
||||
if (selfVideo.AspectY != otherVideo.AspectY)
|
||||
return false;
|
||||
if (selfVideo.Height != otherVideo.Height)
|
||||
return false;
|
||||
if (selfVideo.Refresh != otherVideo.Refresh)
|
||||
return false;
|
||||
if (selfVideo.Screen != otherVideo.Screen)
|
||||
return false;
|
||||
if (selfVideo.Width != otherVideo.Width)
|
||||
if (!selfVideo.Equals(otherVideo))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
var video = new Data.Models.ClrMamePro.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
X = 12345,
|
||||
Y = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -452,7 +452,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.X);
|
||||
Assert.Equal(12345, video.Y);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -122,7 +122,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Tag = "tag",
|
||||
Type = Data.Models.Metadata.DisplayType.Vector,
|
||||
Rotate = "XXXXXX",
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
FlipX = true,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
@@ -139,7 +139,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
var video = new Data.Models.Listxml.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -554,7 +554,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
Assert.NotNull(display);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.Type);
|
||||
Assert.Equal("XXXXXX", display.Rotate);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal(true, display.FlipX);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(12345, display.Height);
|
||||
@@ -575,7 +575,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.Width);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Tag = "tag",
|
||||
Type = Data.Models.Metadata.DisplayType.Vector,
|
||||
Rotate = "XXXXXX",
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
FlipX = true,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
@@ -135,7 +135,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
var video = new Data.Models.Listxml.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -548,7 +548,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
Assert.NotNull(display);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.Type);
|
||||
Assert.Equal("XXXXXX", display.Rotate);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal(true, display.FlipX);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(12345, display.Height);
|
||||
@@ -569,7 +569,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.Width);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -118,7 +118,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Tag = "tag",
|
||||
Type = Data.Models.Metadata.DisplayType.Vector,
|
||||
Rotate = "XXXXXX",
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
FlipX = true,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
@@ -135,7 +135,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
var video = new Data.Models.Listxml.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -548,7 +548,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
Assert.NotNull(display);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.Type);
|
||||
Assert.Equal("XXXXXX", display.Rotate);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal(true, display.FlipX);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(12345, display.Height);
|
||||
@@ -569,7 +569,7 @@ namespace SabreTools.Serialization.CrossModel.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.Width);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -341,7 +341,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
var video = new Video
|
||||
{
|
||||
Screen = item.Screen,
|
||||
Orientation = item.ReadString(Data.Models.Metadata.Video.OrientationKey),
|
||||
Orientation = item.Orientation,
|
||||
X = item.Width,
|
||||
Y = item.Height,
|
||||
AspectX = item.AspectX,
|
||||
|
||||
@@ -354,7 +354,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
var video = new Data.Models.Metadata.Video
|
||||
{
|
||||
Screen = item.Screen,
|
||||
[Data.Models.Metadata.Video.OrientationKey] = item.Orientation,
|
||||
Orientation = item.Orientation,
|
||||
Width = item.X,
|
||||
Height = item.Y,
|
||||
AspectX = item.AspectX,
|
||||
|
||||
@@ -425,7 +425,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
{
|
||||
Tag = item.Tag,
|
||||
Type = item.DisplayType,
|
||||
Rotate = item.ReadString(Data.Models.Metadata.Display.RotateKey),
|
||||
Rotate = item.Rotate,
|
||||
FlipX = item.FlipX,
|
||||
Width = item.Width,
|
||||
Height = item.Height,
|
||||
@@ -659,7 +659,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
var video = new Video
|
||||
{
|
||||
Screen = item.Screen,
|
||||
Orientation = item.ReadString(Data.Models.Metadata.Video.OrientationKey),
|
||||
Orientation = item.Orientation,
|
||||
Width = item.Width,
|
||||
Height = item.Height,
|
||||
AspectX = item.AspectX,
|
||||
|
||||
@@ -463,7 +463,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
{
|
||||
Tag = item.Tag,
|
||||
DisplayType = item.Type,
|
||||
[Data.Models.Metadata.Display.RotateKey] = item.Rotate,
|
||||
Rotate = item.Rotate,
|
||||
FlipX = item.FlipX,
|
||||
Width = item.Width,
|
||||
Height = item.Height,
|
||||
@@ -700,7 +700,7 @@ namespace SabreTools.Serialization.CrossModel
|
||||
var video = new Data.Models.Metadata.Video
|
||||
{
|
||||
Screen = item.Screen,
|
||||
[Data.Models.Metadata.Video.OrientationKey] = item.Orientation,
|
||||
Orientation = item.Orientation,
|
||||
Width = item.Width,
|
||||
Height = item.Height,
|
||||
AspectX = item.AspectX,
|
||||
|
||||
@@ -282,7 +282,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
var video = new Data.Models.ClrMamePro.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
X = 12345,
|
||||
Y = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -569,7 +569,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.X);
|
||||
Assert.Equal(12345, video.Y);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -189,7 +189,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Tag = "tag",
|
||||
Type = Data.Models.Metadata.DisplayType.Vector,
|
||||
Rotate = "XXXXXX",
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
FlipX = true,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
@@ -206,7 +206,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
var video = new Data.Models.Listxml.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -621,7 +621,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
Assert.NotNull(display);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.Type);
|
||||
Assert.Equal("XXXXXX", display.Rotate);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal(true, display.FlipX);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(12345, display.Height);
|
||||
@@ -642,7 +642,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.Width);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Tag = "tag",
|
||||
Type = Data.Models.Metadata.DisplayType.Vector,
|
||||
Rotate = "XXXXXX",
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
FlipX = true,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
@@ -202,7 +202,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
var video = new Data.Models.Listxml.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -615,7 +615,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
Assert.NotNull(display);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.Type);
|
||||
Assert.Equal("XXXXXX", display.Rotate);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal(true, display.FlipX);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(12345, display.Height);
|
||||
@@ -636,7 +636,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.Width);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -185,7 +185,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Tag = "tag",
|
||||
Type = Data.Models.Metadata.DisplayType.Vector,
|
||||
Rotate = "XXXXXX",
|
||||
Rotate = Data.Models.Metadata.Rotation.East,
|
||||
FlipX = true,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
@@ -202,7 +202,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
var video = new Data.Models.Listxml.Video
|
||||
{
|
||||
Screen = Data.Models.Metadata.DisplayType.Vector,
|
||||
Orientation = "XXXXXX",
|
||||
Orientation = Data.Models.Metadata.Rotation.East,
|
||||
Width = 12345,
|
||||
Height = 12345,
|
||||
AspectX = 12345,
|
||||
@@ -615,7 +615,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
Assert.NotNull(display);
|
||||
Assert.Equal("tag", display.Tag);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, display.Type);
|
||||
Assert.Equal("XXXXXX", display.Rotate);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, display.Rotate);
|
||||
Assert.Equal(true, display.FlipX);
|
||||
Assert.Equal(12345, display.Width);
|
||||
Assert.Equal(12345, display.Height);
|
||||
@@ -636,7 +636,7 @@ namespace SabreTools.Serialization.Readers.Test
|
||||
{
|
||||
Assert.NotNull(video);
|
||||
Assert.Equal(Data.Models.Metadata.DisplayType.Vector, video.Screen);
|
||||
Assert.Equal("XXXXXX", video.Orientation);
|
||||
Assert.Equal(Data.Models.Metadata.Rotation.East, video.Orientation);
|
||||
Assert.Equal(12345, video.Width);
|
||||
Assert.Equal(12345, video.Height);
|
||||
Assert.Equal(12345, video.AspectX);
|
||||
|
||||
@@ -806,7 +806,7 @@ namespace SabreTools.Serialization.Readers
|
||||
video.Screen = kvp.Value.AsDisplayType();
|
||||
break;
|
||||
case "orientation":
|
||||
video.Orientation = kvp.Value;
|
||||
video.Orientation = kvp.Value.AsRotation();
|
||||
break;
|
||||
case "x":
|
||||
video.X = NumberHelper.ConvertToInt64(kvp.Value);
|
||||
|
||||
@@ -576,7 +576,7 @@ namespace SabreTools.Serialization.Readers
|
||||
|
||||
obj.Tag = reader.GetAttribute("tag");
|
||||
obj.Type = reader.GetAttribute("type").AsDisplayType();
|
||||
obj.Rotate = reader.GetAttribute("rotate");
|
||||
obj.Rotate = reader.GetAttribute("rotate").AsRotation();
|
||||
obj.FlipX = reader.GetAttribute("flipx").AsYesNo();
|
||||
obj.Width = NumberHelper.ConvertToInt64(reader.GetAttribute("width"));
|
||||
obj.Height = NumberHelper.ConvertToInt64(reader.GetAttribute("height"));
|
||||
@@ -1176,7 +1176,7 @@ namespace SabreTools.Serialization.Readers
|
||||
var obj = new Video();
|
||||
|
||||
obj.Screen = reader.GetAttribute("screen").AsDisplayType();
|
||||
obj.Orientation = reader.GetAttribute("orientation");
|
||||
obj.Orientation = reader.GetAttribute("orientation").AsRotation();
|
||||
obj.Width = NumberHelper.ConvertToInt64(reader.GetAttribute("width"));
|
||||
obj.Height = NumberHelper.ConvertToInt64(reader.GetAttribute("height"));
|
||||
obj.AspectX = NumberHelper.ConvertToInt64(reader.GetAttribute("aspectx"));
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace SabreTools.Serialization.Readers
|
||||
|
||||
obj.Tag = reader.GetAttribute("tag");
|
||||
obj.Type = reader.GetAttribute("type").AsDisplayType();
|
||||
obj.Rotate = reader.GetAttribute("rotate");
|
||||
obj.Rotate = reader.GetAttribute("rotate").AsRotation();
|
||||
obj.FlipX = reader.GetAttribute("flipx").AsYesNo();
|
||||
obj.Width = NumberHelper.ConvertToInt64(reader.GetAttribute("width"));
|
||||
obj.Height = NumberHelper.ConvertToInt64(reader.GetAttribute("height"));
|
||||
@@ -1174,7 +1174,7 @@ namespace SabreTools.Serialization.Readers
|
||||
var obj = new Video();
|
||||
|
||||
obj.Screen = reader.GetAttribute("screen").AsDisplayType();
|
||||
obj.Orientation = reader.GetAttribute("orientation");
|
||||
obj.Orientation = reader.GetAttribute("orientation").AsRotation();
|
||||
obj.Width = NumberHelper.ConvertToInt64(reader.GetAttribute("width"));
|
||||
obj.Height = NumberHelper.ConvertToInt64(reader.GetAttribute("height"));
|
||||
obj.AspectX = NumberHelper.ConvertToInt64(reader.GetAttribute("aspectx"));
|
||||
|
||||
@@ -574,7 +574,7 @@ namespace SabreTools.Serialization.Readers
|
||||
|
||||
obj.Tag = reader.GetAttribute("tag");
|
||||
obj.Type = reader.GetAttribute("type").AsDisplayType();
|
||||
obj.Rotate = reader.GetAttribute("rotate");
|
||||
obj.Rotate = reader.GetAttribute("rotate").AsRotation();
|
||||
obj.FlipX = reader.GetAttribute("flipx").AsYesNo();
|
||||
obj.Width = NumberHelper.ConvertToInt64(reader.GetAttribute("width"));
|
||||
obj.Height = NumberHelper.ConvertToInt64(reader.GetAttribute("height"));
|
||||
@@ -1174,7 +1174,7 @@ namespace SabreTools.Serialization.Readers
|
||||
var obj = new Video();
|
||||
|
||||
obj.Screen = reader.GetAttribute("screen").AsDisplayType();
|
||||
obj.Orientation = reader.GetAttribute("orientation");
|
||||
obj.Orientation = reader.GetAttribute("orientation").AsRotation();
|
||||
obj.Width = NumberHelper.ConvertToInt64(reader.GetAttribute("width"));
|
||||
obj.Height = NumberHelper.ConvertToInt64(reader.GetAttribute("height"));
|
||||
obj.AspectX = NumberHelper.ConvertToInt64(reader.GetAttribute("aspectx"));
|
||||
|
||||
@@ -413,7 +413,7 @@ namespace SabreTools.Serialization.Writers
|
||||
{
|
||||
writer.WriteStartElement("video");
|
||||
writer.WriteRequiredAttributeString("screen", video.Screen?.AsStringValue(), throwOnError: true);
|
||||
writer.WriteRequiredAttributeString("orientation", video.Orientation, throwOnError: true);
|
||||
writer.WriteRequiredAttributeString("orientation", video.Orientation?.AsStringValue(useSecond: true), throwOnError: true);
|
||||
writer.WriteOptionalAttributeString("x", video.X?.ToString());
|
||||
writer.WriteOptionalAttributeString("y", video.Y.ToString());
|
||||
writer.WriteOptionalAttributeString("aspectx", video.AspectX.ToString());
|
||||
|
||||
@@ -391,7 +391,7 @@ namespace SabreTools.Serialization.Writers
|
||||
|
||||
writer.WriteOptionalAttributeString("tag", obj.Tag);
|
||||
writer.WriteRequiredAttributeString("type", obj.Type?.AsStringValue());
|
||||
writer.WriteOptionalAttributeString("rotate", obj.Rotate);
|
||||
writer.WriteOptionalAttributeString("rotate", obj.Rotate?.AsStringValue(useSecond: false));
|
||||
writer.WriteOptionalAttributeString("flipx", obj.FlipX.FromYesNo());
|
||||
writer.WriteOptionalAttributeString("width", obj.Width?.ToString());
|
||||
writer.WriteOptionalAttributeString("height", obj.Height?.ToString());
|
||||
@@ -838,7 +838,7 @@ namespace SabreTools.Serialization.Writers
|
||||
writer.WriteStartElement("video");
|
||||
|
||||
writer.WriteRequiredAttributeString("screen", obj.Screen?.AsStringValue());
|
||||
writer.WriteRequiredAttributeString("orientation", obj.Orientation);
|
||||
writer.WriteRequiredAttributeString("orientation", obj.Orientation?.AsStringValue(useSecond: true));
|
||||
writer.WriteOptionalAttributeString("width", obj.Width.ToString());
|
||||
writer.WriteOptionalAttributeString("height", obj.Height.ToString());
|
||||
writer.WriteOptionalAttributeString("aspectx", obj.AspectX.ToString());
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace SabreTools.Serialization.Writers
|
||||
|
||||
writer.WriteOptionalAttributeString("tag", obj.Tag);
|
||||
writer.WriteRequiredAttributeString("type", obj.Type?.AsStringValue());
|
||||
writer.WriteOptionalAttributeString("rotate", obj.Rotate);
|
||||
writer.WriteOptionalAttributeString("rotate", obj.Rotate?.AsStringValue(useSecond: false));
|
||||
writer.WriteOptionalAttributeString("flipx", obj.FlipX.FromYesNo());
|
||||
writer.WriteOptionalAttributeString("width", obj.Width?.ToString());
|
||||
writer.WriteOptionalAttributeString("height", obj.Height?.ToString());
|
||||
@@ -836,7 +836,7 @@ namespace SabreTools.Serialization.Writers
|
||||
writer.WriteStartElement("video");
|
||||
|
||||
writer.WriteRequiredAttributeString("screen", obj.Screen?.AsStringValue());
|
||||
writer.WriteRequiredAttributeString("orientation", obj.Orientation);
|
||||
writer.WriteRequiredAttributeString("orientation", obj.Orientation?.AsStringValue(useSecond: true));
|
||||
writer.WriteOptionalAttributeString("width", obj.Width.ToString());
|
||||
writer.WriteOptionalAttributeString("height", obj.Height.ToString());
|
||||
writer.WriteOptionalAttributeString("aspectx", obj.AspectX.ToString());
|
||||
|
||||
@@ -389,7 +389,7 @@ namespace SabreTools.Serialization.Writers
|
||||
|
||||
writer.WriteOptionalAttributeString("tag", obj.Tag);
|
||||
writer.WriteRequiredAttributeString("type", obj.Type?.AsStringValue());
|
||||
writer.WriteOptionalAttributeString("rotate", obj.Rotate);
|
||||
writer.WriteOptionalAttributeString("rotate", obj.Rotate?.AsStringValue(useSecond: false));
|
||||
writer.WriteOptionalAttributeString("flipx", obj.FlipX.FromYesNo());
|
||||
writer.WriteOptionalAttributeString("width", obj.Width?.ToString());
|
||||
writer.WriteOptionalAttributeString("height", obj.Height?.ToString());
|
||||
@@ -836,7 +836,7 @@ namespace SabreTools.Serialization.Writers
|
||||
writer.WriteStartElement("video");
|
||||
|
||||
writer.WriteRequiredAttributeString("screen", obj.Screen?.AsStringValue());
|
||||
writer.WriteRequiredAttributeString("orientation", obj.Orientation);
|
||||
writer.WriteRequiredAttributeString("orientation", obj.Orientation?.AsStringValue(useSecond: true));
|
||||
writer.WriteOptionalAttributeString("width", obj.Width.ToString());
|
||||
writer.WriteOptionalAttributeString("height", obj.Height.ToString());
|
||||
writer.WriteOptionalAttributeString("aspectx", obj.AspectX.ToString());
|
||||
|
||||
Reference in New Issue
Block a user