icon.xSize = icon.getIcon().getIconWidth();
icon.ySize = icon.getIcon().getIconHeight();
}
try (
BNetOutputStream os = new BNetOutputStream(new FileOutputStream(f));
ByteArrayOutputStream baos = new ByteArrayOutputStream();
BNetOutputStream headerStream = new BNetOutputStream(baos);
) {
Out.debug(IconsDotBniReader.class, "Writing " + f.getName());
headerStream.writeWord(1); // BNI version
headerStream.writeWord(0); // Alignment Padding (unused)
headerStream.writeDWord(icons.length); // numIcons
headerStream.writeDWord(-1); // dataOffset
for(BNetIcon icon : icons) {
headerStream.writeDWord(icon.flags);
headerStream.writeDWord(icon.xSize);
headerStream.writeDWord(icon.ySize);
//Write up to 32 products; stop if we see a null
for(int product : icon.products) {
if(product == 0)
break;
headerStream.writeDWord(product);
}
headerStream.writeDWord(0);
}
byte[] header = baos.toByteArray();
os.writeDWord(header.length);