Netcode Bootstrap
This commit is contained in:
@@ -0,0 +1,22 @@
|
||||
|
||||
/////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
namespace Rukhanka.Toolbox
|
||||
{
|
||||
public static class CommonTools
|
||||
{
|
||||
public static string FormatMemory(long mem)
|
||||
{
|
||||
float floatMem = mem;
|
||||
string[] suffixes = {"B", "KB", "MB", "GB", "TB"};
|
||||
var suffixIndex = 0;
|
||||
while (floatMem > 1024.0f)
|
||||
{
|
||||
++suffixIndex;
|
||||
floatMem /= 1024.0f;
|
||||
}
|
||||
|
||||
return $"{floatMem:F2}{suffixes[suffixIndex]}";
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user