mirror of
https://github.com/xtjoeytx/GServer-v2.git
synced 2026-05-09 00:59:55 -04:00
8751fa4290
Updated CFileSystem. Implemented a new global file download method in TServerList. It uses less bandwidth.
47 lines
1.2 KiB
C++
47 lines
1.2 KiB
C++
#ifndef CFILESYSTEM_H
|
|
#define CFILESYSTEM_H
|
|
|
|
#include <map>
|
|
#include "ICommon.h"
|
|
#include "CString.h"
|
|
//#include "TServer.h"
|
|
|
|
class TServer;
|
|
class CFileSystem
|
|
{
|
|
public:
|
|
CFileSystem() : server(0) { }
|
|
CFileSystem(TServer* pServer);
|
|
|
|
void setServer(TServer* pServer) { server = pServer; }
|
|
|
|
void addDir(const CString& dir);
|
|
void removeDir(const CString& dir);
|
|
void addFile(const CString& file);
|
|
void removeFile(const CString& file);
|
|
void resync();
|
|
|
|
CString find(const CString& file) const;
|
|
CString findi(const CString& file) const;
|
|
CString finddir(const CString& file) const;
|
|
CString finddiri(const CString& file) const;
|
|
CString load(const CString& file) const;
|
|
time_t getModTime(const CString& file) const;
|
|
bool setModTime(const CString& file, time_t modTime) const;
|
|
int getFileSize(const CString& file) const;
|
|
std::map<CString, CString>* getFileList() { return &fileList; }
|
|
std::map<CString, CString>* getDirList() { return &dirList; }
|
|
|
|
mutable boost::recursive_mutex m_preventChange;
|
|
|
|
static void fixPathSeparators(CString* pPath);
|
|
|
|
private:
|
|
TServer* server;
|
|
CString basedir;
|
|
std::map<CString, CString> fileList;
|
|
std::map<CString, CString> dirList;
|
|
};
|
|
|
|
#endif
|