Ejemplo n.º 1
0
        /// <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());
        }
Ejemplo n.º 2
0
        /// <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());
        }