Пример #1
0
 private Grid<Integer> loadPlainImage(Class resourceLoader, String resourceName)
     throws ResourceMissingException {
   String propname = resourceName.replaceFirst("[.][^.]*$", ".properties");
   if (!ResourceUtils.hasResource(resourceLoader, propname)) {
     propname = null;
   }
   return loadPlainImage(resourceLoader, resourceName, propname);
 }
Пример #2
0
 private Grid<Integer> loadPlainImage(
     Class resourceLoader, String resourceName, String propertiesName)
     throws ResourceMissingException {
   Map<String, Integer> mapping = null;
   if (propertiesName != null) {
     mapping = new HashMap<>();
     Properties prop = ResourceUtils.getResourceAsProperties(resourceLoader, propertiesName);
     for (String key : prop.stringPropertyNames()) {
       String rKey = key;
       if (key.startsWith("0x") || key.startsWith("0X")) {
         rKey = String.copyValueOf(Character.toChars(Integer.parseInt(key.substring(2), 16)));
       }
       String what = prop.getProperty(key);
       Integer ready;
       try {
         ready = ColorHelper.makeColor(what);
       } catch (InvalidStringFormatException ex) {
         throw new RuntimeException(ex);
       }
       mapping.put(rKey, ready);
     }
   }
   return ResourceUtils.getResourceAsGrid(resourceLoader, resourceName, mapping, false);
 }