mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 11:04:26 +00:00
Merge pull request #58 from quamotion/fixes/uid-touint64
Add UID.ToUInt64() method
This commit is contained in:
@@ -36,6 +36,7 @@ namespace plistcil.test
|
||||
{
|
||||
UID uid = new UID(0xAB);
|
||||
Assert.Equal(new byte[] {0xAB}, uid.Bytes);
|
||||
Assert.Equal(0xABu, uid.ToUInt64());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -43,6 +44,7 @@ namespace plistcil.test
|
||||
{
|
||||
UID uid = new UID(0xABCDEF00);
|
||||
Assert.Equal(new byte[] {0xAB, 0xCD, 0xEF, 0x00}, uid.Bytes);
|
||||
Assert.Equal(0xABCDEF00, uid.ToUInt64());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -50,6 +52,7 @@ namespace plistcil.test
|
||||
{
|
||||
UID uid = new UID(0xABCDEF0000EFCDAB);
|
||||
Assert.Equal(new byte[] {0xAB, 0xCD, 0xEF, 0x00, 0x00, 0xEF, 0xCD, 0xAB}, uid.Bytes);
|
||||
Assert.Equal(0xABCDEF0000EFCDAB, uid.ToUInt64());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -57,6 +60,7 @@ namespace plistcil.test
|
||||
{
|
||||
UID uid = new UID(0xABCDEF00u);
|
||||
Assert.Equal(new byte[] {0xAB, 0xCD, 0xEF, 0x00}, uid.Bytes);
|
||||
Assert.Equal(0xABCDEF00u, uid.ToUInt64());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -64,6 +68,7 @@ namespace plistcil.test
|
||||
{
|
||||
UID uid = new UID(0xABCDEF0000EFCDABu);
|
||||
Assert.Equal(new byte[] {0xAB, 0xCD, 0xEF, 0x00, 0x00, 0xEF, 0xCD, 0xAB}, uid.Bytes);
|
||||
Assert.Equal(0xABCDEF0000EFCDABu, uid.ToUInt64());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
@@ -71,6 +76,7 @@ namespace plistcil.test
|
||||
{
|
||||
UID uid = new UID(0xABCDu);
|
||||
Assert.Equal(new byte[] {0xAB, 0xCD}, uid.Bytes);
|
||||
Assert.Equal(0xABCDu, uid.ToUInt64());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
||||
@@ -224,5 +224,16 @@ namespace Claunia.PropertyList
|
||||
{
|
||||
return $"{value} (UID)";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a <see cref="ulong"/> which represents this <see cref="UID"/>.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// A <see cref="ulong"/> which represents this <see cref="UID"/>.
|
||||
/// </returns>
|
||||
public ulong ToUInt64()
|
||||
{
|
||||
return this.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user