Exemple #1
0
 /// <summary>
 /// Creates an <see cref="Identicon"/> instance from a hexadecimal hash string.
 /// </summary>
 /// <param name="hash">The hex encoded hash that will be used as base for the icon. The hash string must contain at least 12 characters.</param>
 /// <param name="size">The size of the icon in pixels (the icon is quadratic).</param>
 /// <exception cref="ArgumentException"><paramref name="hash"/> does not contain 6 bytes.</exception>
 /// <exception cref="ArgumentNullException"><paramref name="hash"/> is null.</exception>
 /// <exception cref="ArgumentOutOfRangeException"><paramref name="size"/> is less than 1 pixel.</exception>
 /// <exception cref="FormatException"><paramref name="hash"/> is not a hexadecimal string.</exception>
 /// <returns>An <see cref="Identicon"/> instance for the specified hash.</returns>
 public static Identicon FromHash(string hash, int size)
 {
     if (hash == null)
     {
         throw new ArgumentNullException(nameof(hash));
     }
     return(new Identicon(HexString.ToArray(hash), size));
 }
Exemple #2
0
 /// <summary>
 /// Creates an <see cref="Identicon"/> instance with the specified hash.
 /// </summary>
 /// <param name="hash">The hash that will be used as base for this icon. The hash must contain at least 11 bytes.</param>
 public static Identicon FromHash(string hash)
 {
     return(new Identicon(HexString.ToArray(hash)));
 }