示例#1
0
  private void saveFavorite(Renderer r) {

    Properties prop = new Properties();
    prop.setProperty("protocol", r.getProtocol());
    prop.setProperty("identifier", r.getIdentifier());
    prop.setProperty("name", r.getName());
    try {
      File f = new File(Global.FAVORIS, prop.getProperty("identifier"));
      if (!f.exists()) f.createNewFile();
      FileOutputStream out = new FileOutputStream(f);
      prop.store(out, null);
      out.close();
    } catch (Exception e) {
      e.printStackTrace();
    }
  }
示例#2
0
 public boolean isFavorite(Renderer r) {
   boolean res = false;
   File[] files = Global.FAVORIS.listFiles();
   for (int i = 0; i < files.length && !res; i++) {
     if (r.getIdentifier().equals(files[i].getName())) res = true;
   }
   return res;
 }
示例#3
0
 private void deleteFavorite(Renderer r) {
   File f = new File(Global.FAVORIS, r.getIdentifier());
   f.delete();
 }