From 21f0f2d62247bcc45c07af0a363c7e39208f4110 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Fri, 16 Oct 2015 19:05:03 -0400 Subject: Implement update version list API --- binaryninjaapi.h | 9 +++++++++ update.cpp | 28 ++++++++++++++++++++++++++++ 2 files changed, 37 insertions(+) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 04749e97..27e2c565 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -1356,4 +1356,13 @@ namespace BinaryNinja static std::vector GetList(); }; + + struct UpdateVersion + { + std::string version; + std::string notes; + time_t time; + + static std::vector GetChannelVersions(const std::string& channel); + }; } diff --git a/update.cpp b/update.cpp index 9dcf66cb..545305b0 100644 --- a/update.cpp +++ b/update.cpp @@ -30,3 +30,31 @@ vector UpdateChannel::GetList() BNFreeUpdateChannelList(channels, count); return result; } + + +vector UpdateVersion::GetChannelVersions(const string& channel) +{ + size_t count; + char* errors; + BNUpdateVersion* versions = BNGetUpdateChannelVersions(channel.c_str(), &count, &errors); + + if (errors) + { + string errorStr = errors; + BNFreeString(errors); + throw UpdateException(errorStr); + } + + vector result; + for (size_t i = 0; i < count; i++) + { + UpdateVersion version; + version.version = versions[i].version; + version.notes = versions[i].notes; + version.time = (time_t)versions[i].time; + result.push_back(version); + } + + BNFreeUpdateChannelVersionList(versions, count); + return result; +} -- cgit v1.3.1