-
Notifications
You must be signed in to change notification settings - Fork 1
/
PieceManager.h
57 lines (43 loc) · 968 Bytes
/
PieceManager.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#ifndef __PIECEMANAGER_H
#define __PIECEMANAGER_H
#include <wx/wx.h>
#include <wx/file.h>
#include <wx/filename.h>
#include <wx/ffile.h>
#include "_wxconfig.h"
#include <vector>
#include "Message.h"
namespace RAIN
{
class PieceEntry
{
public:
PieceEntry();
~PieceEntry();
void UpdateSize();
long size;
wxString hash;
};
class PieceManager : public RAIN::MessageHandler
{
public:
PieceManager();
~PieceManager();
void HandleMessage(RAIN::Message *msg);
void Tick();
int GetMessageHandlerID();
void UpdateConfig();
void UpdateFromFS();
unsigned long long GetCurrentUsage();
void ValidateSizeLimit();
bool HasGotPiece(const wxString& hash);
bool ImportPiece(RAIN::Message *pm);
bool ExportPiece(RAIN::Message *pm);
private:
wxString basedir;
std::vector<PieceEntry*> cache;
unsigned long long cacheLimit;
bool full;
};
}
#endif //__PIECEMANAGER_H