2019-11-06 11:29:08 +00:00
|
|
|
#pragma once
|
|
|
|
|
2019-11-14 20:07:43 +00:00
|
|
|
#include <assert.h>
|
2019-11-06 11:29:08 +00:00
|
|
|
#include "files.h"
|
|
|
|
#include "zstring.h"
|
|
|
|
#include "tarray.h"
|
2019-11-14 20:07:43 +00:00
|
|
|
#include "filesystem/resourcefile.h"
|
2019-11-06 11:29:08 +00:00
|
|
|
|
|
|
|
class CompositeSavegameWriter
|
|
|
|
{
|
2019-11-14 20:07:43 +00:00
|
|
|
FString filename;
|
2019-11-06 11:29:08 +00:00
|
|
|
TDeletingArray<BufferWriter*> subfiles;
|
|
|
|
TArray<FString> subfilenames;
|
|
|
|
TArray<bool> isCompressed;
|
2019-11-14 20:07:43 +00:00
|
|
|
|
|
|
|
FCompressedBuffer CompressElement(BufferWriter* element, bool compress);
|
2019-11-06 11:29:08 +00:00
|
|
|
public:
|
2019-11-14 20:07:43 +00:00
|
|
|
void Clear()
|
|
|
|
{
|
2020-01-07 17:53:16 +00:00
|
|
|
isCompressed.Clear();
|
|
|
|
subfilenames.Clear();
|
2020-01-06 19:01:18 +00:00
|
|
|
subfiles.DeleteAndClear();
|
2020-01-07 17:53:16 +00:00
|
|
|
filename = "";
|
2019-11-14 20:07:43 +00:00
|
|
|
}
|
|
|
|
void SetFileName(const char* fn)
|
|
|
|
{
|
|
|
|
filename = fn;
|
|
|
|
}
|
|
|
|
void SetFileName(const FString& fn)
|
|
|
|
{
|
|
|
|
filename = fn;
|
|
|
|
}
|
|
|
|
~CompositeSavegameWriter()
|
|
|
|
{
|
|
|
|
assert(subfiles.Size() == 0); // must be written out.
|
|
|
|
}
|
|
|
|
FileWriter& NewElement(const char* filename, bool compress = true);
|
|
|
|
bool WriteToFile();
|
2019-11-06 11:29:08 +00:00
|
|
|
};
|
|
|
|
|