| |
77 |
77 |
_sntprintf_s(szData, stMaxSize, _T("%.2f %s"), (double)(ullData / 1024.0), m_strKBytes.c_str()); |
| |
78 |
78 |
else |
| |
79 |
79 |
_sntprintf_s(szData, stMaxSize, _T("%I64u %s"), ullData, m_strBytes.c_str()); |
| |
80 |
80 |
|
| |
81 |
81 |
return szData; |
| |
82 |
82 |
} |
| |
83 |
83 |
|
| |
84 |
84 |
void TSizeFormatter::StoreInConfig(chengine::TConfig& rConfig, PCTSTR pszNodeName) const |
| |
85 |
85 |
{ |
| |
86 |
86 |
std::wstring wstrBuffer; |
| |
87 |
87 |
SetConfigValue(rConfig, Concat(wstrBuffer, pszNodeName, L"Bytes"), m_strBytes.c_str()); |
| |
88 |
88 |
SetConfigValue(rConfig, Concat(wstrBuffer, pszNodeName, L"KBytes"), m_strKBytes.c_str()); |
| |
89 |
89 |
SetConfigValue(rConfig, Concat(wstrBuffer, pszNodeName, L"MBytes"), m_strMBytes.c_str()); |
| |
90 |
90 |
SetConfigValue(rConfig, Concat(wstrBuffer, pszNodeName, L"GBytes"), m_strGBytes.c_str()); |
| |
91 |
91 |
SetConfigValue(rConfig, Concat(wstrBuffer, pszNodeName, L"TBytes"), m_strTBytes.c_str()); |
| |
92 |
92 |
} |
| |
93 |
93 |
|
| |
94 |
94 |
bool TSizeFormatter::ReadFromConfig(chengine::TConfig& rConfig, PCTSTR pszNodeName) |
| |
95 |
95 |
{ |
| |
96 |
96 |
std::wstring strBuffer; |
| |
97 |
|
chengine::TString strValue; |
| |
|
97 |
string::TString strValue; |
| |
98 |
98 |
|
| |
99 |
99 |
if(!GetConfigValue(rConfig, Concat(strBuffer, pszNodeName, _T("Bytes")), strValue)) |
| |
100 |
100 |
return false; |
| |
101 |
101 |
m_strBytes = strValue.c_str(); |
| |
102 |
102 |
|
| |
103 |
103 |
if(!GetConfigValue(rConfig, Concat(strBuffer, pszNodeName, _T("KBytes")), strValue)) |
| |
104 |
104 |
return false; |
| |
105 |
105 |
m_strKBytes = strValue.c_str(); |
| |
106 |
106 |
|
| |
107 |
107 |
if(!GetConfigValue(rConfig, Concat(strBuffer, pszNodeName, _T("MBytes")), strValue)) |
| |
108 |
108 |
return false; |
| |
109 |
109 |
m_strMBytes = strValue.c_str(); |
| |
110 |
110 |
|
| |
111 |
111 |
if(!GetConfigValue(rConfig, Concat(strBuffer, pszNodeName, _T("GBytes")), strValue)) |
| |
112 |
112 |
return false; |
| |
113 |
113 |
m_strGBytes = strValue.c_str(); |
| |
114 |
114 |
|
| |
115 |
115 |
if(!GetConfigValue(rConfig, Concat(strBuffer, pszNodeName, _T("TBytes")), strValue)) |
| |
116 |
116 |
return false; |
| |
117 |
117 |
m_strTBytes = strValue.c_str(); |