Ejemplo n.º 1
0
		/// <summary>
		/// Returns BigInteger as System.UInt64 if possible.
		/// </summary>
		/// <param name="value"></param>
		/// <returns></returns>
		/// <exception cref="System.Exception">When BigInteger is too large to fit into System.UInt64</exception>
		public static ulong ToUInt64(BigInteger value)
		{
			if (object.ReferenceEquals(value, null))
			{
				throw new ArgumentNullException("value");
			}
			return System.UInt64.Parse(value.ToString(), System.Globalization.NumberStyles.Integer, System.Globalization.CultureInfo.CurrentCulture);
		}
Ejemplo n.º 2
0
 /// <summary>
 /// Converts Hexadecimal EPC into reversed B36 encoded string
 /// </summary>
 /// <param name="hex"></param>
 /// <returns></returns>
 public static String ConvertHexToBase36(String hex)
 {
     if (hex.Length > 0)
     {
         BigInteger big = new BigInteger(hex.ToUpper(), 16);
         StringBuilder sb = new StringBuilder(big.ToString(36));
         char[] charArray = sb.ToString().ToCharArray();
         Array.Reverse(charArray);
         return new string(charArray).ToUpper();
     }
     else
     {
         return string.Empty;
     }
 }