12345678910111213141516171819202122232425262728293031323334 |
- namespace Plugins.CxShine.Unit
- {
- public class UnitDisplay
- {
- public static string KMGTP(long unit)
- {
- if (unit > 10000000000) return $"{unit / 1000000000.0:N0}G";
- if (unit > 10000000) return $"{unit / 1000000.0:N0}M";
- if (unit > 10000) return $"{unit / 1000.0:N0}K";
- return unit + "";
- }
- public static long GetMin(long[] numbers)
- {
- var min = numbers[0];
- for (var i = 0; i < numbers.Length; i++)
- if (min > numbers[i])
- min = numbers[i];
- return min;
- }
- public static long GetMax(long[] numbers)
- {
- var max = numbers[0];
- for (var i = 0; i < numbers.Length; i++)
- if (max < numbers[i])
- max = numbers[i];
- return max;
- }
- }
- }
|