Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Newer
Older
100644 808 lines (703 sloc) 19.37 kB
30edc89
Kimmo Pekkola authored
1 /*
2 Copyright (C) 2000 Kimmo Pekkola
3
4 This program is free software; you can redistribute it and/or
5 modify it under the terms of the GNU General Public License
6 as published by the Free Software Foundation; either version 2
7 of the License, or (at your option) any later version.
8
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
13
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
ebec089 @spx268 Adjusted copyright notice.
spx268 authored
16 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
30edc89
Kimmo Pekkola authored
17 */
18
0b4ba32 Added cache for the fonts.
Kimmo Pekkola authored
19 #include "StdAfx.h"
30edc89
Kimmo Pekkola authored
20 #include "Measure.h"
21 #include "MeasureCPU.h"
22 #include "MeasureMemory.h"
23 #include "MeasurePhysicalMemory.h"
24 #include "MeasureVirtualMemory.h"
25 #include "MeasureNetIn.h"
26 #include "MeasureNetOut.h"
27 #include "MeasureNetTotal.h"
28 #include "MeasureDiskSpace.h"
29 #include "MeasureUptime.h"
30 #include "MeasurePlugin.h"
31 #include "MeasureRegistry.h"
32 #include "MeasureTime.h"
33 #include "MeasureCalc.h"
c516bf8 Added Lua Stuff
mapeki authored
34 #include "MeasureScript.h"
30edc89
Kimmo Pekkola authored
35 #include "Rainmeter.h"
36 #include "Error.h"
37 #include "Litestep.h"
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
38 #include "pcre-8.10/config.h"
39 #include "pcre-8.10/pcre.h"
40
41 #define OVECCOUNT 300 // Should be a multiple of 3
30edc89
Kimmo Pekkola authored
42
235841e @spx268 Added AutoScale=2 and "k" postfix to Meter=STRING.
spx268 authored
43 enum AUTOSCALE_INDEX
44 {
45 AUTOSCALE_INDEX_1024 = 0,
46 AUTOSCALE_INDEX_1000 = 1
47 };
48
49 static const double g_TblScale[2][4] = {
50 {
51 1024.0 * 1024.0 * 1024.0 * 1024.0,
52 1024.0 * 1024.0 * 1024.0,
53 1024.0 * 1024.0,
54 1024.0
55 },
56 {
57 1000.0 * 1000.0 * 1000.0 * 1000.0,
58 1000.0 * 1000.0 * 1000.0,
59 1000.0 * 1000.0,
60 1000.0
61 }
62 };
63
30edc89
Kimmo Pekkola authored
64 const int MEDIAN_SIZE = 7;
65
66 extern CRainmeter* Rainmeter;
67
68 /*
69 ** The constructor
70 **
71 */
e99403c @poiru Tweaks.
poiru authored
72 CMeasure::CMeasure(CMeterWindow* meterWindow, const WCHAR* name) : m_MeterWindow(meterWindow), m_Name(name),
7ea3a76 @spx268 - Fixed that r716 (precompiled header) doesn't work on x64.
spx268 authored
73 m_DynamicVariables(false),
74 m_Invert(false),
75 m_LogMaxValue(false),
76 m_MinValue(),
77 m_MaxValue(1.0),
78 m_Value(),
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
79 m_RegExpSubstitute(false),
7ea3a76 @spx268 - Fixed that r716 (precompiled header) doesn't work on x64.
spx268 authored
80 m_MedianPos(),
81 m_AveragePos(),
82 m_AverageSize(),
83 m_IfEqualValue(),
84 m_IfAboveValue(),
85 m_IfBelowValue(),
43f7262 @poiru Fixed typo
poiru authored
86 m_IfEqualCommitted(false),
87 m_IfAboveCommitted(false),
88 m_IfBelowCommitted(false),
7ea3a76 @spx268 - Fixed that r716 (precompiled header) doesn't work on x64.
spx268 authored
89 m_Disabled(false),
90 m_UpdateDivider(1),
91 m_UpdateCounter(1),
92 m_Initialized(false)
30edc89
Kimmo Pekkola authored
93 {
94 }
95
96 /*
97 ** The destructor
98 **
99 */
100 CMeasure::~CMeasure()
101 {
102 }
103
104 /*
f2682ea @spx268 Changed the behavior of DynamicVariables. The fixed value definition …
spx268 authored
105 ** Initializes the measure.
106 **
107 */
108 void CMeasure::Initialize()
109 {
110 m_Initialized = true;
111 }
112
113 /*
922dd09 @poiru Cosmetics: Changed "config" to more consistent and descriptive terms
poiru authored
114 ** Read the common options specified in the ini file. The inherited classes must
115 ** call this base implementation if they overwrite this method.
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
116 **
30edc89
Kimmo Pekkola authored
117 */
e3d92d3 @poiru Cosmetics
poiru authored
118 void CMeasure::ReadOptions(CConfigParser& parser, const WCHAR* section)
30edc89
Kimmo Pekkola authored
119 {
4bed8bd @spx268 Fixed: The value is not replaced by correct substitute when DynamicVa…
spx268 authored
120 // Clear substitutes to prevent from being added more than once.
121 if (!m_Substitute.empty())
122 {
123 m_Substitute.clear();
124 }
125
30edc89
Kimmo Pekkola authored
126 m_Invert = 0!=parser.ReadInt(section, L"InvertMeasure", 0);
f2682ea @spx268 Changed the behavior of DynamicVariables. The fixed value definition …
spx268 authored
127
ea124f5 @poiru Changed MeasureName(N) to work dynamically
poiru authored
128 m_Disabled = 0!=parser.ReadInt(section, L"Disabled", 0);
df3215c @spx268 FIXED: DynamicVariables=1 disables UpdateDivider (issue 123)
spx268 authored
129
2fafb5d @spx268 - Added !RainmeterUpdate/!RainmeterUpdateMeter(Group)/!RainmeterUpdat…
spx268 authored
130 int updateDivider = parser.ReadInt(section, L"UpdateDivider", 1);
df3215c @spx268 FIXED: DynamicVariables=1 disables UpdateDivider (issue 123)
spx268 authored
131 if (updateDivider != m_UpdateDivider)
132 {
133 m_UpdateCounter = m_UpdateDivider = updateDivider;
134 }
30edc89
Kimmo Pekkola authored
135
ba239ff @poiru Changed all numerical options or numerical parameters of bangs to acc…
poiru authored
136 m_MinValue = parser.ReadFloat(section, L"MinValue", m_MinValue);
137 m_MaxValue = parser.ReadFloat(section, L"MaxValue", m_MaxValue);
30edc89
Kimmo Pekkola authored
138
139 // The ifabove/ifbelow define actions that are ran when the value goes above/below the given number.
140
ba239ff @poiru Changed all numerical options or numerical parameters of bangs to acc…
poiru authored
141 m_IfAboveValue = parser.ReadFloat(section, L"IfAboveValue", 0.0);
3afe015 @spx268 Broken backwards compatibility was fixed.
spx268 authored
142 m_IfAboveAction = parser.ReadString(section, L"IfAboveAction", L"", false);
30edc89
Kimmo Pekkola authored
143
ba239ff @poiru Changed all numerical options or numerical parameters of bangs to acc…
poiru authored
144 m_IfBelowValue = parser.ReadFloat(section, L"IfBelowValue", 0.0);
3afe015 @spx268 Broken backwards compatibility was fixed.
spx268 authored
145 m_IfBelowAction = parser.ReadString(section, L"IfBelowAction", L"", false);
30edc89
Kimmo Pekkola authored
146
ba239ff @poiru Changed all numerical options or numerical parameters of bangs to acc…
poiru authored
147 m_IfEqualValue = parser.ReadFloat(section, L"IfEqualValue", 0.0);
3afe015 @spx268 Broken backwards compatibility was fixed.
spx268 authored
148 m_IfEqualAction = parser.ReadString(section, L"IfEqualAction", L"", false);
30edc89
Kimmo Pekkola authored
149
c2e3b62 @spx268 Additional change for r852,r856. Improved reading the network statist…
spx268 authored
150 m_AverageSize = parser.ReadUInt(section, L"AverageSize", 0);
dc3c767 It's now possible to use the measures as if they were variables (use …
Kimmo Pekkola authored
151
152 m_DynamicVariables = 0!=parser.ReadInt(section, L"DynamicVariables", 0);
153
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
154 m_RegExpSubstitute = 0!=parser.ReadInt(section, L"RegExpSubstitute", 0);
cab258a @spx268 Code optimization and removed unused part for reducing core dll size.
spx268 authored
155 std::wstring subs = parser.ReadString(section, L"Substitute", L"");
3c1338b @spx268 - Renamed bool ReadFormula() to ParseFormula.
spx268 authored
156 if (!subs.empty())
46b19fb @spx268 - Now able to use single quote as quotes in Substitute. Reverted r510…
spx268 authored
157 {
8e8b7d1 @spx268 Code tweaks and cleanup.
spx268 authored
158 if ((subs[0] != L'"' || subs[subs.length() - 1] != L'\'') &&
159 (subs[0] != L'\'' || subs[subs.length() - 1] != L'"'))
3c1338b @spx268 - Renamed bool ReadFormula() to ParseFormula.
spx268 authored
160 {
161 // Add quotes since they are removed by the GetProfileString
8e8b7d1 @spx268 Code tweaks and cleanup.
spx268 authored
162 subs.insert(0, 1, L'"');
163 subs += L'"';
3c1338b @spx268 - Renamed bool ReadFormula() to ParseFormula.
spx268 authored
164 }
165 if (!ParseSubstitute(subs))
166 {
167 LogWithArgs(LOG_ERROR, L"Measure: Invalid Substitute=%s", subs.c_str());
168 }
30edc89
Kimmo Pekkola authored
169 }
f61a35a @spx268 - Added "Group" option to Measure/Meter to operate Measures/Meters in…
spx268 authored
170
0ad2ef9 @spx268 Code cleanup.
spx268 authored
171 const std::wstring& group = parser.ReadString(section, L"Group", L"");
f61a35a @spx268 - Added "Group" option to Measure/Meter to operate Measures/Meters in…
spx268 authored
172 InitializeGroup(group);
30edc89
Kimmo Pekkola authored
173 }
174
ea124f5 @poiru Changed MeasureName(N) to work dynamically
poiru authored
175 void CMeasure::Disable()
176 {
177 m_Disabled = true;
178
179 // Change the option as well to avoid reset in ReadOptions().
180 m_MeterWindow->GetParser().SetValue(m_Name, L"Disabled", L"1");
181 }
182
183 void CMeasure::Enable()
184 {
185 m_Disabled = false;
186
187 // Change the option as well to avoid reset in ReadOptions().
188 m_MeterWindow->GetParser().SetValue(m_Name, L"Disabled", L"0");
189 }
190
30edc89
Kimmo Pekkola authored
191 /*
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
192 ** Substitues text using a straight find and replace method
193 */
194 bool CMeasure::MakePlainSubstitute(std::wstring& str, size_t index)
195 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
196 size_t start = 0, pos;
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
197
198 do
199 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
200 pos = str.find(m_Substitute[index], start);
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
201 if (pos != std::wstring::npos)
202 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
203 str.replace(pos, m_Substitute[index].length(), m_Substitute[index + 1]);
204 start = pos + m_Substitute[index + 1].length();
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
205 }
a209bf1 @spx268 - Fixed Button issue: http://rainmeter.net/forum/viewtopic.php?t=1027…
spx268 authored
206 }
207 while (pos != std::wstring::npos);
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
208
209 return true;
210 }
211
212 /*
30edc89
Kimmo Pekkola authored
213 ** Substitutes part of the text
214 */
215 const WCHAR* CMeasure::CheckSubstitute(const WCHAR* buffer)
216 {
217 static std::wstring str;
218
219 if (!m_Substitute.empty())
220 {
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
221 if (!m_RegExpSubstitute) // Plain Substitutions only
30edc89
Kimmo Pekkola authored
222 {
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
223 str = buffer;
224
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
225 for (size_t i = 0, isize = m_Substitute.size(); i < isize; i += 2)
30edc89
Kimmo Pekkola authored
226 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
227 if (!m_Substitute[i].empty())
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
228 {
d300d46 @spx268 Code cleanup.
spx268 authored
229 MakePlainSubstitute(str, i);
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
230 }
d300d46 @spx268 Code cleanup.
spx268 authored
231 else if (str.empty())
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
232 {
d300d46 @spx268 Code cleanup.
spx268 authored
233 // Empty result and empty substitute -> use second
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
234 str = m_Substitute[i + 1];
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
235 }
30edc89
Kimmo Pekkola authored
236 }
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
237 }
238 else // Contains a RegEx
239 {
240 std::string utf8str = ConvertToUTF8(buffer);
d300d46 @spx268 Code cleanup.
spx268 authored
241 int* ovector = new int[OVECCOUNT];
30edc89
Kimmo Pekkola authored
242
3bebd70 @spx268 Minor tweaks.
spx268 authored
243 for (size_t i = 0, isize = m_Substitute.size(); i < isize ; i += 2)
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
244 {
245 pcre* re;
246 const char* error;
247 int erroffset;
248 int rc;
249 int flags = PCRE_UTF8;
250 int offset = 0;
251
252 re = pcre_compile(
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
253 ConvertToUTF8(m_Substitute[i].c_str()).c_str(), // the pattern
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
254 flags, // default options
255 &error, // for error message
256 &erroffset, // for error offset
257 NULL); // use default character tables
258
259 if (re == NULL)
30edc89
Kimmo Pekkola authored
260 {
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
261 MakePlainSubstitute(str, i);
0891ee4 @poiru Tweaks
poiru authored
262 LogWithArgs(LOG_NOTICE, L"Substitute: %S", error);
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
263 }
264 else
265 {
266 do
30edc89
Kimmo Pekkola authored
267 {
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
268 rc = pcre_exec(
269 re, // the compiled pattern
270 NULL, // no extra data - we didn't study the pattern
271 utf8str.c_str(), // the subject string
272 utf8str.length(), // the length of the subject
273 offset, // start at offset 0 in the subject
274 0, // default options
275 ovector, // output vector for substring information
276 OVECCOUNT); // number of elements in the output vector
277
278 if (rc <= 0)
279 {
280 break;
281 }
282 else
283 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
284 std::string result = ConvertToUTF8(m_Substitute[i + 1].c_str());
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
285
286 if (rc > 1)
287 {
d300d46 @spx268 Code cleanup.
spx268 authored
288 for (int j = rc - 1 ; j >= 0 ; --j)
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
289 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
290 size_t new_start = ovector[2 * j];
291 size_t in_length = ovector[2 * j + 1] - ovector[2 * j];
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
292
293 char tmpName[64];
294
3bebd70 @spx268 Minor tweaks.
spx268 authored
295 size_t cut_length = _snprintf_s(tmpName, _TRUNCATE, "\\%i", j);;
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
296 size_t start = 0, pos;
297 do
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
298 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
299 pos = result.find(tmpName, start, cut_length);
300 if (pos != std::string::npos)
301 {
302 result.replace(pos, cut_length, utf8str, new_start, in_length);
303 start = pos + in_length;
304 }
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
305 }
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
306 while (pos != std::string::npos);
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
307 }
308 }
309
310 size_t start = ovector[0];
311 size_t length = ovector[1] - ovector[0];
312 utf8str.replace(start, length, result);
313 offset = start + result.length();
314 }
a209bf1 @spx268 - Fixed Button issue: http://rainmeter.net/forum/viewtopic.php?t=1027…
spx268 authored
315 }
316 while (true);
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
317
318 // Release memory used for the compiled pattern
319 pcre_free(re);
320 }
30edc89
Kimmo Pekkola authored
321 }
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
322
d300d46 @spx268 Code cleanup.
spx268 authored
323 delete [] ovector;
324
d7dedcf @JamesAC Adding support for RegExp in Substitute strings when RegExpSubstitute…
JamesAC authored
325 str = ConvertUTF8ToWide(utf8str.c_str());
30edc89
Kimmo Pekkola authored
326 }
327
328 return str.c_str();
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
329 }
30edc89
Kimmo Pekkola authored
330 else
331 {
332 return buffer;
333 }
334 }
335
336 /*
337 ** Reads the buffer for "Name":"Value"-pairs separated with comma and
338 ** fills the map with the parsed data.
339 */
340 bool CMeasure::ParseSubstitute(std::wstring buffer)
341 {
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
342 if (buffer.empty()) return true;
30edc89
Kimmo Pekkola authored
343
a209bf1 @spx268 - Fixed Button issue: http://rainmeter.net/forum/viewtopic.php?t=1027…
spx268 authored
344 do
30edc89
Kimmo Pekkola authored
345 {
cab258a @spx268 Code optimization and removed unused part for reducing core dll size.
spx268 authored
346 std::wstring word1 = ExtractWord(buffer);
347 std::wstring sep = ExtractWord(buffer);
569a151 @spx268 - Switched from size()>0 to empty().
spx268 authored
348 if (sep.size() != 1 || sep[0] != L':') return false;
cab258a @spx268 Code optimization and removed unused part for reducing core dll size.
spx268 authored
349 std::wstring word2 = ExtractWord(buffer);
30edc89
Kimmo Pekkola authored
350
569a151 @spx268 - Switched from size()>0 to empty().
spx268 authored
351 if (wcscmp(word1.c_str(), word2.c_str()) != 0)
67e5d41 @spx268 Fix for r510 (Fixed the issue that '#', 'Q', 'O' and 'T' are replaced…
spx268 authored
352 {
2835739 @spx268 Code tweaks and cleanup.
spx268 authored
353 m_Substitute.push_back(word1);
354 m_Substitute.push_back(word2);
67e5d41 @spx268 Fix for r510 (Fixed the issue that '#', 'Q', 'O' and 'T' are replaced…
spx268 authored
355 }
30edc89
Kimmo Pekkola authored
356
569a151 @spx268 - Switched from size()>0 to empty().
spx268 authored
357 std::wstring sep2 = ExtractWord(buffer);
358 if (!sep2.empty() && (sep2.size() != 1 || sep2[0] != L',')) return false;
30edc89
Kimmo Pekkola authored
359 }
a209bf1 @spx268 - Fixed Button issue: http://rainmeter.net/forum/viewtopic.php?t=1027…
spx268 authored
360 while (!buffer.empty());
30edc89
Kimmo Pekkola authored
361
362 return true;
363 }
364
365 /*
366 ** Returns the first word from the buffer. The word can be inside quotes.
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
367 ** If not, the separators are ' ', '\t', ',' and ':'. Whitespaces are removed
30edc89
Kimmo Pekkola authored
368 ** and buffer _will_ be modified.
369 */
370 std::wstring CMeasure::ExtractWord(std::wstring& buffer)
371 {
569a151 @spx268 - Switched from size()>0 to empty().
spx268 authored
372 std::wstring::size_type end, len = buffer.size();
30edc89
Kimmo Pekkola authored
373 std::wstring ret;
374
569a151 @spx268 - Switched from size()>0 to empty().
spx268 authored
375 if (len == 0) return ret;
30edc89
Kimmo Pekkola authored
376
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
377 // Remove whitespaces
378 end = 0;
379 while (end < len && (buffer[end] == L' ' || buffer[end] == L'\t' || buffer[end] == L'\n')) ++end;
380 if (end == len)
30edc89
Kimmo Pekkola authored
381 {
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
382 // End of line reached
383 end = std::wstring::npos;
30edc89
Kimmo Pekkola authored
384 }
385 else
386 {
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
387 buffer.erase(0, end);
388 len = buffer.size();
30edc89
Kimmo Pekkola authored
389
8e8b7d1 @spx268 Code tweaks and cleanup.
spx268 authored
390 if (buffer[0] == L'"' || buffer[0] == L'\'')
30edc89
Kimmo Pekkola authored
391 {
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
392 WCHAR quote = buffer[0];
393
394 end = 1; // Skip the '"'
395 // Quotes around the word
396 while (end < len && (buffer[end] != quote)) ++end;
397 if (end == len) end = std::wstring::npos;
398
399 if (end != std::wstring::npos)
400 {
fdad6fb @spx268 Minor tweaks.
spx268 authored
401 ret.assign(buffer, 1, end - 1);
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
402 ++end;
403 }
404 else
405 {
406 // End of string reached - discard result
407 }
30edc89
Kimmo Pekkola authored
408 }
409 else
410 {
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
411 end = 0;
412 while (end < len && (buffer[end] != L',' && buffer[end] != L':' && buffer[end] != L' ' && buffer[end] != L'\t')) ++end;
413 if (end == len) end = std::wstring::npos;
414
415 if (end == std::wstring::npos)
416 {
417 // End of line reached
418 ret = buffer;
419 }
420 else
421 {
fdad6fb @spx268 Minor tweaks.
spx268 authored
422 ret.assign(buffer, 0, ++end); // The separator is also returned!
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
423 }
30edc89
Kimmo Pekkola authored
424 }
425 }
02658b1 @poiru Fixed: Not being able to Substitute a quote character.
poiru authored
426
1ba57f2 @spx268 Fixed some Lua related issues.
spx268 authored
427 buffer.erase(0, end);
428
30edc89
Kimmo Pekkola authored
429 return ret;
430 }
431
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
432 bool CMeasure::Update()
30edc89
Kimmo Pekkola authored
433 {
2336b08 @poiru Reverted 9623766
poiru authored
434 if (!m_Disabled)
30edc89
Kimmo Pekkola authored
435 {
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
436 // Only update the counter if the divider
437 ++m_UpdateCounter;
438 if (m_UpdateCounter < m_UpdateDivider) return false;
439 m_UpdateCounter = 0;
440
441 // If we're logging the maximum value of the measure, check if
442 // the new value is greater than the old one, and update if necessary.
443 if (m_LogMaxValue)
30edc89
Kimmo Pekkola authored
444 {
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
445 if (m_MedianMaxValues.empty())
446 {
447 m_MedianMaxValues.resize(MEDIAN_SIZE, 0);
448 m_MedianMinValues.resize(MEDIAN_SIZE, 0);
449 }
30edc89
Kimmo Pekkola authored
450
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
451 m_MedianMaxValues[m_MedianPos] = m_Value;
452 m_MedianMinValues[m_MedianPos] = m_Value;
453 ++m_MedianPos;
454 m_MedianPos %= MEDIAN_SIZE;
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
455
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
456 std::vector<double> medianArray;
30edc89
Kimmo Pekkola authored
457
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
458 medianArray = m_MedianMaxValues;
459 std::sort(medianArray.begin(), medianArray.end());
460 m_MaxValue = max(m_MaxValue, medianArray[MEDIAN_SIZE / 2]);
30edc89
Kimmo Pekkola authored
461
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
462 medianArray = m_MedianMinValues;
463 std::sort(medianArray.begin(), medianArray.end());
464 m_MinValue = min(m_MinValue, medianArray[MEDIAN_SIZE / 2]);
465 }
4a8bc1b @poiru Moved IfAction execution to PostUpdate
poiru authored
466
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
467 // Call derived method to update value
468 UpdateValue();
4a8bc1b @poiru Moved IfAction execution to PostUpdate
poiru authored
469
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
470 if (m_AverageSize > 0)
4a8bc1b @poiru Moved IfAction execution to PostUpdate
poiru authored
471 {
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
472 size_t averageValuesSize = m_AverageValues.size();
4a8bc1b @poiru Moved IfAction execution to PostUpdate
poiru authored
473
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
474 if (m_AverageSize != averageValuesSize)
475 {
476 m_AverageValues.resize(m_AverageSize, m_Value);
477 averageValuesSize = m_AverageValues.size();
478 if (m_AveragePos >= averageValuesSize) m_AveragePos = 0;
479 }
480 m_AverageValues[m_AveragePos] = m_Value;
4a8bc1b @poiru Moved IfAction execution to PostUpdate
poiru authored
481
9623766 @poiru Fixed: IfActions not fired when measure is disabled
poiru authored
482 ++m_AveragePos;
483 m_AveragePos %= averageValuesSize;
484
485 // Calculate the average value
486 m_Value = 0;
487 for (size_t i = 0; i < averageValuesSize; ++i)
488 {
489 m_Value += m_AverageValues[i];
490 }
491 m_Value /= (double)averageValuesSize;
4a8bc1b @poiru Moved IfAction execution to PostUpdate
poiru authored
492 }
493
2336b08 @poiru Reverted 9623766
poiru authored
494 if (m_MeterWindow)
30edc89
Kimmo Pekkola authored
495 {
2336b08 @poiru Reverted 9623766
poiru authored
496 if (!m_IfEqualAction.empty())
30edc89
Kimmo Pekkola authored
497 {
2336b08 @poiru Reverted 9623766
poiru authored
498 if ((int)m_Value == (int)m_IfEqualValue)
30edc89
Kimmo Pekkola authored
499 {
2336b08 @poiru Reverted 9623766
poiru authored
500 if (!m_IfEqualCommitted)
501 {
502 m_IfEqualCommitted = true; // To avoid infinite loop from !Update
503 Rainmeter->ExecuteCommand(m_IfEqualAction.c_str(), m_MeterWindow);
504 }
505 }
506 else
507 {
508 m_IfEqualCommitted = false;
30edc89
Kimmo Pekkola authored
509 }
510 }
511
2336b08 @poiru Reverted 9623766
poiru authored
512 if (!m_IfAboveAction.empty())
30edc89
Kimmo Pekkola authored
513 {
2336b08 @poiru Reverted 9623766
poiru authored
514 if (m_Value > m_IfAboveValue)
30edc89
Kimmo Pekkola authored
515 {
2336b08 @poiru Reverted 9623766
poiru authored
516 if (!m_IfAboveCommitted)
517 {
518 m_IfAboveCommitted= true; // To avoid infinite loop from !Update
519 Rainmeter->ExecuteCommand(m_IfAboveAction.c_str(), m_MeterWindow);
520 }
521 }
522 else
523 {
524 m_IfAboveCommitted = false;
30edc89
Kimmo Pekkola authored
525 }
526 }
527
2336b08 @poiru Reverted 9623766
poiru authored
528 if (!m_IfBelowAction.empty())
30edc89
Kimmo Pekkola authored
529 {
2336b08 @poiru Reverted 9623766
poiru authored
530 if (m_Value < m_IfBelowValue)
30edc89
Kimmo Pekkola authored
531 {
2336b08 @poiru Reverted 9623766
poiru authored
532 if (!m_IfBelowCommitted)
533 {
534 m_IfBelowCommitted = true; // To avoid infinite loop from !Update
535 Rainmeter->ExecuteCommand(m_IfBelowAction.c_str(), m_MeterWindow);
536 }
537 }
538 else
539 {
540 m_IfBelowCommitted = false;
30edc89
Kimmo Pekkola authored
541 }
542 }
543 }
544
2336b08 @poiru Reverted 9623766
poiru authored
545 return true;
546 }
547 else
548 {
549 // Disabled measures have 0 as value
550 m_Value = 0.0;
30edc89
Kimmo Pekkola authored
551
1fece1e @poiru Additional change to f2a494b
poiru authored
552 // Set IfAction committed state to false if condition is not met with value = 0
553 if ((int)m_IfEqualValue != 0)
554 {
555 m_IfEqualCommitted = false;
556 }
f2a494b @poiru Fixed that IfAction state is not reset after disabling since 4a8bc1b
poiru authored
557
1fece1e @poiru Additional change to f2a494b
poiru authored
558 if (m_IfAboveValue <= 0.0)
559 {
560 m_IfAboveCommitted = false;
561 }
f2a494b @poiru Fixed that IfAction state is not reset after disabling since 4a8bc1b
poiru authored
562
1fece1e @poiru Additional change to f2a494b
poiru authored
563 if (m_IfBelowValue >= 0.0)
564 {
565 m_IfBelowCommitted = false;
566 }
f2a494b @poiru Fixed that IfAction state is not reset after disabling since 4a8bc1b
poiru authored
567
1fece1e @poiru Additional change to f2a494b
poiru authored
568 return false;
f2a494b @poiru Fixed that IfAction state is not reset after disabling since 4a8bc1b
poiru authored
569 }
570 }
571
30edc89
Kimmo Pekkola authored
572 /*
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
573 ** Returns the value of the measure.
574 **
30edc89
Kimmo Pekkola authored
575 */
576 double CMeasure::GetValue()
577 {
578 // Invert if so requested
579 if (m_Invert)
580 {
581 return m_MaxValue - m_Value + m_MinValue;
582 }
583
584 return m_Value;
585 }
586
587 /*
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
588 ** Returns the relative value of the measure (0.0 - 1.0).
589 **
30edc89
Kimmo Pekkola authored
590 */
591 double CMeasure::GetRelativeValue()
592 {
62519fb @spx268 MeasureDiskSpace: Improved total size detection for removable device.
spx268 authored
593 double range = GetValueRange();
30edc89
Kimmo Pekkola authored
594
62519fb @spx268 MeasureDiskSpace: Improved total size detection for removable device.
spx268 authored
595 if (range != 0.0)
596 {
597 double value = GetValue();
598
599 value = min(m_MaxValue, value);
600 value = max(m_MinValue, value);
30edc89
Kimmo Pekkola authored
601
62519fb @spx268 MeasureDiskSpace: Improved total size detection for removable device.
spx268 authored
602 value -= m_MinValue;
603
604 return value / range;
605 }
30edc89
Kimmo Pekkola authored
606
62519fb @spx268 MeasureDiskSpace: Improved total size detection for removable device.
spx268 authored
607 return 1.0;
30edc89
Kimmo Pekkola authored
608 }
609
610 /*
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
611 ** Returns the value range.
612 **
30edc89
Kimmo Pekkola authored
613 */
614 double CMeasure::GetValueRange()
615 {
616 return m_MaxValue - m_MinValue;
617 }
618
619 /*
620 ** This method returns the value as text string. The actual value is
621 ** get with GetValue() so we don't have to worry about m_Invert.
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
622 **
30edc89
Kimmo Pekkola authored
623 ** autoScale If true, scale the value automatically to some sensible range.
624 ** scale The scale to use if autoScale is false.
6fe8fd0 @jsmorley Fix by spx for the problem where r538 caused some backwards compatibi…
jsmorley authored
625 ** decimals Number of decimals used in the value. If -1, get rid of ".00000" for dynamic variables.
30edc89
Kimmo Pekkola authored
626 ** percentual Return the value as % from the maximum value.
627 */
235841e @spx268 Added AutoScale=2 and "k" postfix to Meter=STRING.
spx268 authored
628 const WCHAR* CMeasure::GetStringValue(AUTOSCALE autoScale, double scale, int decimals, bool percentual)
30edc89
Kimmo Pekkola authored
629 {
e2ce7d5 @poiru Tweaks
poiru authored
630 static WCHAR buffer[128];
2cb88b0 @spx268 Shrunk some string buffer size.
spx268 authored
631 WCHAR format[32];
30edc89
Kimmo Pekkola authored
632
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
633 if (percentual)
30edc89
Kimmo Pekkola authored
634 {
5ab0192 @spx268 NumOfDecimals is now enabled when Percentual=1 in STRING meter.
spx268 authored
635 double val = 100.0 * GetRelativeValue();
636
e2ce7d5 @poiru Tweaks
poiru authored
637 _snwprintf_s(format, _TRUNCATE, L"%%.%if", decimals);
638 _snwprintf_s(buffer, _TRUNCATE, format, val);
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
639 }
640 else if (autoScale != AUTOSCALE_OFF)
30edc89
Kimmo Pekkola authored
641 {
235841e @spx268 Added AutoScale=2 and "k" postfix to Meter=STRING.
spx268 authored
642 GetScaledValue(autoScale, decimals, GetValue(), buffer, _countof(buffer));
30edc89
Kimmo Pekkola authored
643 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
644 else
30edc89
Kimmo Pekkola authored
645 {
54537c6 @spx268 Code cleanup.
spx268 authored
646 double val = GetValue() / scale;
5ab0192 @spx268 NumOfDecimals is now enabled when Percentual=1 in STRING meter.
spx268 authored
647
e2ce7d5 @poiru Tweaks
poiru authored
648 if (decimals == -1)
6fe8fd0 @jsmorley Fix by spx for the problem where r538 caused some backwards compatibi…
jsmorley authored
649 {
341e9d2 @spx268 Removed trailing zeros when DynamicVariables=1 even if a value is suc…
spx268 authored
650 int len = _snwprintf_s(buffer, _TRUNCATE, L"%.5f", val);
651 RemoveTrailingZero(buffer, len);
6fe8fd0 @jsmorley Fix by spx for the problem where r538 caused some backwards compatibi…
jsmorley authored
652 }
30edc89
Kimmo Pekkola authored
653 else
654 {
d1a7b60 @spx268 Core dll:
spx268 authored
655 _snwprintf_s(format, _TRUNCATE, L"%%.%if", decimals);
656 _snwprintf_s(buffer, _TRUNCATE, format, val);
30edc89
Kimmo Pekkola authored
657 }
658 }
659
660 return CheckSubstitute(buffer);
661 }
662
235841e @spx268 Added AutoScale=2 and "k" postfix to Meter=STRING.
spx268 authored
663 void CMeasure::GetScaledValue(AUTOSCALE autoScale, int decimals, double theValue, WCHAR* buffer, size_t sizeInWords)
30edc89
Kimmo Pekkola authored
664 {
2cb88b0 @spx268 Shrunk some string buffer size.
spx268 authored
665 WCHAR format[32];
30edc89
Kimmo Pekkola authored
666 double value = 0;
667
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
668 if (decimals == 0)
30edc89
Kimmo Pekkola authored
669 {
d1a7b60 @spx268 Core dll:
spx268 authored
670 wcsncpy_s(format, L"%.0f", _TRUNCATE);
30edc89
Kimmo Pekkola authored
671 }
672 else
673 {
d1a7b60 @spx268 Core dll:
spx268 authored
674 _snwprintf_s(format, _TRUNCATE, L"%%.%if", decimals);
30edc89
Kimmo Pekkola authored
675 }
676
3bf00bc @spx268 Minor tweak.
spx268 authored
677 const double* tblScale =
678 g_TblScale[(autoScale == AUTOSCALE_1000 || autoScale == AUTOSCALE_1000K) ? AUTOSCALE_INDEX_1000 : AUTOSCALE_INDEX_1024];
235841e @spx268 Added AutoScale=2 and "k" postfix to Meter=STRING.
spx268 authored
679
3bf00bc @spx268 Minor tweak.
spx268 authored
680 if (theValue >= tblScale[0])
30edc89
Kimmo Pekkola authored
681 {
3bf00bc @spx268 Minor tweak.
spx268 authored
682 value = theValue / tblScale[0];
d1a7b60 @spx268 Core dll:
spx268 authored
683 wcsncat_s(format, L" T", _TRUNCATE);
30edc89
Kimmo Pekkola authored
684 }
3bf00bc @spx268 Minor tweak.
spx268 authored
685 else if (theValue >= tblScale[1])
30edc89
Kimmo Pekkola authored
686 {
3bf00bc @spx268 Minor tweak.
spx268 authored
687 value = theValue / tblScale[1];
d1a7b60 @spx268 Core dll:
spx268 authored
688 wcsncat_s(format, L" G", _TRUNCATE);
30edc89
Kimmo Pekkola authored
689 }
3bf00bc @spx268 Minor tweak.
spx268 authored
690 else if (theValue >= tblScale[2])
30edc89
Kimmo Pekkola authored
691 {
3bf00bc @spx268 Minor tweak.
spx268 authored
692 value = theValue / tblScale[2];
d1a7b60 @spx268 Core dll:
spx268 authored
693 wcsncat_s(format, L" M", _TRUNCATE);
30edc89
Kimmo Pekkola authored
694 }
3bf00bc @spx268 Minor tweak.
spx268 authored
695 else if (autoScale == AUTOSCALE_1024K || autoScale == AUTOSCALE_1000K || theValue >= tblScale[3])
30edc89
Kimmo Pekkola authored
696 {
3bf00bc @spx268 Minor tweak.
spx268 authored
697 value = theValue / tblScale[3];
d1a7b60 @spx268 Core dll:
spx268 authored
698 wcsncat_s(format, L" k", _TRUNCATE);
30edc89
Kimmo Pekkola authored
699 }
700 else
701 {
702 value = theValue;
3bf00bc @spx268 Minor tweak.
spx268 authored
703 wcsncat_s(format, L" ", _TRUNCATE);
30edc89
Kimmo Pekkola authored
704 }
d1a7b60 @spx268 Core dll:
spx268 authored
705 _snwprintf_s(buffer, sizeInWords, _TRUNCATE, format, value);
30edc89
Kimmo Pekkola authored
706 }
707
341e9d2 @spx268 Removed trailing zeros when DynamicVariables=1 even if a value is suc…
spx268 authored
708 void CMeasure::RemoveTrailingZero(WCHAR* str, int strLen)
709 {
710 --strLen;
711 while (strLen >= 0)
712 {
713 if (str[strLen] == L'0')
714 {
715 str[strLen] = L'\0';
716 --strLen;
717 }
718 else
719 {
720 if (str[strLen] == L'.')
721 {
722 str[strLen] = L'\0';
723 }
724 break;
725 }
726 }
727 }
30edc89
Kimmo Pekkola authored
728
729 /*
730 ** Creates the given measure. This is the factory method for the measures.
731 ** If new measures are implemented this method needs to be updated.
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
732 **
30edc89
Kimmo Pekkola authored
733 */
fe9fd9f @spx268 Code cleanup.
spx268 authored
734 CMeasure* CMeasure::Create(const WCHAR* measure, CMeterWindow* meterWindow, const WCHAR* name)
30edc89
Kimmo Pekkola authored
735 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
736 // Comparison is caseinsensitive
30edc89
Kimmo Pekkola authored
737
a209bf1 @spx268 - Fixed Button issue: http://rainmeter.net/forum/viewtopic.php?t=1027…
spx268 authored
738 if (_wcsicmp(L"CPU", measure) == 0)
30edc89
Kimmo Pekkola authored
739 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
740 return new CMeasureCPU(meterWindow, name);
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
741 }
742 else if (_wcsicmp(L"Memory", measure) == 0)
30edc89
Kimmo Pekkola authored
743 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
744 return new CMeasureMemory(meterWindow, name);
30edc89
Kimmo Pekkola authored
745 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
746 else if (_wcsicmp(L"NetIn", measure) == 0)
30edc89
Kimmo Pekkola authored
747 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
748 return new CMeasureNetIn(meterWindow, name);
30edc89
Kimmo Pekkola authored
749 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
750 else if (_wcsicmp(L"NetOut", measure) == 0)
30edc89
Kimmo Pekkola authored
751 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
752 return new CMeasureNetOut(meterWindow, name);
30edc89
Kimmo Pekkola authored
753 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
754 else if (_wcsicmp(L"NetTotal", measure) == 0)
30edc89
Kimmo Pekkola authored
755 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
756 return new CMeasureNetTotal(meterWindow, name);
30edc89
Kimmo Pekkola authored
757 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
758 else if (_wcsicmp(L"PhysicalMemory", measure) == 0)
30edc89
Kimmo Pekkola authored
759 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
760 return new CMeasurePhysicalMemory(meterWindow, name);
30edc89
Kimmo Pekkola authored
761 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
762 else if (_wcsicmp(L"SwapMemory", measure) == 0)
30edc89
Kimmo Pekkola authored
763 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
764 return new CMeasureVirtualMemory(meterWindow, name);
30edc89
Kimmo Pekkola authored
765 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
766 else if (_wcsicmp(L"FreeDiskSpace", measure) == 0)
30edc89
Kimmo Pekkola authored
767 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
768 return new CMeasureDiskSpace(meterWindow, name);
30edc89
Kimmo Pekkola authored
769 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
770 else if (_wcsicmp(L"Uptime", measure) == 0)
30edc89
Kimmo Pekkola authored
771 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
772 return new CMeasureUptime(meterWindow, name);
30edc89
Kimmo Pekkola authored
773 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
774 else if (_wcsicmp(L"Time", measure) == 0)
30edc89
Kimmo Pekkola authored
775 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
776 return new CMeasureTime(meterWindow, name);
30edc89
Kimmo Pekkola authored
777 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
778 else if (_wcsicmp(L"Plugin", measure) == 0)
30edc89
Kimmo Pekkola authored
779 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
780 return new CMeasurePlugin(meterWindow, name);
30edc89
Kimmo Pekkola authored
781 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
782 else if (_wcsicmp(L"Registry", measure) == 0)
30edc89
Kimmo Pekkola authored
783 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
784 return new CMeasureRegistry(meterWindow, name);
30edc89
Kimmo Pekkola authored
785 }
a92bdd9 @poiru Cosmetic changes to code.
poiru authored
786 else if (_wcsicmp(L"Calc", measure) == 0)
30edc89
Kimmo Pekkola authored
787 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
788 return new CMeasureCalc(meterWindow, name);
30edc89
Kimmo Pekkola authored
789 }
cb4aa0a @poiru Script: Fixed that returning "" in Update() displayed 0 due to r885.
poiru authored
790 else if (_wcsicmp(L"Script", measure) == 0)
c516bf8 Added Lua Stuff
mapeki authored
791 {
fe9fd9f @spx268 Code cleanup.
spx268 authored
792 return new CMeasureScript(meterWindow, name);
c516bf8 Added Lua Stuff
mapeki authored
793 }
30edc89
Kimmo Pekkola authored
794
ea67809 @poiru Replaced throw with Log where possible
poiru authored
795 LogWithArgs(LOG_ERROR, L"Measure=%s is not valid in [%s]", measure, name);
30edc89
Kimmo Pekkola authored
796
797 return NULL;
798 }
799
800 /*
b21658b @poiru - Partially refactored bang handling code
poiru authored
801 ** Executes a custom bang.
30edc89
Kimmo Pekkola authored
802 **
803 */
b21658b @poiru - Partially refactored bang handling code
poiru authored
804 void CMeasure::Command(const std::wstring& command)
30edc89
Kimmo Pekkola authored
805 {
58a16ef @spx268 Fixed that !WriteKeyValue fails if filepath includes ".." like "skin.…
spx268 authored
806 LogWithArgs(LOG_WARNING, L"!CommandMeasure: Not supported by [%s]", m_Name.c_str());
30edc89
Kimmo Pekkola authored
807 }
Something went wrong with that request. Please try again.