bug fixes

This commit is contained in:
Konloch 2019-04-12 22:07:50 -06:00
parent 8d07bd5e96
commit 04874b3cf4
3 changed files with 24 additions and 4 deletions

View file

@ -140,6 +140,7 @@ public class BytecodeViewer
public static File krakatauTempDir;
public static File krakatauTempJar;
public static int krakatauHash;
public static boolean currentlyDumping = false;
public static boolean needsReDump = true;
public static ArrayList<FileContainer> files = new ArrayList<FileContainer>(); //all of BCV's loaded files/classes/etc
private static int maxRecentFiles = 25;
@ -1376,7 +1377,7 @@ public class BytecodeViewer
public static void dumpTempFile()
{
/*int tempHash = classNodeLoaderHash(loader);
/*int tempHash = fileContainersHash(files);
if(tempHash != krakatauHash && krakatauTempJar != null)
{
@ -1412,12 +1413,14 @@ public class BytecodeViewer
if(krakatauTempJar != null || !passes)
return;
currentlyDumping = true;
needsReDump = false;
//krakatauHash = tempHash;
krakatauTempDir = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + MiscUtils.randomString(32) + BytecodeViewer.fs);
krakatauTempDir.mkdir();
krakatauTempJar = new File(BytecodeViewer.tempDirectory + BytecodeViewer.fs + "temp" + MiscUtils.randomString(32) + ".jar");
JarUtils.saveAsJarClassesOnly(BytecodeViewer.getLoadedClasses(), krakatauTempJar.getAbsolutePath());
currentlyDumping = false;
}
public static void rtCheck()
@ -1428,12 +1431,16 @@ public class BytecodeViewer
}
}
public static int classNodeLoaderHash(ClassNodeLoader loader)
public static int fileContainersHash(ArrayList<FileContainer> fileContainers)
{
StringBuilder block = new StringBuilder();
for(ClassNode node : loader.getAll())
for(FileContainer container : fileContainers)
{
block.append(node.name);
block.append(container.name);
for(ClassNode node : container.classes)
{
block.append(node.name);
}
}
return block.hashCode();

View file

@ -1699,6 +1699,18 @@ public class ClassViewer extends Viewer {
@Override
public void run()
{
while(BytecodeViewer.currentlyDumping)
{
//wait until it's not dumping
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
}
BytecodeViewer.dumpTempFile();
if (pane1 > 0)

View file

@ -1620,6 +1620,7 @@ public class MainViewerGUI extends JFrame implements FileChangeNotifier {
mnSettings.add(separator_38);
decodeAPKResources.setSelected(false);
decodeAPKResources.setEnabled(false);
mnSettings.add(decodeAPKResources);