1
0

UpdateAutoDownload.cpp 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. #include "main.h"
  2. #include "api__ml_wire.h"
  3. #include "UpdateAutoDownload.h"
  4. int UpdateAutoDownload::episodes[] = {0, // AUTODOWNLOAD_NEVER
  5. 1, // AUTODOWNLOAD_LAST_ONE
  6. 2, // AUTODOWNLOAD_LAST_TWO
  7. 3, // AUTODOWNLOAD_LAST_THREE
  8. 5, // AUTODOWNLOAD_LAST_FIVE
  9. };
  10. const wchar_t *UpdateAutoDownload::GetTitle(int position, wchar_t *buffer, int bufferMax)
  11. {
  12. if (NULL == buffer)
  13. return NULL;
  14. INT stringId = IDS_ERROR_FYEO;
  15. switch (position)
  16. {
  17. case AUTODOWNLOAD_NEVER: stringId = IDS_ATD_NEVER; break;
  18. case AUTODOWNLOAD_LAST_ONE: stringId = IDS_ATD_LASTONE; break;
  19. case AUTODOWNLOAD_LAST_TWO: stringId = IDS_ATD_LASTTWO; break;
  20. case AUTODOWNLOAD_LAST_THREE: stringId = IDS_ATD_LASTTHREE; break;
  21. case AUTODOWNLOAD_LAST_FIVE: stringId = IDS_ATD_LASTFIVE; break;
  22. }
  23. return WASABI_API_LNGSTRINGW_BUF(stringId, buffer, bufferMax);
  24. }
  25. bool UpdateAutoDownload::GetAutoDownload(int selection)
  26. {
  27. if (selection == AUTODOWNLOAD_NEVER)
  28. return false;
  29. else
  30. return true;
  31. }
  32. int UpdateAutoDownload::GetAutoDownloadEpisodes(int selection)
  33. {
  34. if (selection >= 0 && selection < AUTODOWNLOAD_NUMENTRIES)
  35. return episodes[selection];
  36. else
  37. return 0;
  38. }
  39. int UpdateAutoDownload::GetSelection(int selEpisodes, bool autoDownload)
  40. {
  41. if (!autoDownload)
  42. return AUTODOWNLOAD_NEVER;
  43. for (int i = AUTODOWNLOAD_LAST_ONE;i < AUTODOWNLOAD_NUMENTRIES;i++)
  44. if (selEpisodes == episodes[i])
  45. return i;
  46. return AUTODOWNLOAD_LAST_ONE;
  47. }