Advertisement
Guest User

Untitled

a guest
May 1st, 2013
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.52 KB | None | 0 0
  1. #pragma once
  2.  
  3. #include <Updater.h>
  4.  
  5. using namespace System;
  6. using namespace System::Runtime::InteropServices;
  7.  
  8. namespace UpdaterDotNet {
  9.  
  10.     public ref class UpdateManager
  11.     {
  12.         public:
  13.             UpdateManager();
  14.             virtual ~UpdateManager();
  15.             bool CheckForUpdates(String^ buildsUrl, UInt32 buildNumber);
  16.             UInt32 GetNumUpdates();
  17.             String^ GetDescription();
  18.             bool DownloadUpdate();
  19.             void CancelDownload();
  20.             bool InstallUpdate(String^ password);
  21.             bool ShowUpdateNotice();
  22.  
  23.         private:
  24.             Updater* mUpdater;
  25.     };
  26.  
  27.     UpdateManager :: UpdateManager()
  28.     {
  29.         mUpdater = new Updater();
  30.     }
  31.  
  32.     UpdateManager :: ~UpdateManager()
  33.     {
  34.         delete mUpdater;
  35.     }
  36.  
  37.     bool UpdateManager :: CheckForUpdates(String^ buildsUrl, UInt32 buildNumber)
  38.     {
  39.         return mUpdater->CheckForUpdates(
  40.             (const char*)(Marshal::StringToHGlobalAnsi(buildsUrl)).ToPointer(),
  41.             buildNumber);
  42.     }
  43.  
  44.     UInt32 UpdateManager :: GetNumUpdates()
  45.     {
  46.         return mUpdater->GetNumUpdates();
  47.     }
  48.  
  49.     String^ UpdateManager :: GetDescription()
  50.     {
  51.         return gcnew String(reinterpret_cast<const char*>(mUpdater->GetDescription()));
  52.     }
  53.  
  54.     bool UpdateManager :: DownloadUpdate()
  55.     {
  56.         return mUpdater->DownloadUpdate(0);
  57.     }
  58.  
  59.     void UpdateManager :: CancelDownload()
  60.     {
  61.         mUpdater->CancelDownload();
  62.     }
  63.  
  64.     bool UpdateManager :: InstallUpdate(String^ password)
  65.     {
  66.         return mUpdater->InstallUpdate((const char*)(Marshal::StringToHGlobalAnsi(password)).ToPointer());
  67.     }
  68.  
  69.     bool UpdateManager :: ShowUpdateNotice()
  70.     {
  71.         return mUpdater->ShowUpdateNotice(0);
  72.     }
  73. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement