aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp
blob: 521a0b830b978ff3c25c62482afe295c91624427 (plain) (blame)
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#include "main.h"
#include "api__ml_wire.h"
#include "UpdateAutoDownload.h"

int UpdateAutoDownload::episodes[] = {0,           // AUTODOWNLOAD_NEVER
									  1,           // AUTODOWNLOAD_LAST_ONE
									  2,           // AUTODOWNLOAD_LAST_TWO
									  3,           // AUTODOWNLOAD_LAST_THREE
									  5,           // AUTODOWNLOAD_LAST_FIVE
};

const wchar_t *UpdateAutoDownload::GetTitle(int position, wchar_t *buffer, int bufferMax)
{
	if (NULL == buffer) 
		return NULL;

	INT stringId = IDS_ERROR_FYEO;
	switch (position)
	{
		case AUTODOWNLOAD_NEVER:			stringId = IDS_ATD_NEVER; break;
		case AUTODOWNLOAD_LAST_ONE:		stringId = IDS_ATD_LASTONE; break;
		case AUTODOWNLOAD_LAST_TWO:		stringId = IDS_ATD_LASTTWO; break;
		case AUTODOWNLOAD_LAST_THREE:	stringId = IDS_ATD_LASTTHREE; break;
		case AUTODOWNLOAD_LAST_FIVE:	stringId = IDS_ATD_LASTFIVE; break;
	}
	return WASABI_API_LNGSTRINGW_BUF(stringId, buffer, bufferMax);
}


bool UpdateAutoDownload::GetAutoDownload(int selection)
{
	if (selection == AUTODOWNLOAD_NEVER)
		return false;
	else
		return true;
}

int UpdateAutoDownload::GetAutoDownloadEpisodes(int selection)
{
	if (selection >= 0 && selection < AUTODOWNLOAD_NUMENTRIES)
		return episodes[selection];
	else
		return 0;
}

int UpdateAutoDownload::GetSelection(int selEpisodes, bool autoDownload)
{
	if (!autoDownload)
		return AUTODOWNLOAD_NEVER;

	for (int i = AUTODOWNLOAD_LAST_ONE;i < AUTODOWNLOAD_NUMENTRIES;i++)
		if (selEpisodes == episodes[i])
			return i;

	return AUTODOWNLOAD_LAST_ONE;

}