Пример #1
0
 private static void load() {
   if (props == null) props = new Properties();
   else props.clear();
   File[] list = (new File(OS.getWorkDir() + OS.getFileSeparator() + "devices")).listFiles();
   if (list == null) return;
   for (int i = 0; i < list.length; i++) {
     if (list[i].isDirectory()) {
       PropertiesFile p = new PropertiesFile();
       String device =
           list[i].getPath().substring(list[i].getPath().lastIndexOf(OS.getFileSeparator()) + 1);
       try {
         if (!device.toLowerCase().equals("busybox")) {
           p.open(
               "",
               new File(list[i].getPath() + OS.getFileSeparator() + device + ".properties")
                   .getAbsolutePath());
           DeviceEntry entry = new DeviceEntry(p);
           if (device.equals(entry.getId())) props.put(device, entry);
           else MyLogger.getLogger().error(device + " : this bundle is not valid");
         }
       } catch (Exception fne) {
         MyLogger.getLogger().error(device + " : this bundle is not valid");
       }
     }
   }
 }
Пример #2
0
 public DeviceEntry(String Id) {
   _entry = new PropertiesFile();
   try {
     String path =
         OS.getWorkDir()
             + File.separator
             + "devices"
             + File.separator
             + Id
             + File.separator
             + Id
             + ".properties";
     _entry.open("", path);
   } catch (Exception e) {
   }
 }