You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
21 lines
476 B
21 lines
476 B
using System;
|
|
|
|
namespace EasyBL
|
|
{
|
|
public class FileService
|
|
{
|
|
public static string ToKMGTByte(string file_size)
|
|
{
|
|
string[] suffixes = { "B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB" };
|
|
var s = 0;
|
|
var size = Convert.ToInt64(file_size);
|
|
|
|
while (size >= 1024)
|
|
{
|
|
s++;
|
|
size /= 1024;
|
|
}
|
|
return $"{size}{suffixes[s]}";
|
|
}
|
|
}
|
|
}
|