| | |
| | | using System.Net.Sockets; |
| | | using System.Net; |
| | | using System.Reflection; |
| | | using System.Text; |
| | | using System.Threading.Tasks; |
| | | |
| | | namespace DataLoader.CS |
| | | { |
| | |
| | | /// </summary> |
| | | public static string FormatBytes(long bytes) |
| | | { |
| | | string[] Suffix = { "Byte", "KB", "MB", "GB", "TB" }; |
| | | string[] Suffix = { "B", "KB", "MB", "GB", "TB" }; // Byte |
| | | |
| | | int i = 0; |
| | | double dblSByte = bytes; |
| | |
| | | for (i = 0; (bytes / 1024) > 0; i++, bytes /= 1024) |
| | | dblSByte = bytes / 1024.0; |
| | | |
| | | return String.Format("{0:0.##}{1}", dblSByte, Suffix[i]); |
| | | return string.Format("{0:0.##} {1}", dblSByte, Suffix[i]); |
| | | } |
| | | |
| | | /// <summary> |
| | |
| | | return 0.001; |
| | | } |
| | | |
| | | String str = string.Format("{0:F3}", size / 1024.0 / 1024.0); |
| | | string str = string.Format("{0:F3}", size / 1024.0 / 1024.0); |
| | | |
| | | return Double.Parse(str); |
| | | return double.Parse(str); |
| | | } |
| | | |
| | | /// <summary> |
| | | /// 保留3位小数 |
| | | /// </summary> |
| | | public static double Round3(double val) |
| | | { |
| | | string str = string.Format("{0:F3}", val); |
| | | |
| | | return double.Parse(str); |
| | | } |
| | | |
| | | /// <summary> |