diff options
| author | Rusty Wagner <rusty@vector35.com> | 2015-10-16 19:05:03 -0400 |
|---|---|---|
| committer | Rusty Wagner <rusty@vector35.com> | 2015-10-16 19:05:17 -0400 |
| commit | 21f0f2d62247bcc45c07af0a363c7e39208f4110 (patch) | |
| tree | c7c31da5e26fc6fd418d3dde8cdd704e987adbe3 | |
| parent | cb87ea835ed3d4f01f91a9e67c2fc61cab18bd2c (diff) | |
Implement update version list API
| -rw-r--r-- | binaryninjaapi.h | 9 | ||||
| -rw-r--r-- | update.cpp | 28 |
2 files changed, 37 insertions, 0 deletions
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<UpdateChannel> GetList(); }; + + struct UpdateVersion + { + std::string version; + std::string notes; + time_t time; + + static std::vector<UpdateVersion> GetChannelVersions(const std::string& channel); + }; } @@ -30,3 +30,31 @@ vector<UpdateChannel> UpdateChannel::GetList() BNFreeUpdateChannelList(channels, count); return result; } + + +vector<UpdateVersion> 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<UpdateVersion> 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; +} |
