public void deleteBitmap(uint id, String name, uint language) { ResBitmap bmp = (ResBitmap)getDataItem(bitmaps, id, name); if (bmp != null) { bmp.deleteItem(language); } }
//----------------------------------------------------------------------------- public void addBitmap(uint id, String name, uint language, Bitmap bitmap) { ResBitmap bmp = (ResBitmap)getDataItem(bitmaps, id, name); if (bmp == null) { bmp = new ResBitmap(id, name); bitmaps.Add(bmp); } bmp.addItem(language, bitmap); }
//leaf node of resource directory tree, this rec points to actual data private void parseResourceData(SourceFile source) { uint datapos = source.getFour(); uint datasize = source.getFour(); uint codepage = source.getFour(); uint reserved = source.getFour(); datapos -= resourceRVA; byte[] resdata = source.getRange(datapos, datasize); //get resource data //get the store type/id/lang vals we stored in our decent to this node uint restype = resIdNameValues[0]; uint resid = resIdNameValues[1]; String resname = (resid >= 0x80000000) ? getResourceName(source, resid) : null; uint reslang = resIdNameValues[2]; switch (restype) { case 1: ResData curdata = new ResData(resid, resname, reslang, resdata); cursorItems.Add(curdata); break; case 2: Bitmap bmp = ResBitmap.parseData(resdata); addBitmap(resid, resname, reslang, bmp); getDataItem(bitmaps, resid, resname).getItem(reslang).dataBuf = resdata; break; case 3: ResData icondata = new ResData(resid, resname, reslang, resdata); iconItems.Add(icondata); break; case 4: addMenu(resid, resname, reslang, resdata); //List<String> menu = ResMenu.parseData(resdata); //addMenu(resid, resname, reslang, menu); getDataItem(menus, resid, resname).getItem(reslang).dataBuf = resdata; break; case 5: addDialog(resid, resname, reslang, resdata); //List<String> dlg = ResDialog.parseData(resdata); //addDialog(resid, resname, reslang, dlg); getDataItem(dialogs, resid, resname).getItem(reslang).dataBuf = resdata; break; case 6: List <String> strings = ResStringTable.parseData(resdata); addStringTable(resid, resname, reslang, strings); getDataItem(stringtable, resid, resname).getItem(reslang).dataBuf = resdata; break; case 7: addFontDirectory(resid, resname, reslang, resdata); getDataItem(fontDirectories, resid, resname).getItem(reslang).dataBuf = resdata; break; case 8: addFont(resid, resname, reslang, resdata); getDataItem(fonts, resid, resname).getItem(reslang).dataBuf = resdata; break; case 9: List <String> accel = ResAccelerator.parseData(resdata); addAccelerator(resid, resname, reslang, accel); getDataItem(accelerators, resid, resname).getItem(reslang).dataBuf = resdata; break; case 10: addUserData(resid, resname, reslang, resdata); getDataItem(userData, resid, resname).getItem(reslang).dataBuf = resdata; break; case 12: ResImageGroupData cg = ResImageGroupData.parseData(resdata); addCursorGroup(resid, resname, reslang, cg); getDataItem(cursorGroups, resid, resname).getItem(reslang).dataBuf = resdata; break; case 14: ResImageGroupData ig = ResImageGroupData.parseData(resdata); addIconGroup(resid, resname, reslang, ig); getDataItem(iconGroups, resid, resname).getItem(reslang).dataBuf = resdata; break; case 16: addVersion(resid, resname, reslang, resdata); //List<String> version = ResVersion.parseData(resdata); //addVersion(resid, resname, reslang, version); getDataItem(versions, resid, resname).getItem(reslang).dataBuf = resdata; break; default: addUserData(resid, resname, reslang, resdata); getDataItem(userData, resid, resname).getItem(reslang).dataBuf = resdata; break; } }