Fixes naming of byte data types and functions

This commit is contained in:
Christian Stein 2020-02-04 09:33:27 +01:00
parent 499af2b92e
commit 80975bee24
5 changed files with 90 additions and 90 deletions

View file

@ -42,10 +42,10 @@ For performance metrics you can provide a `Unit` to ensure your graphing is disp
| ms | Milliseconds | The input is indicated as time in milliseconds |
| us | Microseconds | The input is indicated as time in microseconds |
| B | Bytes | The input is indicated as quantity in bytes |
| KB | Kilobytes | The input is indicated as quantity in kilobytes |
| MB | Megabytes | The input is indicated as quantity in megabytes |
| GB | Gigabytes | The input is indicated as quantity in gigabytes |
| TB | Terabytes | The input is indicated as quantity in terabytes |
| KB | Kilobytes | The input is indicated as quantity in Kilobytes |
| MB | Megabytes | The input is indicated as quantity in Megabytes |
| GB | Gigabytes | The input is indicated as quantity in Gigabytes |
| TB | Terabytes | The input is indicated as quantity in Terabytes |
| c | Counter | A continues counter increasing values over time |
## Object Functions

View file

@ -17,16 +17,16 @@ function Convert-Bytes()
switch ($Unit) {
{ 'B' -contains $_} { $FinalValue = $CurrentValue; $boolOption = $true;}
{ 'KB' -contains $_} { $FinalValue = ConvertTo-KiloByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'MB' -contains $_} { $FinalValue = ConvertTo-MegaByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'GB' -contains $_} { $FinalValue = ConvertTo-GigaByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'TB' -contains $_} { $FinalValue = ConvertTo-TeraByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'PB' -contains $_} { $FinalValue = ConvertTo-PetaByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'KiB' -contains $_} { $FinalValue = ConvertTo-KiBByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'MiB' -contains $_} { $FinalValue = ConvertTo-MiBByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'GiB' -contains $_} { $FinalValue = ConvertTo-GiBByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'TiB' -contains $_} { $FinalValue = ConvertTo-TiBByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'PiB' -contains $_} { $FinalValue = ConvertTo-PetaByte $CurrentValue -Unit B; $boolOption = $true;}
{ 'KB' -contains $_} { $FinalValue = ConvertTo-Kilobyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'MB' -contains $_} { $FinalValue = ConvertTo-Megabyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'GB' -contains $_} { $FinalValue = ConvertTo-Gigabyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'TB' -contains $_} { $FinalValue = ConvertTo-Terabyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'PB' -contains $_} { $FinalValue = ConvertTo-Petabyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'KiB' -contains $_} { $FinalValue = ConvertTo-Kibibyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'MiB' -contains $_} { $FinalValue = ConvertTo-Mebibyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'GiB' -contains $_} { $FinalValue = ConvertTo-Gibibyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'TiB' -contains $_} { $FinalValue = ConvertTo-Tebibyte $CurrentValue -Unit B; $boolOption = $true;}
{ 'PiB' -contains $_} { $FinalValue = ConvertTo-Petabyte $CurrentValue -Unit B; $boolOption = $true;}
default {
if (-Not $boolOption) {

View file

@ -7,9 +7,9 @@ function ConvertTo-ByteIEC()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'KiB', 'KiBByte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
{ 'KiB', 'Kibibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
{ 'MiB', 'Mebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 20)); $boolOption = $true; }
{ 'GiB', 'GiBByte' -contains $_ } { $result = ($Value * [math]::Pow(2, 30)); $boolOption = $true; }
{ 'GiB', 'Gibibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 30)); $boolOption = $true; }
{ 'TiB', 'Tebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 40)); $boolOption = $true; }
{ 'PiB', 'Pebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 50)); $boolOption = $true; }
default {
@ -22,7 +22,7 @@ function ConvertTo-ByteIEC()
return $result;
}
function ConvertTo-KiBByte()
function ConvertTo-Kibibyte()
{
param(
[single]$Value,
@ -31,9 +31,9 @@ function ConvertTo-KiBByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'KiB', 'KiBByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'KiB', 'Kibibyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'MiB', 'Mebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
{ 'GiB', 'GiBByte' -contains $_ } { $result = ($Value * [math]::Pow(2, 20)); $boolOption = $true; }
{ 'GiB', 'Gibibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 20)); $boolOption = $true; }
{ 'TiB', 'Tebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 30)); $boolOption = $true; }
{ 'PiB', 'Pebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 40)); $boolOption = $true; }
default {
@ -46,7 +46,7 @@ function ConvertTo-KiBByte()
return $result;
}
function ConvertTo-MiBByte()
function ConvertTo-Mebibyte()
{
param(
[single]$Value,
@ -55,9 +55,9 @@ function ConvertTo-MiBByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(2, 20)); $boolOption = $true; }
{ 'KiB', 'KiBByte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'KiB', 'Kibibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'MiB', 'Mebibyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'GiB', 'GiBByte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
{ 'GiB', 'Gibibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
{ 'TiB', 'Tebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 20)); $boolOption = $true; }
{ 'PiB', 'Pebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 30)); $boolOption = $true; }
default {
@ -70,7 +70,7 @@ function ConvertTo-MiBByte()
return $result;
}
function ConvertTo-GiBByte()
function ConvertTo-Gibibyte()
{
param(
[single]$Value,
@ -79,9 +79,9 @@ function ConvertTo-GiBByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(2, 30)); $boolOption = $true; }
{ 'KiB', 'KiBByte' -contains $_ } { $result = ($Value / [math]::Pow(2, 20)); $boolOption = $true; }
{ 'KiB', 'Kibibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 20)); $boolOption = $true; }
{ 'MiB', 'Mebibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'GiB', 'GiBByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'GiB', 'Gibibyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'TiB', 'Tebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
{ 'PiB', 'Pebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 20)); $boolOption = $true; }
default {
@ -94,7 +94,7 @@ function ConvertTo-GiBByte()
return $result;
}
function ConvertTo-TiBByte()
function ConvertTo-Tebibyte()
{
param(
[single]$Value,
@ -103,9 +103,9 @@ function ConvertTo-TiBByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(2, 40)); $boolOption = $true; }
{ 'KiB', 'KiBByte' -contains $_ } { $result = ($Value / [math]::Pow(2, 30)); $boolOption = $true; }
{ 'KiB', 'Kibibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 30)); $boolOption = $true; }
{ 'MiB', 'Mebibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 20)); $boolOption = $true; }
{ 'GiB', 'GiBByte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'GiB', 'Gibibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'TiB', 'Tebibyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'PiB', 'Pebibyte' -contains $_ } { $result = ($Value * [math]::Pow(2, 10)); $boolOption = $true; }
default {
@ -118,7 +118,7 @@ function ConvertTo-TiBByte()
return $result;
}
function ConvertTo-PiBByte()
function ConvertTo-Pebibyte()
{
param(
[single]$Value,
@ -127,9 +127,9 @@ function ConvertTo-PiBByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(2, 50)); $boolOption = $true; }
{ 'KiB', 'KiBByte' -contains $_ } { $result = ($Value / [math]::Pow(2, 40)); $boolOption = $true; }
{ 'KiB', 'Kibibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 40)); $boolOption = $true; }
{ 'MiB', 'Mebibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 30)); $boolOption = $true; }
{ 'GiB', 'GiBByte' -contains $_ } { $result = ($Value / [math]::Pow(2, 20)); $boolOption = $true; }
{ 'GiB', 'Gibibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 20)); $boolOption = $true; }
{ 'TiB', 'Tebibyte' -contains $_ } { $result = ($Value / [math]::Pow(2, 10)); $boolOption = $true; }
{ 'PiB', 'Pebibyte' -contains $_ } { $result = $Value; $boolOption = $true; }
default {

View file

@ -23,11 +23,11 @@ function ConvertTo-ByteSI()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'KB', 'KiloByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 15)); $boolOption = $true; }
{ 'KB', 'Kilobyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'MB', 'Megabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'GB', 'Gigabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
{ 'TB', 'Terabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
{ 'PB', 'Petabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 15)); $boolOption = $true; }
default {
if (-Not $boolOption) {
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
@ -40,21 +40,21 @@ function ConvertTo-ByteSI()
<#
.SYNOPSIS
Converts unit sizes to kilobyte.
Converts unit sizes to Kilobyte.
.DESCRIPTION
This module converts a given unit size to kilobyte.
e.g byte to kilobyte.
This module converts a given unit size to Kilobyte.
e.g byte to Kilobyte.
More Information on https://github.com/Icinga/icinga-powershell-framework
.EXAMPLE
PS> ConvertTo-KiloByte -Unit TB 200
PS> ConvertTo-Kilobyte -Unit TB 200
200000000000
.LINK
https://github.com/Icinga/icinga-powershell-framework
.NOTES
#>
function ConvertTo-KiloByte()
function ConvertTo-Kilobyte()
{
param(
[single]$Value,
@ -63,11 +63,11 @@ function ConvertTo-KiloByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'KB', 'KiloByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
{ 'KB', 'Kilobyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'MB', 'Megabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'GB', 'Gigabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'TB', 'Terabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
{ 'PB', 'Petabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 12)); $boolOption = $true; }
default {
if (-Not $boolOption) {
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
@ -80,21 +80,21 @@ function ConvertTo-KiloByte()
<#
.SYNOPSIS
Converts unit sizes to megabyte.
Converts unit sizes to Megabyte.
.DESCRIPTION
This module converts a given unit size to megabyte.
e.g byte to megabyte.
This module converts a given unit size to Megabyte.
e.g byte to Megabyte.
More Information on https://github.com/Icinga/icinga-powershell-framework
.EXAMPLE
PS> ConvertTo-KiloByte -Unit TB 200
PS> ConvertTo-Kilobyte -Unit TB 200
200000000
.LINK
https://github.com/Icinga/icinga-powershell-framework
.NOTES
#>
function ConvertTo-MegaByte()
function ConvertTo-Megabyte()
{
param(
[single]$Value,
@ -103,11 +103,11 @@ function ConvertTo-MegaByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'KB', 'KiloByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'MB', 'MegaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
{ 'KB', 'Kilobyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'MB', 'Megabyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'GB', 'Gigabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'TB', 'Terabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'PB', 'Petabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 9)); $boolOption = $true; }
default {
if (-Not $boolOption) {
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
@ -120,21 +120,21 @@ function ConvertTo-MegaByte()
<#
.SYNOPSIS
Converts unit sizes to gigabyte.
Converts unit sizes to Gigabyte.
.DESCRIPTION
This module converts a given unit size to gigabyte.
e.g byte to gigabyte.
This module converts a given unit size to Gigabyte.
e.g byte to Gigabyte.
More Information on https://github.com/Icinga/icinga-powershell-framework
.EXAMPLE
PS> ConvertTo-GigaByte -Unit TB 200
PS> ConvertTo-Gigabyte -Unit TB 200
200000
.LINK
https://github.com/Icinga/icinga-powershell-framework
.NOTES
#>
function ConvertTo-GigaByte()
function ConvertTo-Gigabyte()
{
param(
[single]$Value,
@ -143,11 +143,11 @@ function ConvertTo-GigaByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(10, 9)); $boolOption = $true; }
{ 'KB', 'KiloByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'GB', 'GigaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
{ 'KB', 'Kilobyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'MB', 'Megabyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'GB', 'Gigabyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'TB', 'Terabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'PB', 'Petabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 6)); $boolOption = $true; }
default {
if (-Not $boolOption) {
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
@ -160,21 +160,21 @@ function ConvertTo-GigaByte()
<#
.SYNOPSIS
Converts unit sizes to terabyte.
Converts unit sizes to Terabyte.
.DESCRIPTION
This module converts a given unit size to terabyte.
e.g byte to terabyte.
This module converts a given unit size to Terabyte.
e.g byte to Terabyte.
More Information on https://github.com/Icinga/icinga-powershell-framework
.EXAMPLE
PS> ConvertTo-TeraByte -Unit GB 2000000
PS> ConvertTo-Terabyte -Unit GB 2000000
2000
.LINK
https://github.com/Icinga/icinga-powershell-framework
.NOTES
#>
function ConvertTo-TeraByte()
function ConvertTo-Terabyte()
{
param(
[single]$Value,
@ -183,11 +183,11 @@ function ConvertTo-TeraByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(10, 12)); $boolOption = $true; }
{ 'KB', 'KiloByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 9)); $boolOption = $true; }
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'TB', 'TeraByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'PB', 'PetaByte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
{ 'KB', 'Kilobyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 9)); $boolOption = $true; }
{ 'MB', 'Megabyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'GB', 'Gigabyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'TB', 'Terabyte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'PB', 'Petabyte' -contains $_ } { $result = ($Value * [math]::Pow(10, 3)); $boolOption = $true; }
default {
if (-Not $boolOption) {
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;
@ -200,21 +200,21 @@ function ConvertTo-TeraByte()
<#
.SYNOPSIS
Converts unit sizes to petabyte.
Converts unit sizes to Petabyte.
.DESCRIPTION
This module converts a given unit size to petabyte.
e.g byte to petabyte.
This module converts a given unit size to Petabyte.
e.g byte to Petabyte.
More Information on https://github.com/Icinga/icinga-powershell-framework
.EXAMPLE
PS> ConvertTo-PetaByte -Unit GB 2000000
PS> ConvertTo-Petabyte -Unit GB 2000000
2
.LINK
https://github.com/Icinga/icinga-powershell-framework
.NOTES
#>
function ConvertTo-PetaByte()
function ConvertTo-Petabyte()
{
param(
[single]$Value,
@ -223,11 +223,11 @@ function ConvertTo-PetaByte()
switch ($Unit) {
{ 'B', 'Byte' -contains $_ } { $result = ($Value / [math]::Pow(10, 15)); $boolOption = $true; }
{ 'KB', 'KiloByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 12)); $boolOption = $true; }
{ 'MB', 'MegaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 9)); $boolOption = $true; }
{ 'GB', 'GigaByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'TB', 'TeraByte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'PB', 'PetaByte' -contains $_ } { $result = $Value; $boolOption = $true; }
{ 'KB', 'Kilobyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 12)); $boolOption = $true; }
{ 'MB', 'Megabyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 9)); $boolOption = $true; }
{ 'GB', 'Gigabyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 6)); $boolOption = $true; }
{ 'TB', 'Terabyte' -contains $_ } { $result = ($Value / [math]::Pow(10, 3)); $boolOption = $true; }
{ 'PB', 'Petabyte' -contains $_ } { $result = $Value; $boolOption = $true; }
default {
if (-Not $boolOption) {
Exit-IcingaThrowException -ExceptionType 'Input' -ExceptionThrown $IcingaExceptions.Inputs.ConversionUnitMissing -Force;

View file

@ -24,10 +24,10 @@
'us' = 'microseconds';
'%' = 'percent';
'B' = 'bytes';
'KB' = 'kilobytes';
'MB' = 'megabytes';
'GB' = 'gigabytes';
'TB' = 'terabytes';
'KB' = 'Kilobytes';
'MB' = 'Megabytes';
'GB' = 'Gigabytes';
'TB' = 'Terabytes';
'c' = 'counter';
};