StringToHexBin() static private method

static private StringToHexBin ( string s ) : byte[]
s string
return byte[]
Beispiel #1
0
        /// <summary>
        /// Checks whether or not the given Tox ID is valid.
        /// </summary>
        /// <param name="id">A (ToxConstant.AddressSize * 2) character long hexadecimal string, containing a Tox ID.</param>
        /// <returns>True if the ID is valid, false if the ID is invalid.</returns>
        public static bool IsValid(string id)
        {
            if (!ToxTools.ValidHexString(id))
            {
                return(false);
            }

            return(IsValid(ToxTools.StringToHexBin(id)));
        }
Beispiel #2
0
        /// <summary>
        /// Checks whether or not the given Tox ID is valid.
        /// </summary>
        /// <param name="id">A (ToxConstant.AddressSize * 2) character long hexadecimal string, containing a Tox ID.</param>
        /// <returns>True if the ID is valid, false if the ID is invalid.</returns>
        public static bool IsValid(string id)
        {
            if (string.IsNullOrEmpty(id))
            {
                return(false);
            }

            byte[] bytes = null;

            try { bytes = ToxTools.StringToHexBin(id); }
            catch { return(false); }

            return(IsValid(bytes));
        }
Beispiel #3
0
 /// <summary>
 /// Initializes a new instance of the ToxId class.
 /// </summary>
 /// <param name="id">A (ToxConstant.AddressSize * 2) character long hexadecimal string, containing a Tox ID.</param>
 public ToxId(string id)
     : this(ToxTools.StringToHexBin(id))
 {
 }
Beispiel #4
0
 /// <summary>
 /// Creates a new tox id with the specified public key and nospam.
 /// </summary>
 /// <param name="publicKey">Public key to create this Tox ID with.</param>
 /// <param name="nospam">Nospam value to create this Tox ID with.</param>
 public ToxId(string publicKey, int nospam)
     : this(ToxTools.StringToHexBin(publicKey), nospam)
 {
 }
Beispiel #5
0
 /// <summary>
 /// Initializes a new instance of the ToxId class.
 /// </summary>
 /// <param name="id">A (ToxConstant.AddressSize * 2) character long hexadecimal string, containing a Tox ID.</param>
 public ToxId([NotNull] string id)
     : this(ToxTools.StringToHexBin(id))
 {
 }
Beispiel #6
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ToxKey"/> class
 /// </summary>
 /// <param name="type"></param>
 /// <param name="key"></param>
 public ToxKey(ToxKeyType type, string key)
 {
     KeyType = type;
     _key    = ToxTools.StringToHexBin(key);
 }
Beispiel #7
0
 public static bool IsValid(string id)
 {
     return(IsValid(ToxTools.StringToHexBin(id)));
 }
Beispiel #8
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ToxKey"/> class
 /// </summary>
 /// <param name="type"></param>
 /// <param name="key"></param>
 public ToxKey(ToxKeyType type, [NotNull] string key) : this(type, ToxTools.StringToHexBin(key))
 {
 }