Beispiel #1
0
  boolean readMetaInfo() {
    myEncoding = null;
    myLanguage = null;
    myTitle = null;
    myAuthors = null;
    myTags = null;
    mySeriesInfo = null;

    myIsSaved = false;

    final FormatPlugin plugin = PluginCollection.Instance().getPlugin(File);
    if (plugin == null || !plugin.readMetaInfo(this)) {
      return false;
    }
    if (myTitle == null || myTitle.length() == 0) {
      final String fileName = File.getShortName();
      final int index = fileName.lastIndexOf('.');
      setTitle(index > 0 ? fileName.substring(0, index) : fileName);
    }
    final String demoPathPrefix =
        Paths.BooksDirectoryOption().getValue()
            + java.io.File.separator
            + "Demos"
            + java.io.File.separator;
    if (File.getPath().startsWith(demoPathPrefix)) {
      final String demoTag = LibraryUtil.resource().getResource("demo").getValue();
      setTitle(getTitle() + " (" + demoTag + ")");
      addTag(demoTag);
    }
    return true;
  }
Beispiel #2
0
  public static List<String> languageCodes() {
    if (ourLanguageCodes.isEmpty()) {
      TreeSet<String> codes = new TreeSet<String>();
      for (ZLFile file : patternsFile().children()) {
        String name = file.getShortName();
        final int index = name.indexOf("_");
        if (index != -1) {
          String str = name.substring(0, index);
          if (!codes.contains(str)) {
            codes.add(str);
          }
        }
      }
      codes.add("id");
      codes.add("de-traditional");

      ourLanguageCodes.addAll(codes);
    }

    return Collections.unmodifiableList(ourLanguageCodes);
  }