UID: Remove deprecated members

This commit is contained in:
Frederik Carlier
2019-06-12 14:49:23 +02:00
parent bdbce8d547
commit ee4f4728be
2 changed files with 0 additions and 123 deletions

View File

@@ -52,20 +52,6 @@ namespace plistcil.test
Assert.Equal(new byte[] {0xAB, 0xCD, 0xEF, 0x00, 0x00, 0xEF, 0xCD, 0xAB}, uid.Bytes); Assert.Equal(new byte[] {0xAB, 0xCD, 0xEF, 0x00, 0x00, 0xEF, 0xCD, 0xAB}, uid.Bytes);
} }
[Fact]
public void SByteUidTest()
{
UID uid = new UID("test", (sbyte)0x0F);
Assert.Equal(new byte[] {0x0F}, uid.Bytes);
}
[Fact]
public void ShortUidTest()
{
UID uid = new UID("test", (short)0x0F0F);
Assert.Equal(new byte[] {0x0F, 0x0F}, uid.Bytes);
}
[Fact] [Fact]
public void UIntUidTest() public void UIntUidTest()
{ {

View File

@@ -38,20 +38,6 @@ namespace Claunia.PropertyList
{ {
readonly ulong value; readonly ulong value;
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="bytes">Bytes.</param>
[Obsolete("UIDs have not meaningful names")]
public UID(string name, ReadOnlySpan<byte> bytes)
{
if(bytes.Length != 1 && bytes.Length != 2 && bytes.Length != 4 && bytes.Length != 8)
throw new ArgumentException("Type argument is not valid.");
value = (ulong)BinaryPropertyListParser.ParseLong(bytes);
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class. /// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class.
/// </summary> /// </summary>
@@ -64,17 +50,6 @@ namespace Claunia.PropertyList
value = (ulong)BinaryPropertyListParser.ParseLong(bytes); value = (ulong)BinaryPropertyListParser.ParseLong(bytes);
} }
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 8-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Unsigned 8-bit number.</param>
[Obsolete("UIDs have no meaningful names")]
public UID(string name, byte number)
{
value = number;
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 8-bit number. /// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 8-bit number.
/// </summary> /// </summary>
@@ -84,28 +59,6 @@ namespace Claunia.PropertyList
value = number; value = number;
} }
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using a signed 8-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Unsigned 8-bit number.</param>
[Obsolete("UIDs must be unsigned values")]
public UID(string name, sbyte number)
{
value = (ulong)number;
}
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 16-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Unsigned 16-bit number.</param>
[Obsolete("UIDs have no meaningful names")]
public UID(string name, ushort number)
{
value = number;
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 16-bit number. /// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 16-bit number.
/// </summary> /// </summary>
@@ -116,28 +69,6 @@ namespace Claunia.PropertyList
value = number; value = number;
} }
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using a signed 16-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Signed 16-bit number.</param>
[Obsolete("UIDs must be unsigned values")]
public UID(string name, short number)
{
value = (ulong)number;
}
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 32-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Unsigned 32-bit number.</param>
[Obsolete("UIDs have no meaningful names")]
public UID(string name, uint number)
{
value = number;
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 32-bit number. /// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 32-bit number.
/// </summary> /// </summary>
@@ -147,28 +78,6 @@ namespace Claunia.PropertyList
value = number; value = number;
} }
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using a signed 32-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Signed 32-bit number.</param>
[Obsolete("UIDs must be unsigned values")]
public UID(string name, int number)
{
value = (ulong)number;
}
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 64-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Unsigned 64-bit number.</param>
[Obsolete("UIDs have no meaningful names")]
public UID(string name, ulong number)
{
value = number;
}
/// <summary> /// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 64-bit number. /// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using an unsigned 64-bit number.
/// </summary> /// </summary>
@@ -178,17 +87,6 @@ namespace Claunia.PropertyList
value = number; value = number;
} }
/// <summary>
/// Initializes a new instance of the <see cref="Claunia.PropertyList.UID" /> class using a signed 64-bit number.
/// </summary>
/// <param name="name">Name.</param>
/// <param name="number">Signed 64-bit number.</param>
[Obsolete("UIDs must be unsigned values")]
public UID(string name, long number)
{
value = (ulong)number;
}
/// <summary> /// <summary>
/// Gets the bytes. /// Gets the bytes.
/// </summary> /// </summary>
@@ -219,13 +117,6 @@ namespace Claunia.PropertyList
} }
} }
/// <summary>
/// Gets the name.
/// </summary>
/// <value>The name.</value>
[Obsolete("UIDs have no meaningful names")]
public string Name => value.ToString();
/// <summary> /// <summary>
/// Writes the bytes required to represent this <see cref="UID" /> to a byte span. /// Writes the bytes required to represent this <see cref="UID" /> to a byte span.
/// </summary> /// </summary>