コード例 #1
0
ファイル: Book.java プロジェクト: royrutto/FBReaderJ
  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;
  }
コード例 #2
0
ファイル: ZLLanguageUtil.java プロジェクト: vmangla/evendor
  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);
  }