The Winamp Remote Control suite
a remote control client and plugin for Winamp 2.x, 5.x
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
ServerEnumerator.h
Go to the documentation of this file.
1 /*
2  * ServerEnumerator.h
3  *
4  * Created on: 29 Jan 2012
5  * Author: Patrick
6  */
7 
8 #ifndef SERVERENUMERATOR_H_
9 #define SERVERENUMERATOR_H_
10 
11 #include <vcl.h>
12 #pragma hdrstop
13 
14 #include <windows.h>
15 
16 /*
17  * TODO remove the VCL style callbacks and use some Observer pattern
18  */
19 
30  typedef void (__closure *TSEServerEvent)(const AnsiString& remoteName, const AnsiString& comment, const AnsiString& ip);
36  typedef void (__closure *TSEMessageEvent)(const AnsiString& message, const int Level);
41  typedef void (__closure *TSEProgressEvent)(const float complete);
42 
43 
45 public:
53  virtual ~ServerEnumerator();
54 
58  __property TSEServerEvent OnServer = {read = FServerEvent, write = FServerEvent};
59 
63  __property TSEMessageEvent OnMessage = {read = FMessageEvent, write = FMessageEvent};
64 
68  __property TSEProgressEvent OnProgress = {read = FProgressEvent, write = FProgressEvent};
69 
74  void enumerateServers();
75 
76 private:
77 
78  int resourcesProcessed_;
79  int resourceTotal_;
80 
81  TSEServerEvent FServerEvent;
82  TSEMessageEvent FMessageEvent;
83  TSEProgressEvent FProgressEvent;
84 
91  void debugOutput(const AnsiString & operation, const AnsiString & message);
97  void netErrorHandler(const DWORD dwErrorCode, const AnsiString& errorFunction);
102  void handleResource(const NETRESOURCE& resource);
108  BOOL enumerateFunc(const LPNETRESOURCE resourcePtr);
114  void addServer(const AnsiString& remoteName, const AnsiString& comment);
120  void addMessage(const AnsiString& message, const int Level);
121 
126  void updateProgress(const float complete);
127 
128 };
129 
130 #endif /* SERVERENUMERATOR_H_ */