Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma once
- #include <Updater.h>
- using namespace System;
- using namespace System::Runtime::InteropServices;
- namespace UpdaterDotNet {
- public ref class UpdateManager
- {
- public:
- UpdateManager();
- virtual ~UpdateManager();
- bool CheckForUpdates(String^ buildsUrl, UInt32 buildNumber);
- UInt32 GetNumUpdates();
- String^ GetDescription();
- bool DownloadUpdate();
- void CancelDownload();
- bool InstallUpdate(String^ password);
- bool ShowUpdateNotice();
- private:
- Updater* mUpdater;
- };
- UpdateManager :: UpdateManager()
- {
- mUpdater = new Updater();
- }
- UpdateManager :: ~UpdateManager()
- {
- delete mUpdater;
- }
- bool UpdateManager :: CheckForUpdates(String^ buildsUrl, UInt32 buildNumber)
- {
- return mUpdater->CheckForUpdates(
- (const char*)(Marshal::StringToHGlobalAnsi(buildsUrl)).ToPointer(),
- buildNumber);
- }
- UInt32 UpdateManager :: GetNumUpdates()
- {
- return mUpdater->GetNumUpdates();
- }
- String^ UpdateManager :: GetDescription()
- {
- return gcnew String(reinterpret_cast<const char*>(mUpdater->GetDescription()));
- }
- bool UpdateManager :: DownloadUpdate()
- {
- return mUpdater->DownloadUpdate(0);
- }
- void UpdateManager :: CancelDownload()
- {
- mUpdater->CancelDownload();
- }
- bool UpdateManager :: InstallUpdate(String^ password)
- {
- return mUpdater->InstallUpdate((const char*)(Marshal::StringToHGlobalAnsi(password)).ToPointer());
- }
- bool UpdateManager :: ShowUpdateNotice()
- {
- return mUpdater->ShowUpdateNotice(0);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement