Export some simple data from EXD
This commit is contained in:
parent
d428c6c3f5
commit
3befb9070b
2 changed files with 30 additions and 2 deletions
|
@ -1,8 +1,22 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <string_view>
|
#include <string_view>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
struct EXH;
|
struct EXH;
|
||||||
struct ExcelDataPagination;
|
struct ExcelDataPagination;
|
||||||
|
|
||||||
void readEXD(EXH& exh, ExcelDataPagination& page);
|
struct Column {
|
||||||
|
std::string data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Row {
|
||||||
|
std::vector<Column> data;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct EXD {
|
||||||
|
std::vector<Row> rows;
|
||||||
|
};
|
||||||
|
|
||||||
|
EXD readEXD(EXH& exh, ExcelDataPagination& page);
|
|
@ -26,7 +26,9 @@ struct ExcelDataRowHeader {
|
||||||
uint16_t rowCount;
|
uint16_t rowCount;
|
||||||
};
|
};
|
||||||
|
|
||||||
void readEXD(EXH& exh, ExcelDataPagination& page) {
|
EXD readEXD(EXH& exh, ExcelDataPagination& page) {
|
||||||
|
EXD exd;
|
||||||
|
|
||||||
auto path = fmt::format("{}_{}.exd", "map", page.startId);
|
auto path = fmt::format("{}_{}.exd", "map", page.startId);
|
||||||
|
|
||||||
FILE* file = fopen(path.data(), "rb");
|
FILE* file = fopen(path.data(), "rb");
|
||||||
|
@ -50,6 +52,8 @@ void readEXD(EXH& exh, ExcelDataPagination& page) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for(auto& offset : dataOffsets) {
|
for(auto& offset : dataOffsets) {
|
||||||
|
Row row;
|
||||||
|
|
||||||
fseek(file, exh.header.dataOffset + offset.offset, SEEK_SET);
|
fseek(file, exh.header.dataOffset + offset.offset, SEEK_SET);
|
||||||
|
|
||||||
ExcelDataRowHeader rowHeader;
|
ExcelDataRowHeader rowHeader;
|
||||||
|
@ -61,6 +65,8 @@ void readEXD(EXH& exh, ExcelDataPagination& page) {
|
||||||
const int rowOffset = offset.offset + 6;
|
const int rowOffset = offset.offset + 6;
|
||||||
|
|
||||||
for(auto column : exh.columnDefinitions) {
|
for(auto column : exh.columnDefinitions) {
|
||||||
|
Column c;
|
||||||
|
|
||||||
switch(column.type) {
|
switch(column.type) {
|
||||||
case String:
|
case String:
|
||||||
{
|
{
|
||||||
|
@ -79,11 +85,19 @@ void readEXD(EXH& exh, ExcelDataPagination& page) {
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt::print("{}\n", string.data());
|
fmt::print("{}\n", string.data());
|
||||||
|
|
||||||
|
c.data = string;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
row.data.push_back(c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
exd.rows.push_back(row);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return exd;
|
||||||
}
|
}
|
Reference in a new issue