From 22fbc6afa5e6ae26cfbd28e2826566d20100752e Mon Sep 17 00:00:00 2001 From: Frederik Carlier Date: Tue, 19 Jun 2018 17:13:34 +0200 Subject: [PATCH] Fix serialization of UID values --- plist-cil/UID.cs | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/plist-cil/UID.cs b/plist-cil/UID.cs index c8b4099..665bc77 100644 --- a/plist-cil/UID.cs +++ b/plist-cil/UID.cs @@ -265,6 +265,7 @@ namespace Claunia.PropertyList Indent(xml, level); xml.Append(""); Span bytes = stackalloc byte[this.length]; + this.GetBytes(bytes); foreach (byte b in bytes) xml.Append(String.Format("{0:x2}", b)); xml.Append(""); @@ -274,6 +275,7 @@ namespace Claunia.PropertyList { outPlist.Write(0x80 + this.length - 1); Span bytes = stackalloc byte[this.length]; + this.GetBytes(bytes); outPlist.Write(bytes); } @@ -282,6 +284,7 @@ namespace Claunia.PropertyList Indent(ascii, level); ascii.Append("\""); Span bytes = stackalloc byte[this.length]; + this.GetBytes(bytes); foreach (byte b in bytes) ascii.Append(String.Format("{0:x2}", b)); ascii.Append("\""); @@ -299,6 +302,12 @@ namespace Claunia.PropertyList /// true if the specified is equal to the current /// ; otherwise, false. public override bool Equals(NSObject obj) + { + return Equals((object)obj); + } + + /// + public override bool Equals(object obj) { var uid = obj as UID; @@ -309,6 +318,13 @@ namespace Claunia.PropertyList && uid.length == length && uid.value == value; } + +#if HAS_HASHCODE + public override int GetHashCode() + { + return HashCode.Combine(this.name, this.length, this.value); + } +#endif } }