From 72dba52eb3d90abae437e4658700167f47a05cf5 Mon Sep 17 00:00:00 2001 From: Rusty Wagner Date: Wed, 28 Oct 2015 22:28:48 -0400 Subject: Implement auto update functionality --- binaryninjaapi.h | 8 ++++++++ update.cpp | 39 +++++++++++++++++++++++++++++++++++++++ 2 files changed, 47 insertions(+) diff --git a/binaryninjaapi.h b/binaryninjaapi.h index 46d675f2..fe4acd30 100644 --- a/binaryninjaapi.h +++ b/binaryninjaapi.h @@ -181,6 +181,14 @@ namespace BinaryNinja std::string GetVersionString(); uint32_t GetBuildId(); + bool AreAutoUpdatesEnabled(); + void SetAutoUpdatesEnabled(bool enabled); + uint64_t GetTimeSinceLastUpdateCheck(); + void UpdatesChecked(); + + std::string GetActiveUpdateChannel(); + void SetActiveUpdateChannel(const std::string& channel); + class DataBuffer { BNDataBuffer* m_buffer; diff --git a/update.cpp b/update.cpp index 90e3477b..1586c363 100644 --- a/update.cpp +++ b/update.cpp @@ -141,3 +141,42 @@ vector UpdateVersion::GetChannelVersions(const string& channel) BNFreeUpdateChannelVersionList(versions, count); return result; } + + +bool BinaryNinja::AreAutoUpdatesEnabled() +{ + return BNAreAutoUpdatesEnabled(); +} + + +void BinaryNinja::SetAutoUpdatesEnabled(bool enabled) +{ + BNSetAutoUpdatesEnabled(enabled); +} + + +uint64_t BinaryNinja::GetTimeSinceLastUpdateCheck() +{ + return BNGetTimeSinceLastUpdateCheck(); +} + + +void BinaryNinja::UpdatesChecked() +{ + BNUpdatesChecked(); +} + + +string BinaryNinja::GetActiveUpdateChannel() +{ + char* channel = BNGetActiveUpdateChannel(); + string result = channel; + BNFreeString(channel); + return result; +} + + +void BinaryNinja::SetActiveUpdateChannel(const string& channel) +{ + BNSetActiveUpdateChannel(channel.c_str()); +} -- cgit v1.3.1