Beispiel #1
0
 public static List<Weaponset> loadWeaponsets(Context c, File weaponsetFile) throws IOException {
   if (!weaponsetFile.isFile()) {
     // No file == no weaponsets, no error
     return new ArrayList<Weaponset>();
   }
   WeaponsetListPtr weaponsetListPtr = null;
   try {
     weaponsetListPtr = Flib.INSTANCE.flib_weaponsetlist_from_ini(weaponsetFile.getAbsolutePath());
     if (weaponsetListPtr == null) {
       throw new IOException("Unable to read weaponsets from " + weaponsetFile);
     }
     return weaponsetListPtr.deref();
   } finally {
     if (weaponsetListPtr != null) {
       Flib.INSTANCE.flib_weaponsetlist_destroy(weaponsetListPtr);
     }
   }
 }
Beispiel #2
0
 public static void saveUserWeaponsets(Context c, List<Weaponset> weaponsets) throws IOException {
   WeaponsetListPtr ptr = WeaponsetListPtr.createJavaOwned(weaponsets);
   Flib.INSTANCE.flib_weaponsetlist_to_ini(getUserWeaponsetsFile(c).getAbsolutePath(), ptr);
 }