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 "Dumping/CsvWriter.h"
|
||||
|
||||
using namespace T6;
|
||||
|
||||
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)
|
||||
{
|
||||
char separator[]{ ',' };
|
||||
char newLine[]{ '\n' };
|
||||
CsvWriter csv(out);
|
||||
|
||||
for(int row = 0; row < asset->rowCount; row++)
|
||||
{
|
||||
for(int column = 0; column < asset->columnCount; column++)
|
||||
{
|
||||
const auto cell = &asset->values[column + row * asset->columnCount];
|
||||
|
||||
if (column != 0)
|
||||
{
|
||||
out->Write(separator, 1, sizeof separator);
|
||||
}
|
||||
|
||||
if(cell->string && *cell->string)
|
||||
{
|
||||
out->Write(cell->string, 1, strlen(cell->string));
|
||||
}
|
||||
csv.WriteColumn(cell->string);
|
||||
}
|
||||
|
||||
if (row != asset->rowCount - 1)
|
||||
{
|
||||
out->Write(newLine, 1, sizeof newLine);
|
||||
}
|
||||
csv.NextRow();
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user