Added byte converter and fixed memory view at the nodes
This commit is contained in:
56
Moonlight/App/Helpers/ByteSizeValue.cs
Normal file
56
Moonlight/App/Helpers/ByteSizeValue.cs
Normal file
@@ -0,0 +1,56 @@
|
|||||||
|
namespace Moonlight.App.Helpers;
|
||||||
|
|
||||||
|
public class ByteSizeValue
|
||||||
|
{
|
||||||
|
public long Bytes { get; set; }
|
||||||
|
|
||||||
|
public long KiloBytes
|
||||||
|
{
|
||||||
|
get => Bytes / 1024;
|
||||||
|
set => Bytes = value * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long MegaBytes
|
||||||
|
{
|
||||||
|
get => KiloBytes / 1024;
|
||||||
|
set => KiloBytes = value * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
public long GigaBytes
|
||||||
|
{
|
||||||
|
get => MegaBytes / 1024;
|
||||||
|
set => MegaBytes = value * 1024;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ByteSizeValue FromBytes(long bytes)
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
Bytes = bytes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ByteSizeValue FromKiloBytes(long kiloBytes)
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
KiloBytes = kiloBytes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ByteSizeValue FromMegaBytes(long megaBytes)
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
MegaBytes = megaBytes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ByteSizeValue FromGigaBytes(long gigaBytes)
|
||||||
|
{
|
||||||
|
return new()
|
||||||
|
{
|
||||||
|
GigaBytes = gigaBytes
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -88,7 +88,7 @@ else
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
<span>
|
<span>
|
||||||
@(Formatter.FormatSize(MemoryMetrics.Used)) <TL>of</TL> @(Formatter.FormatSize(MemoryMetrics.Total)) <TL>memory used</TL>
|
@(Formatter.FormatSize(ByteSizeValue.FromKiloBytes(MemoryMetrics.Used).Bytes)) <TL>of</TL> @(Formatter.FormatSize(ByteSizeValue.FromKiloBytes(MemoryMetrics.Total).Bytes)) <TL>memory used</TL>
|
||||||
</span>
|
</span>
|
||||||
}
|
}
|
||||||
</span>
|
</span>
|
||||||
|
|||||||
Reference in New Issue
Block a user