summaryrefslogtreecommitdiff
path: root/plugins/TrafficCounter/src/misc.h
blob: 0a6aa9131c95296aba3f25977d1806ebc3ef504a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
typedef struct
{
	TCHAR Alignment;	// Âûðàâíèâàíèå. L - ê ëåâîé ãðàíèöå, R - ê ïðàâîé.
	WORD Interval;		// Ðàññòîÿíèå, íà êîòîðîå ãðàíèöà ñòðîêè îòñòîèò îò ëåâîãî êðàÿ ôðåéìà.
	TCHAR *String;		// Ñîáñòâåííî ñòðîêà.
} RowItemInfo;

/* Ôóíêöèÿ ðàçáèðàåò ñòðîêó è âîçâðàùàåò ñïèñîê òåãîâ è ñîîòâåòñòâóþùèõ èì ñòðîê.
Àðãóìåíòû:
InputString - ñòðîêà äëÿ ðàçáîðà;
RowItemsList - ñïèñîê íàéäåííûõ ýëåìåíòîâ.
Âîçâðàùàåìîå çíà÷åíèå - êîëè÷åñòâî ýëåìåíòîâ â ñïèñêàõ. */
WORD GetRowItems(TCHAR *InputString, RowItemInfo **RowItemsList);

/* Ôóíêöèÿ âîçâðàùàåò êîëè÷åñòâî äíåé â óêàçàííîì ìåñÿöå óêàçàííîãî ãîäà. */
BYTE DaysInMonth(BYTE Month, WORD Year);

// Ôóíêöèÿ îïðåäåëÿåò äåíü íåäåëè ïî äàòå
// 7 - ÂÑ, 1 - ÏÍ è ò. ä.
BYTE DayOfWeek(BYTE Day, BYTE Month, WORD Year);

/* Àðãóìåíòû:
	Value - êîëè÷åñòâî áàéò;
	Unit - åäèíèöû èçìåðåíèÿ (0 - áàéòû, 1 - êèëîáàéòû, 2 - ìåãàáàéòû, 3 - àâòîìàòè÷åñêè);
	Buffer - àäðåñ ñòðîêè äëÿ çàïèñè ðåçóëüòàòà;
	Size - ðàçìåð áóôåðà.
Âîçâðàùàåìîå çíà÷åíèå: òðåáóåìûé ðàçìåð áóôåðà. */
size_t GetFormattedTraffic(DWORD Value, BYTE Unit, TCHAR *Buffer, size_t Size);

size_t GetDurationFormatM(DWORD Duration, TCHAR *Format, TCHAR *Buffer, WORD Size);

signed short int TimeCompare(SYSTEMTIME st1, SYSTEMTIME st2);