コード例 #1
0
 public void injectBitmap(int id, byte[] bitmapFileData) {
   DirectoryEntry subDirBmp = myRoot.findSubDir("IRD2").findSubDir("IRD" + id);
   RawResource bmpRes = subDirBmp.getRawResource(0);
   // strip off BITMAPFILEHEADER
   byte[] bitmapResourceData = new byte[bitmapFileData.length - 14];
   System.arraycopy(bitmapFileData, 14, bitmapResourceData, 0, bitmapResourceData.length);
   bmpRes.setBytes(bitmapResourceData);
 }
コード例 #2
0
  public void load() throws IOException {
    RandomAccessFile stream = new RandomAccessFile(myTemplate, "r");
    ExeReader formatReader = new ExeReader(myTemplate.getName(), ExeFormat.UNKNOWN);
    formatReader.read(stream);
    stream.seek(0L);
    myReader = new ExeReader(myTemplate.getName(), formatReader.getExeFormat());
    myReader.read(stream);
    stream.close();
    SectionReader sectionReader = myReader.getSectionReader(".rsrc");
    ResourceSectionReader resourceReader = (ResourceSectionReader) sectionReader.getMember(".rsrc");
    myRoot = resourceReader.getRoot();
    DirectoryEntry subDir = myRoot.findSubDir("IRD6");
    myStringTableDirectory = new StringTableDirectory(subDir);

    RawResource versionInfoResource = getVersionInfoResource();
    ByteArrayInputStream bytesStream =
        new ByteArrayInputStream(versionInfoResource.getBytes().getBytes());

    myVersionInfo = new VersionInfo();
    myVersionInfo.read(new OffsetTrackingInputStream(new DataInputStream(bytesStream)));
  }
コード例 #3
0
 private RawResource getVersionInfoResource() {
   DirectoryEntry viDir = myRoot.findSubDir("IRD16").findSubDir("IRD1");
   return viDir.getRawResource(0);
 }
コード例 #4
0
 public void injectBitmap(int id, byte[] bitmapData) {
   DirectoryEntry subDirBmp = myRoot.findSubDir("IRD2").findSubDir("IRD" + id);
   RawResource bmpRes = subDirBmp.getRawResource(0);
   bmpRes.setBytes(bitmapData);
 }