1string GetReadableFileSize(long fileSize) {
2 long s = size;
3 string[] format = new string[] { "{0} bytes", "{0} KB", "{0} MB", "{0} GB", "{0} TB", "{0} PB", "{0} EB", "{0} ZB", "{0} YB" };
4 int i = 0;
5 while (i < format.Length - 1 && s >= 1024) {
6 s = (long)((long)100 * s / (long)1024) / (long)100.0;
7 i++;
8
9 }
10 return string.Format(format[i], s.ToString("###,###,###.##"));
11 }