aboutsummaryrefslogtreecommitdiff
path: root/Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp
diff options
context:
space:
mode:
authorJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
committerJef <jef@targetspot.com>2024-09-24 08:54:57 -0400
commit20d28e80a5c861a9d5f449ea911ab75b4f37ad0d (patch)
tree12f17f78986871dd2cfb0a56e5e93b545c1ae0d0 /Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp
parent537bcbc86291b32fc04ae4133ce4d7cac8ebe9a7 (diff)
downloadwinamp-20d28e80a5c861a9d5f449ea911ab75b4f37ad0d.tar.gz
Initial community commit
Diffstat (limited to 'Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp')
-rw-r--r--Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp57
1 files changed, 57 insertions, 0 deletions
diff --git a/Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp b/Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp
new file mode 100644
index 00000000..521a0b83
--- /dev/null
+++ b/Src/Plugins/Library/ml_wire/UpdateAutoDownload.cpp
@@ -0,0 +1,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;
+
+} \ No newline at end of file