Files
LifeProject/LifeCore/vfs/zip/IZipFile.cpp
T
2025-05-13 02:46:21 +03:00

41 lines
1.1 KiB
C++

#include "IZipFile.h"
#include "IZipFileContentProvider.h"
namespace LifeCore
{
IZipFile::IZipFile()
{
isOpen = false;
}
IDataStreamPtr IZipFile::OpenWrite(int mode)
{
UNREFERENCED_PARAMETER(mode);
g_stream = new IZipStream(((IZipFileContentProvider*)this->Provider)->g_sourceFile, EntryName, FA_WRITE, ((IZipFileContentProvider*)this->Provider)->g_rootFolder);
return IDataStreamPtr(g_stream);
}
IDataStreamPtr IZipFile::OpenReadWrite(int mode)
{
UNREFERENCED_PARAMETER(mode);
throw;
//return IDataStreamPtr(0);
//throw new NotImplementedException();
}
IDataStreamPtr IZipFile::OpenRead()
{
IZipFileContentProvider* prov = (IZipFileContentProvider*)this->Provider;
prov->g_sourceFile = unzOpen(prov->g_rootFolder.c_str());
g_stream = new IZipStream(prov->g_sourceFile, EntryName, FA_READ, NULL);
return IDataStreamPtr(g_stream);
//g_stream = new IZipStream((this->Provider as IZipFileContentProvider).GetSource(), EntryName, FA_READ);
//return g_stream;
}
void IZipFile::Close()
{
if(g_stream)
{
g_stream->Close();
delete g_stream;
}
}
}