!I (1670414, 1670415, 1670416, 1670424, 1670431):
[CRYENGINE.git] / Code / Tools / CryCommonTools / XMLPakFileSink.cpp
blob98e216b1f74fd67aed43d1dbe341f52807097e64
1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
3 #include "StdAfx.h"
4 #include "XMLPakFileSink.h"
5 #include "StringHelpers.h"
7 XMLPakFileSink::XMLPakFileSink(IPakSystem* pakSystem, const string& archivePath, const string& filePath)
8 : pakSystem(pakSystem), filePath(filePath)
10 archive = pakSystem->OpenArchive(archivePath.c_str());
13 XMLPakFileSink::~XMLPakFileSink()
15 if (archive && pakSystem)
17 SYSTEMTIME st;
18 GetSystemTime(&st);
20 FILETIME ft;
21 ZeroStruct(ft);
22 const BOOL ok = SystemTimeToFileTime(&st, &ft);
24 LARGE_INTEGER lt;
25 lt.HighPart = ft.dwHighDateTime;
26 lt.LowPart = ft.dwLowDateTime;
28 const __int64 modTime = lt.QuadPart;;
30 pakSystem->AddToArchive(archive, filePath.c_str(), &data[0], int(data.size()), modTime);
31 pakSystem->CloseArchive(archive);
35 void XMLPakFileSink::Write(const char* text)
37 string asciiText = text;
38 int len = int(asciiText.size());
39 int start = int(data.size());
40 data.resize(data.size() + len);
41 memcpy(&data[start], asciiText.c_str(), len);