/// <summary>/// 十进制正整数转换成六十二进制/// </summary>/// <param name="Number">需要转换的数字Int64格式,不能为负数</param>/// <param name="toBase">转换基数,必须是2至62以内</param>/// <returns>自定义的进制字符串</returns>public static String toDectoStr62(Int64 Number, Int32 toBase){ String str62 = "", Digits62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; Int64 result = Number; if (Number > 0) { while (result > 0) { Int32 val = toInt32(result % toBase); str62 = String.Format("{0}{1}", Digits62[val], str62); result = (Int64)(result / toBase); } return str62; } return "0";}/// <summary>/// 六十二进制转换成十进制正整数/// </summary>/// <param name="str62">自定义的进制字符串</param>/// <param name="toBase">转换基数,必须是2至62以内</param>/// <returns>返回Int64</returns>public static Int64 toDectoStr62(String str62, Int32 toBase){ String Digits62 = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"; int length = str62.Length; Int64 result = 0; for (int i = 0; i < length; i++) { Int64 val = (Int64)Math.Pow(toBase, (length - i - 1)); Int64 tmp = Digits62.IndexOf(str62[i]); result += tmp * val; } return result;}