struct FileCollectionFile
{
void GetFileLines(Vector<String> &Lines);
String Filename;
Vector<BYTE> Data;
};
class FileCollection
{
public:
FileCollection();
~FileCollection();
void FreeMemory();
void LoadCompressed(const String &Filename);
void SaveCompressed(const String &Filename);
void DumpCollectionToDisk();
void AddFileFromMemory(const String &FileCollectionName, const Vector<BYTE> &Data);
void AddFileFromDisk(const String &FileCollectionName, const String &ExistingFilename);
void RemoveFile(const String &FileCollectionName);
FileCollectionFile* AddAndUpdateFile(const String &FileCollectionName, const String &ExistingFilename);
FileCollectionFile* FindFile(const String &FileCollectionName);
const FileCollectionFile* FindFile(const String &FileCollectionName) const;
void GetFileLines(const String &Filename, Vector<String> &Lines);
__forceinline UINT FileCount()
{
return _FileList.Length();
}
__forceinline const FileCollectionFile& GetFile(UINT Index)
{
return *(_FileList[Index]);
}
private:
void MuddleData(Vector<BYTE> &Data);
mutable Mutex _FileListMutex;
Vector<FileCollectionFile *> _FileList;
map<String, FileCollectionFile *, String::LexicographicComparison> _FileMap;
};