use of info.ata4.disunity.cli.util.TextTableFormat in project disunity by ata4.
the class AssetObjects method tableModel.
@Override
protected TableModel tableModel(SerializedFile serialized) {
SerializedFileMetadata metadata = serialized.metadata();
TableBuilder table = new TableBuilder();
table.row("Path ID", "Offset", "Length", "Type ID", "Class ID");
Class<ObjectInfo> factory = metadata.objectInfoTable().elementFactory();
boolean typeTreePresent = metadata.typeTree().embedded();
boolean v2 = ObjectInfoV2.class.isAssignableFrom(factory);
boolean v3 = ObjectInfoV3.class.isAssignableFrom(factory);
if (typeTreePresent) {
table.append("Class Name");
}
if (v2) {
table.append("Script Type ID");
}
if (v3) {
table.append("Stripped");
}
metadata.objectInfoTable().infoMap().entrySet().stream().forEach(e -> {
ObjectInfo info = e.getValue();
table.row(e.getKey(), info.offset(), info.length(), info.typeID(), info.classID());
if (typeTreePresent) {
TypeRoot<Type> baseClass = metadata.typeTree().typeMap().get(info.typeID());
String className = baseClass.nodes().data().typeName();
table.append(className);
}
if (v2) {
table.append(((ObjectInfoV2) info).scriptTypeIndex());
}
if (v3) {
table.append(((ObjectInfoV3) info).isStripped());
}
});
TableModel model = new TableModel("Objects", table.get());
TextTableFormat format = model.format();
format.columnFormatter(1, Formatters::hex);
return model;
}
use of info.ata4.disunity.cli.util.TextTableFormat in project disunity by ata4.
the class BundleList method runBundle.
@Override
protected void runBundle(Path file, Bundle bundle) {
if (outputFormat.get() == OutputFormat.TEXT) {
output().println(file);
}
TableModel tableModel = new TableModel("Files", buildEntryTable(bundle));
TextTableFormat format = tableModel.format();
format.columnFormatter(2, Formatters::hex);
List<TableModel> tables = new ArrayList<>();
tables.add(tableModel);
TablePrinter tablePrinter = TablePrinter.fromOutputFormat(outputFormat.get(), output());
tablePrinter.file(file);
tablePrinter.print(tables);
}
use of info.ata4.disunity.cli.util.TextTableFormat in project disunity by ata4.
the class AssetBlocks method tableModel.
@Override
protected TableModel tableModel(SerializedFile serialized) {
Map<String, DataBlock> blocks = new LinkedHashMap<>();
blocks.put("Header", serialized.headerBlock());
blocks.put("Type Tree", serialized.metadata().typeTreeBlock());
blocks.put("Object Info", serialized.metadata().objectInfoBlock());
blocks.put("External Refs", serialized.metadata().externalsBlock());
blocks.put("Object Data", serialized.objectDataBlock());
TableBuilder table = new TableBuilder();
table.row("Name", "Offset", "Size");
blocks.entrySet().stream().sorted((e1, e2) -> Long.compare(e1.getValue().offset(), e2.getValue().offset())).forEach(e -> {
DataBlock block = e.getValue();
table.row(e.getKey(), block.offset(), block.length());
});
TableModel model = new TableModel("Blocks", table.get());
TextTableFormat format = model.format();
format.columnFormatter(1, Formatters::hex);
return model;
}
Aggregations