• R/O
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

OmegaT の背景に画像を表示します。


Commit MetaInfo

Revision16 (tree)
Time2014-05-10 13:20:46
Authoryu-tang

Log Message

ユーティリティ関数 isURLShortcut(File) と isImage(File) を追加

Change Summary

Incremental Difference

--- trunk/src/jp/sourceforge/users/yutang/omegat/plugin/moenizer/MoeUtil.java (revision 15)
+++ trunk/src/jp/sourceforge/users/yutang/omegat/plugin/moenizer/MoeUtil.java (revision 16)
@@ -37,6 +37,8 @@
3737 */
3838 public class MoeUtil {
3939
40+ private static final Pattern RE_HAS_IMAGE_EXTENSION = Pattern.compile(".+\\.(?:bmp|png|jpg|jpeg|gif)\\z", Pattern.CASE_INSENSITIVE);
41+ private static final Pattern RE_HAS_URL_SHORTCUT_EXTENSION = Pattern.compile(".+\\.(?:bmp|png|jpg|jpeg|gif)\\z", Pattern.CASE_INSENSITIVE);
4042 private static final Pattern RE_URL_IN_SHORTCUT = Pattern.compile("\\[InternetShortcut\\]\\s+URL=(.+)\\b");
4143 private static final Pattern RE_URL_IN_WEBLOC = Pattern.compile("<key>URL</key>\\s+<string>(.+)</string>");
4244 private static File pluginJarFile;
@@ -108,4 +110,17 @@
108110 rd.close();
109111 }
110112 }
113+
114+ public boolean isURLShortcut(File file) {
115+ String name = file.getName();
116+ return (!name.startsWith(".")
117+ && RE_HAS_URL_SHORTCUT_EXTENSION.matcher(name).matches());
118+ }
119+
120+ public boolean isImage(File file) {
121+ String name = file.getName();
122+ return (!name.startsWith(".")
123+ && RE_HAS_IMAGE_EXTENSION.matcher(name).matches());
124+ }
125+
111126 }