Fixed Directory Importing
This commit is contained in:
parent
166fe75b68
commit
0cc98012cd
2 changed files with 36 additions and 11 deletions
|
@ -78,7 +78,6 @@ import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||||
* + Synchronized scrolling is broken
|
* + Synchronized scrolling is broken
|
||||||
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
|
* + Spam-clicking the refresh button will cause the swing thread to deadlock (Quickly opening resources used to also do this)
|
||||||
* This is caused by the ctrlMouseWheelZoom code, a temporary patch is just removing it worst case
|
* This is caused by the ctrlMouseWheelZoom code, a temporary patch is just removing it worst case
|
||||||
* + Open as folder doesn't actually work
|
|
||||||
* + Fix classfile searcher
|
* + Fix classfile searcher
|
||||||
* + Smali Assembly compile - Needs to be fixed
|
* + Smali Assembly compile - Needs to be fixed
|
||||||
* + Krakatau Assembly compile - Needs to be fixed
|
* + Krakatau Assembly compile - Needs to be fixed
|
||||||
|
|
|
@ -1,6 +1,7 @@
|
||||||
package the.bytecode.club.bytecodeviewer.resources.importing.impl;
|
package the.bytecode.club.bytecodeviewer.resources.importing.impl;
|
||||||
|
|
||||||
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
||||||
|
import the.bytecode.club.bytecodeviewer.resources.importing.ImportType;
|
||||||
import the.bytecode.club.bytecodeviewer.resources.importing.Importer;
|
import the.bytecode.club.bytecodeviewer.resources.importing.Importer;
|
||||||
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
import the.bytecode.club.bytecodeviewer.util.FileContainer;
|
||||||
|
|
||||||
|
@ -28,27 +29,52 @@ public class DirectoryResourceImporter implements Importer
|
||||||
String dir = file.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath
|
String dir = file.getAbsolutePath();//f.getAbsolutePath().substring(0, f.getAbsolutePath
|
||||||
// ().length()-f.getName().length());
|
// ().length()-f.getName().length());
|
||||||
|
|
||||||
while (!finished) {
|
while (!finished)
|
||||||
|
{
|
||||||
boolean added = false;
|
boolean added = false;
|
||||||
for (int i = 0; i < totalFiles.size(); i++) {
|
for (int i = 0; i < totalFiles.size(); i++)
|
||||||
|
{
|
||||||
File child = totalFiles.get(i);
|
File child = totalFiles.get(i);
|
||||||
if (child.listFiles() != null)
|
if (child.listFiles() != null)
|
||||||
for (File rocket : Objects.requireNonNull(child.listFiles()))
|
for (File rocket : Objects.requireNonNull(child.listFiles()))
|
||||||
if (!totalFiles.contains(rocket)) {
|
if (!totalFiles.contains(rocket))
|
||||||
|
{
|
||||||
totalFiles.add(rocket);
|
totalFiles.add(rocket);
|
||||||
added = true;
|
added = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!added) {
|
if (!added)
|
||||||
|
{
|
||||||
for (File child : totalFiles)
|
for (File child : totalFiles)
|
||||||
if (child.isFile()) {
|
{
|
||||||
String fileName = child.getAbsolutePath().substring(dir.length() + 1
|
if(!child.isFile())
|
||||||
).replaceAll("\\\\", "\\/");
|
continue;
|
||||||
|
|
||||||
|
final String trimmedPath = child.getAbsolutePath().substring(dir.length() + 1)
|
||||||
files1.put(fileName, Files.readAllBytes(Paths.get(child.getAbsolutePath())));
|
.replaceAll("\\\\", "\\/");
|
||||||
|
final String fileName = child.getName();
|
||||||
|
|
||||||
|
//attempt to import archives automatically
|
||||||
|
if (fileName.endsWith(".jar") || fileName.endsWith(".zip") || fileName.endsWith(".war"))
|
||||||
|
{
|
||||||
|
ImportType.ZIP.getImporter().open(child);
|
||||||
}
|
}
|
||||||
|
else if (fileName.endsWith(".apk"))
|
||||||
|
{
|
||||||
|
ImportType.APK.getImporter().open(child);
|
||||||
|
}
|
||||||
|
else if (fileName.endsWith(".dex"))
|
||||||
|
{
|
||||||
|
ImportType.DEX.getImporter().open(child);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
//pack files into a single container
|
||||||
|
files1.put(trimmedPath, Files.readAllBytes(Paths.get(child.getAbsolutePath())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
finished = true;
|
finished = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue