1 // Copyright 2001-2018 Crytek GmbH / Crytek Group. All rights reserved.
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
)
22 const BOOL ok
= SystemTimeToFileTime(&st
, &ft
);
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
);