summaryrefslogtreecommitdiff
path: root/update.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'update.cpp')
-rw-r--r--update.cpp32
1 files changed, 32 insertions, 0 deletions
diff --git a/update.cpp b/update.cpp
new file mode 100644
index 00000000..9dcf66cb
--- /dev/null
+++ b/update.cpp
@@ -0,0 +1,32 @@
+#include "binaryninjaapi.h"
+
+using namespace BinaryNinja;
+using namespace std;
+
+
+vector<UpdateChannel> UpdateChannel::GetList()
+{
+ size_t count;
+ char* errors;
+ BNUpdateChannel* channels = BNGetUpdateChannels(&count, &errors);
+
+ if (errors)
+ {
+ string errorStr = errors;
+ BNFreeString(errors);
+ throw UpdateException(errorStr);
+ }
+
+ vector<UpdateChannel> result;
+ for (size_t i = 0; i < count; i++)
+ {
+ UpdateChannel channel;
+ channel.name = channels[i].name;
+ channel.description = channels[i].description;
+ channel.latestVersion = channels[i].latestVersion;
+ result.push_back(channel);
+ }
+
+ BNFreeUpdateChannelList(channels, count);
+ return result;
+}