Resource Importing Code Cleanup
This commit is contained in:
parent
9df47b0fe7
commit
b676890aeb
4 changed files with 29 additions and 13 deletions
|
@ -11,7 +11,7 @@ import java.util.HashMap;
|
|||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
import javax.swing.*;
|
||||
import javax.swing.filechooser.FileFilter;
|
||||
|
||||
import me.konloch.kontainer.io.HTTPRequest;
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
@ -33,6 +33,7 @@ import the.bytecode.club.bytecodeviewer.gui.resourceviewer.viewer.ResourceViewer
|
|||
import the.bytecode.club.bytecodeviewer.obfuscators.mapping.Refactorer;
|
||||
import the.bytecode.club.bytecodeviewer.plugin.PluginManager;
|
||||
import the.bytecode.club.bytecodeviewer.util.*;
|
||||
import the.bytecode.club.bytecodeviewer.util.resources.ImportResource;
|
||||
|
||||
import static the.bytecode.club.bytecodeviewer.Constants.*;
|
||||
|
||||
|
@ -327,11 +328,9 @@ public class BytecodeViewer
|
|||
* @return the file contents as a byte[]
|
||||
*/
|
||||
public static byte[] getFileContents(String name) {
|
||||
for (FileContainer container : files) {
|
||||
HashMap<String, byte[]> files = container.files;
|
||||
if (files.containsKey(name))
|
||||
return files.get(name);
|
||||
}
|
||||
for (FileContainer container : files)
|
||||
if (container.files.containsKey(name))
|
||||
return container.files.get(name);
|
||||
|
||||
return null;
|
||||
}
|
||||
|
@ -528,7 +527,7 @@ public class BytecodeViewer
|
|||
|
||||
BytecodeViewer.viewer.updateBusyStatus(true);
|
||||
Configuration.needsReDump = true;
|
||||
Thread t = new Thread(new OpenFile(files));
|
||||
Thread t = new Thread(new ImportResource(files));
|
||||
t.start();
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
package the.bytecode.club.bytecodeviewer.gui.components;
|
||||
|
||||
import the.bytecode.club.bytecodeviewer.Configuration;
|
||||
import the.bytecode.club.bytecodeviewer.util.MiscUtils;
|
||||
|
||||
import javax.swing.*;
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package the.bytecode.club.bytecodeviewer.util;
|
||||
package the.bytecode.club.bytecodeviewer.util.resources;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.objectweb.asm.tree.ClassNode;
|
||||
|
@ -6,6 +6,7 @@ import the.bytecode.club.bytecodeviewer.BytecodeViewer;
|
|||
import the.bytecode.club.bytecodeviewer.api.ExceptionUI;
|
||||
import the.bytecode.club.bytecodeviewer.gui.resourcelist.ResourceListPane;
|
||||
import the.bytecode.club.bytecodeviewer.gui.MainViewerGUI;
|
||||
import the.bytecode.club.bytecodeviewer.util.*;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
|
@ -40,18 +41,20 @@ import static the.bytecode.club.bytecodeviewer.Constants.fs;
|
|||
/**
|
||||
* @author Konloch
|
||||
*/
|
||||
public class OpenFile implements Runnable
|
||||
public class ImportResource implements Runnable
|
||||
{
|
||||
private boolean update = true;
|
||||
private final File[] files;
|
||||
|
||||
public OpenFile(File[] files) {this.files = files;}
|
||||
public ImportResource(File[] files) {this.files = files;}
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
for (final File f : files) {
|
||||
try
|
||||
{
|
||||
for (final File f : files)
|
||||
{
|
||||
final String fn = f.getName();
|
||||
if (!f.exists()) {
|
||||
update = false;
|
|
@ -0,0 +1,15 @@
|
|||
package the.bytecode.club.bytecodeviewer.util.resources;
|
||||
|
||||
/**
|
||||
* @author Konloch
|
||||
* @since 6/26/2021
|
||||
*/
|
||||
public enum ImportType
|
||||
{
|
||||
DIRECTORY,
|
||||
FILE,
|
||||
ZIP,
|
||||
CLASS,
|
||||
APK,
|
||||
DEX,
|
||||
}
|
Loading…
Reference in a new issue