15 lines
233 B
Text
15 lines
233 B
Text
@model long
|
|
|
|
@{
|
|
string[] suffixes = {"", "K", "M", "G", "T", "P"};
|
|
double x = @Model;
|
|
int i = 0;
|
|
while (x > 1024) {
|
|
x = x / 1024.0;
|
|
i++;
|
|
}
|
|
if (i == 0){
|
|
<span>@x bytes</span>
|
|
} else {
|
|
<span>@x @suffixes[i]iB</span>
|
|
}}
|