2
0
mirror of https://github.com/Laupetin/OpenAssetTools.git synced 2025-09-13 12:07:27 +00:00

Replace FileAPI with c++ streams and std::filesystem

This commit is contained in:
Jan
2021-03-03 14:04:35 +01:00
parent b6b0a57232
commit 1cd06668e0
96 changed files with 1355 additions and 1061 deletions

View File

@@ -1,5 +1,7 @@
#include "StepDumpData.h"
#include <fstream>
StepDumpData::StepDumpData(const unsigned int dumpCount)
{
m_dump_count = dumpCount;
@@ -10,7 +12,7 @@ void StepDumpData::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
uint8_t tempBuffer[128];
unsigned int dumpedBytes = 0;
FileAPI::File tempFile = FileAPI::Open("dump.dat", FileAPI::Mode::MODE_WRITE);
std::ofstream tempFile("dump.dat", std::fstream::out | std::fstream::binary);
while (dumpedBytes < m_dump_count)
{
@@ -25,14 +27,14 @@ void StepDumpData::PerformStep(ZoneLoader* zoneLoader, ILoadingStream* stream)
toDump = sizeof(tempBuffer);
}
const size_t loadedSize = stream->Load(tempBuffer, toDump);
const auto loadedSize = stream->Load(tempBuffer, toDump);
dumpedBytes += loadedSize;
if (loadedSize == 0)
break;
tempFile.Write(tempBuffer, 1, loadedSize);
tempFile.write(reinterpret_cast<char*>(tempBuffer), loadedSize);
}
tempFile.Close();
tempFile.close();
}