/// <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)); }
/// <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)) { }
/// <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) { }
/// <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); }