mirror of
https://github.com/xcp-ng/xenadmin.git
synced 2024-11-23 20:36:33 +01:00
CP-34000: decimal network and disk access rate unit calculations
Though this was shown in units like kB/s and MB/s (decimal units) it was calculated in binary terms i.e. 1MB/s was treated as 1024kB/s instead of the expected 1000kB/s. Updated translations for the units to be of the form 'MB/s' instead of 'MBps'. Signed-off-by: Aaron Robson <aaron.robson@citrix.com>
This commit is contained in:
parent
5f7d3e1518
commit
05c8809539
@ -71,17 +71,25 @@ namespace XenAdminTests.UnitTests
|
||||
|
||||
private Dictionary<double, string[]> dataRatePairs = new Dictionary<double, string[]>
|
||||
{
|
||||
{ 0, new[] { "0", "Bps" } },
|
||||
{ 1000, new[] { "1000", "Bps" } },
|
||||
{ 1024, new[] { "1", "kBps" } },
|
||||
{ 100000, new[] { "97.7", "kBps" } },
|
||||
{ 1000000, new[] { "976.6", "kBps" } },
|
||||
{ 1048576, new[] { "1", "MBps" } }, //1024*1024
|
||||
{ 2100000, new[] { "2", "MBps" } },
|
||||
{ 2900000, new[] { "2.8", "MBps" } },
|
||||
{ 1073741824, new[] { "1", "GBps" } }, //1024*1024*1024
|
||||
{ 2100000000, new[] { "2", "GBps" } },
|
||||
{ 2900000000, new[] { "2.7", "GBps" } }
|
||||
{ 0, new[] { "0", "B/s" } },
|
||||
{ 1000, new[] { "1", "kB/s" } },
|
||||
{ 1024, new[] { "1", "kB/s" } },
|
||||
{ 100000, new[] { "100", "kB/s" } },
|
||||
{ 1000000, new[] { "1", "MB/s" } }, //1000*1000
|
||||
{ 1048576, new[] { "1", "MB/s" } }, //1024*1024
|
||||
{ 2000000, new[] { "2", "MB/s" } }, //2*1000*1000
|
||||
{ 2097152, new[] { "2.1", "MB/s" } }, //2*1024*1024
|
||||
{ 2100000, new[] { "2.1", "MB/s" } }, //2.1*1000*1000
|
||||
{ 2900000, new[] { "2.9", "MB/s" } }, //2.9*1000*1000
|
||||
{ 1000000000, new[] { "1", "GB/s" } }, //1000*1000*1000
|
||||
{ 1073741824, new[] { "1.1", "GB/s" } }, //1024*1024*1024
|
||||
{ 2100000000, new[] { "2.1", "GB/s" } }, //2.1*1000*1000*1000
|
||||
{ 2147483648, new[] { "2.1", "GB/s" } }, //2*1024*1024*1024
|
||||
{ 2900000000, new[] { "2.9", "GB/s" } }, //2.9*1000*1000*1000
|
||||
{ 1000000000000, new[] { "1", "TB/s" } }, //1000*1000*1000*1000
|
||||
{ 1099511627776, new[] { "1.1", "TB/s" } }, //1024*1024*1024*1024
|
||||
{ 2100000000000, new[] { "2.1", "TB/s" } }, //2.1*1000*1000*1000*1000
|
||||
{ 2900000000000, new[] { "2.9", "TB/s" } }, //2.9*1000*1000*1000*1000
|
||||
};
|
||||
|
||||
private Dictionary<double, string[]> nanoSecPairs = new Dictionary<double, string[]>
|
||||
|
10
XenModel/Messages.Designer.cs
generated
10
XenModel/Messages.Designer.cs
generated
@ -38037,7 +38037,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to GBps.
|
||||
/// Looks up a localized string similar to GB/s.
|
||||
/// </summary>
|
||||
public static string VAL_GIGRATE {
|
||||
get {
|
||||
@ -38073,7 +38073,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to kBps.
|
||||
/// Looks up a localized string similar to kB/s.
|
||||
/// </summary>
|
||||
public static string VAL_KILRATE {
|
||||
get {
|
||||
@ -38109,7 +38109,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to MBps.
|
||||
/// Looks up a localized string similar to MB/s.
|
||||
/// </summary>
|
||||
public static string VAL_MEGRATE {
|
||||
get {
|
||||
@ -38163,7 +38163,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to Bps.
|
||||
/// Looks up a localized string similar to B/s.
|
||||
/// </summary>
|
||||
public static string VAL_RATE {
|
||||
get {
|
||||
@ -38199,7 +38199,7 @@ namespace XenAdmin {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Looks up a localized string similar to TBps.
|
||||
/// Looks up a localized string similar to TB/s.
|
||||
/// </summary>
|
||||
public static string VAL_TERRATE {
|
||||
get {
|
||||
|
@ -59,46 +59,46 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
||||
<xsd:element msdata:IsDataSet="true" name="root">
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" name="value" type="xsd:string"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="type" type="xsd:string"/>
|
||||
<xsd:attribute name="mimetype" type="xsd:string"/>
|
||||
<xsd:attribute ref="xml:space"/>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string"/>
|
||||
<xsd:attribute name="name" type="xsd:string"/>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string"/>
|
||||
<xsd:element minOccurs="0" msdata:Ordinal="2" name="comment" type="xsd:string"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute msdata:Ordinal="1" name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute msdata:Ordinal="3" name="type" type="xsd:string"/>
|
||||
<xsd:attribute msdata:Ordinal="4" name="mimetype" type="xsd:string"/>
|
||||
<xsd:attribute ref="xml:space"/>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
@ -11889,7 +11889,7 @@ VM が再起動したら、[[Citrix VM Tools] をインストール] を再度
|
||||
<value>権限のより多いユーザー アカウントで再試行してください。</value>
|
||||
</data>
|
||||
<data name="SOLUTION_UNKNOWN" xml:space="preserve">
|
||||
<value/>
|
||||
<value />
|
||||
</data>
|
||||
<data name="SOME_ERRORS_ENCOUNTERED" xml:space="preserve">
|
||||
<value>いくつかのエラーが発生しました。詳しくは、[XenCenter] のログを参照してください。</value>
|
||||
@ -12514,7 +12514,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>OVF または OVA パッケージからアプライアンスをインポートします。</value>
|
||||
</data>
|
||||
<data name="TYPE_PAGE_DESCRIPTION_HEADER_VHD" xml:space="preserve">
|
||||
<value/>
|
||||
<value />
|
||||
</data>
|
||||
<data name="TYPE_PAGE_DESCRIPTION_HEADER_XVA" xml:space="preserve">
|
||||
<value>ローカルに格納された VM、テンプレート、またはスナップショットを新規 VM としてインポートします。</value>
|
||||
@ -13149,7 +13149,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>GHz</value>
|
||||
</data>
|
||||
<data name="VAL_GIGRATE" xml:space="preserve">
|
||||
<value>GBps</value>
|
||||
<value>GB/s</value>
|
||||
</data>
|
||||
<data name="VAL_KB" xml:space="preserve">
|
||||
<value>{0} kB</value>
|
||||
@ -13161,7 +13161,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>kW</value>
|
||||
</data>
|
||||
<data name="VAL_KILRATE" xml:space="preserve">
|
||||
<value>Kbps</value>
|
||||
<value>kB/s</value>
|
||||
</data>
|
||||
<data name="VAL_MB" xml:space="preserve">
|
||||
<value>{0} MB</value>
|
||||
@ -13173,7 +13173,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>MHz</value>
|
||||
</data>
|
||||
<data name="VAL_MEGRATE" xml:space="preserve">
|
||||
<value>Mbps</value>
|
||||
<value>MB/s</value>
|
||||
</data>
|
||||
<data name="VAL_MICSEC" xml:space="preserve">
|
||||
<value>μs</value>
|
||||
@ -13191,7 +13191,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>ns</value>
|
||||
</data>
|
||||
<data name="VAL_RATE" xml:space="preserve">
|
||||
<value>Bps</value>
|
||||
<value>B/s</value>
|
||||
</data>
|
||||
<data name="VAL_RATE_NUM_FORMAT" xml:space="preserve">
|
||||
<value>0.0</value>
|
||||
@ -13203,7 +13203,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>TB</value>
|
||||
</data>
|
||||
<data name="VAL_TERRATE" xml:space="preserve">
|
||||
<value>Tbps</value>
|
||||
<value>TB/s</value>
|
||||
</data>
|
||||
<data name="VAL_WATT" xml:space="preserve">
|
||||
<value>W</value>
|
||||
@ -13870,7 +13870,7 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<value>詳細</value>
|
||||
</data>
|
||||
<data name="WLB_ADVANCED_CONFIGURATION_SUBTEXT" xml:space="preserve">
|
||||
<value/>
|
||||
<value />
|
||||
</data>
|
||||
<data name="WLB_AUDIT_LOG_MAXIMUM" xml:space="preserve">
|
||||
<value>最大</value>
|
||||
@ -14579,4 +14579,4 @@ SR-IOV ネットワークを有効にするには、サーバーの再起動が
|
||||
<data name="YOU_ARE_HERE" xml:space="preserve">
|
||||
<value>現在の位置</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
@ -13148,7 +13148,7 @@ To start a [XenServer] trial, click the button below.</value>
|
||||
<value>GHz</value>
|
||||
</data>
|
||||
<data name="VAL_GIGRATE" xml:space="preserve">
|
||||
<value>GBps</value>
|
||||
<value>GB/s</value>
|
||||
</data>
|
||||
<data name="VAL_KB" xml:space="preserve">
|
||||
<value>{0} kB</value>
|
||||
@ -13160,7 +13160,7 @@ To start a [XenServer] trial, click the button below.</value>
|
||||
<value>kW</value>
|
||||
</data>
|
||||
<data name="VAL_KILRATE" xml:space="preserve">
|
||||
<value>kBps</value>
|
||||
<value>kB/s</value>
|
||||
</data>
|
||||
<data name="VAL_MB" xml:space="preserve">
|
||||
<value>{0} MB</value>
|
||||
@ -13172,7 +13172,7 @@ To start a [XenServer] trial, click the button below.</value>
|
||||
<value>MHz</value>
|
||||
</data>
|
||||
<data name="VAL_MEGRATE" xml:space="preserve">
|
||||
<value>MBps</value>
|
||||
<value>MB/s</value>
|
||||
</data>
|
||||
<data name="VAL_MICSEC" xml:space="preserve">
|
||||
<value>μs</value>
|
||||
@ -13190,7 +13190,7 @@ To start a [XenServer] trial, click the button below.</value>
|
||||
<value>ns</value>
|
||||
</data>
|
||||
<data name="VAL_RATE" xml:space="preserve">
|
||||
<value>Bps</value>
|
||||
<value>B/s</value>
|
||||
</data>
|
||||
<data name="VAL_RATE_NUM_FORMAT" xml:space="preserve">
|
||||
<value>0.0</value>
|
||||
@ -13202,7 +13202,7 @@ To start a [XenServer] trial, click the button below.</value>
|
||||
<value>TB</value>
|
||||
</data>
|
||||
<data name="VAL_TERRATE" xml:space="preserve">
|
||||
<value>TBps</value>
|
||||
<value>TB/s</value>
|
||||
</data>
|
||||
<data name="VAL_WATT" xml:space="preserve">
|
||||
<value>W</value>
|
||||
|
@ -59,46 +59,46 @@
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace"/>
|
||||
<xsd:element msdata:IsDataSet="true" name="root">
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" name="value" type="xsd:string"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="type" type="xsd:string"/>
|
||||
<xsd:attribute name="mimetype" type="xsd:string"/>
|
||||
<xsd:attribute ref="xml:space"/>
|
||||
<xsd:attribute name="name" use="required" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string"/>
|
||||
<xsd:attribute name="name" type="xsd:string"/>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string"/>
|
||||
<xsd:element minOccurs="0" msdata:Ordinal="2" name="comment" type="xsd:string"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute msdata:Ordinal="1" name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute msdata:Ordinal="3" name="type" type="xsd:string"/>
|
||||
<xsd:attribute msdata:Ordinal="4" name="mimetype" type="xsd:string"/>
|
||||
<xsd:attribute ref="xml:space"/>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
<xsd:attribute ref="xml:space" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element minOccurs="0" msdata:Ordinal="1" name="value" type="xsd:string"/>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required"/>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
@ -11888,7 +11888,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>使用权限更大的用户帐户重试。</value>
|
||||
</data>
|
||||
<data name="SOLUTION_UNKNOWN" xml:space="preserve">
|
||||
<value/>
|
||||
<value />
|
||||
</data>
|
||||
<data name="SOME_ERRORS_ENCOUNTERED" xml:space="preserve">
|
||||
<value>遇到一些错误。有关详细信息,请参阅 [XenCenter] 日志。</value>
|
||||
@ -12513,7 +12513,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>从 OVF 或 OVA 包导入设备。</value>
|
||||
</data>
|
||||
<data name="TYPE_PAGE_DESCRIPTION_HEADER_VHD" xml:space="preserve">
|
||||
<value/>
|
||||
<value />
|
||||
</data>
|
||||
<data name="TYPE_PAGE_DESCRIPTION_HEADER_XVA" xml:space="preserve">
|
||||
<value>将本地存储的 VM、模板或快照作为新 VM 导入。</value>
|
||||
@ -13146,7 +13146,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>GHz</value>
|
||||
</data>
|
||||
<data name="VAL_GIGRATE" xml:space="preserve">
|
||||
<value>GBps</value>
|
||||
<value>GB/s</value>
|
||||
</data>
|
||||
<data name="VAL_KB" xml:space="preserve">
|
||||
<value>{0} KB</value>
|
||||
@ -13158,7 +13158,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>kW</value>
|
||||
</data>
|
||||
<data name="VAL_KILRATE" xml:space="preserve">
|
||||
<value>KBps</value>
|
||||
<value>kB/s</value>
|
||||
</data>
|
||||
<data name="VAL_MB" xml:space="preserve">
|
||||
<value>{0} MB</value>
|
||||
@ -13170,7 +13170,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>MHz</value>
|
||||
</data>
|
||||
<data name="VAL_MEGRATE" xml:space="preserve">
|
||||
<value>MBps</value>
|
||||
<value>MB/s</value>
|
||||
</data>
|
||||
<data name="VAL_MICSEC" xml:space="preserve">
|
||||
<value>μs</value>
|
||||
@ -13188,7 +13188,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>ns</value>
|
||||
</data>
|
||||
<data name="VAL_RATE" xml:space="preserve">
|
||||
<value>Bps</value>
|
||||
<value>B/s</value>
|
||||
</data>
|
||||
<data name="VAL_RATE_NUM_FORMAT" xml:space="preserve">
|
||||
<value>0.0</value>
|
||||
@ -13200,7 +13200,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>TB</value>
|
||||
</data>
|
||||
<data name="VAL_TERRATE" xml:space="preserve">
|
||||
<value>TBps</value>
|
||||
<value>TB/s</value>
|
||||
</data>
|
||||
<data name="VAL_WATT" xml:space="preserve">
|
||||
<value>W</value>
|
||||
@ -13867,7 +13867,7 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<value>高级</value>
|
||||
</data>
|
||||
<data name="WLB_ADVANCED_CONFIGURATION_SUBTEXT" xml:space="preserve">
|
||||
<value/>
|
||||
<value />
|
||||
</data>
|
||||
<data name="WLB_AUDIT_LOG_MAXIMUM" xml:space="preserve">
|
||||
<value>最大值</value>
|
||||
@ -14576,4 +14576,4 @@ VM 克隆使用文件管理器的快照和克隆功能来实现高性能,并
|
||||
<data name="YOU_ARE_HERE" xml:space="preserve">
|
||||
<value>您在此处</value>
|
||||
</data>
|
||||
</root>
|
||||
</root>
|
@ -172,34 +172,68 @@ namespace XenAdmin
|
||||
|
||||
private static string ByteSizeString(double bytes, int decPlaces, bool isRate, out string unit, string format = null)
|
||||
{
|
||||
if (isRate)
|
||||
{
|
||||
if (bytes >= DEC_TERA)
|
||||
{
|
||||
unit = Messages.VAL_TERRATE;
|
||||
var result = Math.Round(bytes / DEC_TERA, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
if (bytes >= DEC_GIGA)
|
||||
{
|
||||
unit = Messages.VAL_GIGRATE;
|
||||
var result = Math.Round(bytes / DEC_GIGA, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
if (bytes >= DEC_MEGA)
|
||||
{
|
||||
unit = Messages.VAL_MEGRATE;
|
||||
var result = Math.Round(bytes / DEC_MEGA, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
if (bytes >= DEC_KILO)
|
||||
{
|
||||
unit = Messages.VAL_KILRATE;
|
||||
var result = Math.Round(bytes / DEC_KILO, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
unit = Messages.VAL_RATE;
|
||||
return bytes.ToString();
|
||||
}
|
||||
|
||||
if (bytes >= BINARY_TERA)
|
||||
{
|
||||
unit = isRate ? Messages.VAL_TERRATE : Messages.VAL_TERB;
|
||||
unit = Messages.VAL_TERB;
|
||||
var result = Math.Round(bytes / BINARY_TERA, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
if (bytes >= BINARY_GIGA)
|
||||
{
|
||||
unit = isRate ? Messages.VAL_GIGRATE : Messages.VAL_GIGB;
|
||||
unit = Messages.VAL_GIGB;
|
||||
var result = Math.Round(bytes / BINARY_GIGA, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
if (bytes >= BINARY_MEGA)
|
||||
{
|
||||
unit = isRate ? Messages.VAL_MEGRATE : Messages.VAL_MEGB;
|
||||
unit = Messages.VAL_MEGB;
|
||||
var result = Math.Round(bytes / BINARY_MEGA, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
if (bytes >= BINARY_KILO)
|
||||
{
|
||||
unit = isRate ? Messages.VAL_KILRATE : Messages.VAL_KILB;
|
||||
unit = Messages.VAL_KILB;
|
||||
var result = Math.Round(bytes / BINARY_KILO, decPlaces);
|
||||
return string.IsNullOrEmpty(format) ? result.ToString() : result.ToString(format);
|
||||
}
|
||||
|
||||
unit = isRate ? Messages.VAL_RATE : Messages.VAL_BYTE;
|
||||
unit = Messages.VAL_BYTE;
|
||||
return bytes.ToString();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user