管道基础大数据平台系统开发-【CS】-ExportMap
1
13693261870
2023-01-01 70103f344de2c7fe3971ba13d7cd688dee2fb63b
DataLoader/Model/Tool.cs
@@ -79,67 +79,16 @@
            return list;
        }
        /*//2a0befb05146cd30213ee4b95038aca0
        public static String getFileMd5(String filePath)
        public static double SizeToMb(long size)
        {
            FileStream fis = null;
            try
            if (size < 1050)
            {
                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);
                return 0.001;
            }
            catch (Exception ex)
            {
                return null;
            }
            finally
            {
                try
                {
                    if (null != fis)
                    {
                        fis.Dispose();
                    }
                }
                catch (Exception ex)
                {
                    //
                }
            }
            String str = string.Format("{0:F3}", size / 1024.0 / 1024.0);
            return Double.Parse(str);
        }
        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);
        }*/
    }
}