encrypted names compatibility

master
Marcus Gosselin 2014-11-18 13:31:53 -05:00
parent c624b3085c
commit 6529cc4989
1 changed files with 10 additions and 9 deletions

View File

@ -63,6 +63,10 @@ public class Item {
try { try {
final File file = new File(path); final File file = new File(path);
name = file.getName();
if(name.endsWith(".enc")) {
name = Viewer.encryptor.nameTable.decrypt(name.substring(0, name.length() - 4));
}
if (file.isDirectory()) { if (file.isDirectory()) {
try { try {
//so many locals, had to split it up //so many locals, had to split it up
@ -81,7 +85,7 @@ public class Item {
g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON); g.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING, RenderingHints.VALUE_TEXT_ANTIALIAS_ON);
g.setFont(font); g.setFont(font);
FontMetrics metrics = g.getFontMetrics(); FontMetrics metrics = g.getFontMetrics();
String string = "" + file.getName(); String string = "" + name;
if (string.length() > 8) { if (string.length() > 8) {
string = string.substring(0, 9) + "..."; string = string.substring(0, 9) + "...";
} }
@ -116,11 +120,10 @@ public class Item {
} catch (Exception e) { } catch (Exception e) {
e.printStackTrace(); e.printStackTrace();
} }
name = file.getName();
} else if (file.isFile()) { } else if (file.isFile()) {
enterable = false; enterable = false;
if (!path.endsWith(".gif")) { if (!(name.endsWith(".gif"))) {
// try and do the image thing! // try and do the image thing!
images = new BufferedImage[] { ImageIO.read(file) }; images = new BufferedImage[] { ImageIO.read(file) };
} else { } else {
@ -133,10 +136,8 @@ public class Item {
thumbnail = (fillImageScale(images[0], Viewer.THUMBNAIL_SIZE, Viewer.THUMBNAIL_SIZE)); thumbnail = (fillImageScale(images[0], Viewer.THUMBNAIL_SIZE, Viewer.THUMBNAIL_SIZE));
path = file.getAbsolutePath(); path = file.getAbsolutePath();
name = file.getName();
if(name.endsWith(".enc")) {
name = Viewer.encryptor.decryptName(name.substring(0, name.length() - 4));
}
} else if (path.equals("\\drives")) { } else if (path.equals("\\drives")) {
name = "Drives"; name = "Drives";
@ -181,7 +182,7 @@ public class Item {
} }
private void createAlbum(final File file) { private void createAlbum(final File file) {
//TODO FIX THIS FOR ENCRYPTED FILES
File[] files = file.listFiles(new FilenameFilter() { File[] files = file.listFiles(new FilenameFilter() {
@Override @Override