| | |
| | | using System.Collections.Generic; |
| | | using System.Configuration; |
| | | using System.Data.Common; |
| | | using System.IO; |
| | | using System.Linq; |
| | | using System.Reflection; |
| | | using System.Runtime.InteropServices.ComTypes; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | using System.Windows; |
| | |
| | | public static string Uname = ""; |
| | | |
| | | public static string Token = ""; |
| | | |
| | | public static char[] HEX_DIGITS = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; |
| | | |
| | | public static string FormatBytes(long bytes) |
| | | { |
| | |
| | | |
| | | return list; |
| | | } |
| | | |
| | | /*//2a0befb05146cd30213ee4b95038aca0 |
| | | public static String getFileMd5(String filePath) |
| | | { |
| | | FileStream fis = null; |
| | | try |
| | | { |
| | | MessageDigest md = MessageDigest.getInstance("MD5"); |
| | | |
| | | fis = new FileStream(new File(filePath)); |
| | | FileChannel fChannel = fis.getChannel(); |
| | | Byte[] buffer =new Byte[1024 * 1024]; |
| | | |
| | | while (fChannel.read(buffer) != -1) |
| | | { |
| | | buffer.flip(); |
| | | md.update(buffer); |
| | | buffer.compact(); |
| | | } |
| | | byte[] b = md.digest(); |
| | | |
| | | return byteToHexString(b); |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | return null; |
| | | } |
| | | finally |
| | | { |
| | | try |
| | | { |
| | | if (null != fis) |
| | | { |
| | | fis.Dispose(); |
| | | } |
| | | } |
| | | catch (Exception ex) |
| | | { |
| | | // |
| | | } |
| | | } |
| | | } |
| | | |
| | | public static String byteToHexString(byte[] tmp) |
| | | { |
| | | // 每个字节用 16 进制表示的话,使用两个字符, |
| | | char[] str = new char[16 * 2]; |
| | | |
| | | int k = 0; |
| | | for (int i = 0; i < 16; i++) |
| | | { |
| | | // 转换成 16 进制字符的转换 |
| | | byte byte0 = tmp[i]; |
| | | |
| | | // 取字节中高 4 位的数字转换 |
| | | str[k++] = HEX_DIGITS[byte0 >> 4 & 0xf]; |
| | | |
| | | // >>> 为逻辑右移,将符号位一起右移, 取字节中低 4 位的数字转换 |
| | | str[k++] = HEX_DIGITS[byte0 & 0xf]; |
| | | } |
| | | |
| | | return new String(str); |
| | | }*/ |
| | | } |
| | | } |