summaryrefslogtreecommitdiff
path: root/plugins/TrafficCounter/src/misc.h
blob: d0d784e6cfbe01e3fdfd8c209c7c50b751a7ab80 (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
{
	wchar_t Alignment;	// Âûðàâíèâàíèå. L - ê ëåâîé ãðàíèöå, R - ê ïðàâîé.
	WORD Interval;		// Ðàññòîÿíèå, íà êîòîðîå ãðàíèöà ñòðîêè îòñòîèò îò ëåâîãî êðàÿ ôðåéìà.
	wchar_t *String;		// Ñîáñòâåííî ñòðîêà.
} RowItemInfo;

/* Ôóíêöèÿ ðàçáèðàåò ñòðîêó è âîçâðàùàåò ñïèñîê òåãîâ è ñîîòâåòñòâóþùèõ èì ñòðîê.
Àðãóìåíòû:
InputString - ñòðîêà äëÿ ðàçáîðà;
RowItemsList - ñïèñîê íàéäåííûõ ýëåìåíòîâ.
Âîçâðàùàåìîå çíà÷åíèå - êîëè÷åñòâî ýëåìåíòîâ â ñïèñêàõ. */
WORD GetRowItems(wchar_t *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, wchar_t *Buffer, size_t Size);

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

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