/// <summary>Return clientId as byte[]</summary> public static byte[] GetClientId() { UUID uuid = UUID.RandomUUID(); ByteBuffer buf = ByteBuffer.Wrap(new byte[ByteLength]); buf.PutLong(uuid.GetMostSignificantBits()); buf.PutLong(uuid.GetLeastSignificantBits()); return((byte[])buf.Array()); }
/// <summary>Convert from clientId string byte[] representation of clientId</summary> public static byte[] ToBytes(string id) { if (id == null || string.Empty.Equals(id)) { return(new byte[0]); } UUID uuid = UUID.FromString(id); ByteBuffer buf = ByteBuffer.Wrap(new byte[ByteLength]); buf.PutLong(uuid.GetMostSignificantBits()); buf.PutLong(uuid.GetLeastSignificantBits()); return((byte[])buf.Array()); }