/// <summary> /// Initializes a new instance of the <see cref="INTV.Core.Model.RomMetadataDate"/> class. /// </summary> /// <param name="length">Length of the payload in bytes.</param> /// <param name="type">The specific kind of metadata in the block.</param> public RomMetadataDate(uint length, RomMetadataIdTag type) : base(length, type) { switch (type) { case RomMetadataIdTag.BuildDate: case RomMetadataIdTag.ReleaseDate: break; default: throw new InvalidOperationException(string.Format(Resources.Strings.RomMetadataDate_InvalidMetadataIdFormat, type)); } Date = MetadataDateTime.MinValue; }
public void CfgVarMetadataIdTag_ConvertToRomMetadataIdTag_ProducesExpectedRomMetadataIdTag(CfgVarMetadataIdTag idTag, RomMetadataIdTag expectedRomMetadataIdTag, FeatureCategory expectedFeatureCategory, CfgVarMetadataIdTag expectedUnsupportedMetadataValue) { CfgVarMetadataIdTag actualUnsupportedMetadataValue; FeatureCategory actualFeatureCategory; var actualRomMetadataIdTag = idTag.ToRomMetadataIdTag(out actualFeatureCategory, out actualUnsupportedMetadataValue); Assert.Equal(expectedRomMetadataIdTag, actualRomMetadataIdTag); }
public static System.IO.MemoryStream CreatePseudoMetadata(byte payloadLength, RomMetadataIdTag payloadType, byte[] payloadData) { var stream = new System.IO.MemoryStream(); var data = new List <byte>() { payloadLength, (byte)payloadType }; if (payloadData != null) { data.AddRange(payloadData); } var crc16 = Crc16.OfBlock(data.ToArray(), Crc16.InitialValue); var crcByte = (byte)((crc16 & (ushort)0xFF00) >> 8); data.Add(crcByte); crcByte = (byte)(crc16 & 0xFF); data.Add(crcByte); stream.Write(data.ToArray(), 0, data.Count); stream.Seek(0, System.IO.SeekOrigin.Begin); return(stream); }
public RomMetadataTestBlock(uint length, RomMetadataIdTag type) : base(length, type) { }
/// <summary> /// Initializes a new instance of the <see cref="INTV.Core.Model.RomMetadataBlock"/> class. /// </summary> /// <param name="length">The length (in bytes) of the payload.</param> /// <param name="type">The specific kind of metadata in the block.</param> protected RomMetadataBlock(uint length, RomMetadataIdTag type) { Length = length; Type = type; }
/// <summary> /// Initializes a new instance of the <see cref="INTV.Core.Model.RomMetadataString"/> class. /// </summary> /// <param name="length">Length of the string in the metadata block.</param> /// <param name="type">The specific kind of string metadata.</param> public RomMetadataString(uint length, RomMetadataIdTag type) : base(length, type) { }