public string FormatFileSize(long size)
{
if(size > 1073741824)
{
return String.Format("{0:#,##0.0} GB", size / 1073741824.0);
}
else if(size > 1048576)
{
return String.Format("{0:#,##0.0} MB", size / 1048576.0);
}
else if(size > 1024)
{
return String.Format("{0:#,##0.0} kB", size / 1024.0);
}
else
{
return String.Format("{0:#,##0} B", size);
}
}