mirror of
https://github.com/Laupetin/OpenAssetTools.git
synced 2025-04-21 00:25:44 +00:00
ObjWriting: Use CsvWriter class for StringTables
This commit is contained in:
parent
4b87e9c086
commit
3a69b3b0b0
@ -1,5 +1,7 @@
|
|||||||
#include "AssetDumperStringTable.h"
|
#include "AssetDumperStringTable.h"
|
||||||
|
|
||||||
|
#include "Dumping/CsvWriter.h"
|
||||||
|
|
||||||
using namespace T6;
|
using namespace T6;
|
||||||
|
|
||||||
bool AssetDumperStringTable::ShouldDump(StringTable* asset)
|
bool AssetDumperStringTable::ShouldDump(StringTable* asset)
|
||||||
@ -14,29 +16,16 @@ std::string AssetDumperStringTable::GetFileNameForAsset(Zone* zone, StringTable*
|
|||||||
|
|
||||||
void AssetDumperStringTable::DumpAsset(Zone* zone, StringTable* asset, FileAPI::File* out)
|
void AssetDumperStringTable::DumpAsset(Zone* zone, StringTable* asset, FileAPI::File* out)
|
||||||
{
|
{
|
||||||
char separator[]{ ',' };
|
CsvWriter csv(out);
|
||||||
char newLine[]{ '\n' };
|
|
||||||
|
|
||||||
for(int row = 0; row < asset->rowCount; row++)
|
for(int row = 0; row < asset->rowCount; row++)
|
||||||
{
|
{
|
||||||
for(int column = 0; column < asset->columnCount; column++)
|
for(int column = 0; column < asset->columnCount; column++)
|
||||||
{
|
{
|
||||||
const auto cell = &asset->values[column + row * asset->columnCount];
|
const auto cell = &asset->values[column + row * asset->columnCount];
|
||||||
|
csv.WriteColumn(cell->string);
|
||||||
if (column != 0)
|
|
||||||
{
|
|
||||||
out->Write(separator, 1, sizeof separator);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(cell->string && *cell->string)
|
|
||||||
{
|
|
||||||
out->Write(cell->string, 1, strlen(cell->string));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row != asset->rowCount - 1)
|
csv.NextRow();
|
||||||
{
|
|
||||||
out->Write(newLine, 1, sizeof newLine);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user