Code example for Properties

Methods: getProperty, loadFromXML

0
        Logger.verbose("String replacement done."); 
    } 
 
    private void patchEmulator() throws IOException { 
        Logger.info("Verifying the emulator binary."); 
        Properties config = new Properties();
        config.loadFromXML(new FileInputStream(new File(mOutputDir, "/config/config.xml")));
        String emulatorName = config.getProperty("emulator_name", "libjava-activity.so");
        File origEmulator = new File(mOutputDir, "/lib/armeabi/" + emulatorName);
        String emulatorCRC32 = Long.toHexString(FileUtils.checksumCRC32(origEmulator));
        if(!emulatorCRC32.equalsIgnoreCase(config.getProperty("emulator_crc32")))
            throw new UnsupportedOperationException("The emulator checksum is invalid. Cannot patch. CRC32: " + emulatorCRC32);
        File newEmulator = new File(mOutputDir, "/lib/armeabi/libjava-activity-patched.so");
        File emulatorPatch = new File(mOutputDir, "/config/" + config.getProperty("emulator_patch", ""));
        if(emulatorPatch.equals("")){
            Logger.info("No patch needed."); 
            FileUtils.moveFile(origEmulator, newEmulator);
        }else{ 
            Logger.info("Patching emulator."); 
            newEmulator.createNewFile();
            JBPatch.bspatch(origEmulator, newEmulator, emulatorPatch);