Ein Quick&Dirty hack in C#:
Code:
public string SizeString
{
get
{
float size = FileSize;
int divs = 0;
while (size > 1024)
{
size /= 1024;
divs++;
}
string
unit;
switch (divs)
{
case 0:
unit = " Byte"; break;
case 1:
unit = " KB"; break;
case 2:
unit = " MB"; break;
case 3:
unit = " GB"; break;
default:
unit = ""; break;
}
return (string.Format("{0:F2}",size) +
unit);
}
}
Ist aber recht flott zu übersetzen