/// <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))); }
/// <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)) { }
public override string ToString() { return(ToxTools.HexBinToString(_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 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)) { }
public override string ToString() => ToxTools.HexBinToString(id);
/// <summary> /// Retrieves a string of the tox key. /// </summary> /// <returns></returns> public string GetString() { return(ToxTools.HexBinToString(_key)); }
/// <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); }
public static bool IsValid(string id) { return(IsValid(ToxTools.StringToHexBin(id))); }
/// <summary> /// Retrieves a string of the tox key. /// </summary> /// <returns></returns> public string GetString() => ToxTools.HexBinToString(key);
/// <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)) { }