HoverRace  2.0
CheckUpdateServerDialog.h
Go to the documentation of this file.
1 #ifdef HR_LEGACY_BUILD
2 // CheckUpdateServer.h
3 // Header for the update checker.
4 //
5 // Copyright (c) 2009 Ryan Curtin
6 //
7 // Licensed under GrokkSoft HoverRace SourceCode License v1.0(the "License");
8 // you may not use this file except in compliance with the License.
9 //
10 // A copy of the license should have been attached to the package from which
11 // you have taken this file. If you can not find the license you can not use
12 // this file.
13 //
14 //
15 // The author makes no representations about the suitability of
16 // this software for any purpose. It is provided "as is" "AS IS",
17 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
18 // implied.
19 //
20 // See the License for the specific language governing permissions
21 // and limitations under the License.
22 
23 #ifndef CHECK_UPDATE_SERVER_H
24 #define CHECK_UPDATE_SERVER_H
25 
26 #include <string.h>
27 
28 #include "../../engine/Net/CancelFlag.h"
29 #include "UpdateDownloader.h"
30 
31 using namespace std;
32 
33 namespace HoverRace {
34 namespace Client {
35 
36 /***
37  * Dialog to check for HoverRace updates.
38  * Much of the code here is based on RoomList, RoomListDialog, and CheckRoomListDialog.
39  *
40  * @author Ryan Curtin
41  */
42 class CheckUpdateServerDialog {
43  public:
44  CheckUpdateServerDialog(string url);
45  ~CheckUpdateServerDialog();
46 
47  void CheckUpdatesFromUrl(const string &url,
48  Net::CancelFlagPtr cancelFlag = Net::CancelFlagPtr());
49 
50  void ShowModal(HINSTANCE hinst, HWND parent);
51 
52  protected:
53  enum result_t {
54  RESULT_UPTODATE,
55  RESULT_UPDATE,
56  RESULT_FAILED,
57  RESULT_CANCELED
58  };
59 
60  BOOL DlgProc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
61  static BOOL CALLBACK DlgFunc(HWND hwnd, UINT message, WPARAM wparam, LPARAM lparam);
62 
63  static const int WM_APP_UPDATE_CHECK_DONE = WM_APP + 20;
64 
65  private:
66  void ThreadProc(HWND hwnd);
67 
68  string url;
69  string errMsg;
70  boost::thread loadThread;
71  UpdateDownloaderPtr dlPtr;
72 
73 }; // class CheckUpdateServerDialog
74 
75 } // namespace Client
76 } // namespace HoverRace
77 
78 #endif
79 #endif
STL namespace.
Definition: Announcement.h:24