static string MyFileSizeReadable(double bytes)
{
double converted = bytes;
string units = "B";
if (bytes >= ONE_TERABYTE)
{
converted = bytes / ONE_TERABYTE;
units = "TB";
}
else if (bytes >= ONE_GIGABYTE)
{
converted = bytes / ONE_GIGABYTE;
units = "GB";
}
else if (bytes >= ONE_MEGABYTE)
{
converted = bytes / ONE_MEGABYTE;
units = "MB";
}
else if (bytes >= ONE_KILOBYTE)
{
converted = bytes / ONE_KILOBYTE;
units = "KB";
}
return String.Format("{0:0.##} {1}", converted, units);
}