Use SleepUtil API

This commit is contained in:
Konloch 2024-10-01 23:43:27 -06:00
parent 938ee3f51b
commit 406b47bf8c

AI 샘플 코드 생성 중입니다

Loading...
6 changed files with 18 additions and 47 deletions

View File

@ -22,6 +22,7 @@ import org.objectweb.asm.ClassReader;
import org.objectweb.asm.ClassWriter; import org.objectweb.asm.ClassWriter;
import org.objectweb.asm.tree.ClassNode; import org.objectweb.asm.tree.ClassNode;
import org.objectweb.asm.tree.MethodNode; import org.objectweb.asm.tree.MethodNode;
import the.bytecode.club.bytecodeviewer.util.SleepUtil;
/** /**
* @author Konloch * @author Konloch
@ -61,14 +62,10 @@ public class ASMUtil
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
try
{ SleepUtil.sleep(200);
Thread.sleep(200);
cn.accept(cw); cn.accept(cw);
}
catch (InterruptedException ignored)
{
}
} }
return cw.toByteArray(); return cw.toByteArray();

View File

@ -223,14 +223,10 @@ public class BCV
catch (Exception e) catch (Exception e)
{ {
e.printStackTrace(); e.printStackTrace();
try
{ SleepUtil.sleep(200);
Thread.sleep(200);
Objects.requireNonNull(cn).accept(cw); Objects.requireNonNull(cn).accept(cw);
}
catch (InterruptedException ignored)
{
}
} }
return cw.toByteArray(); return cw.toByteArray();

View File

@ -19,6 +19,7 @@
package the.bytecode.club.bytecodeviewer.gui.components; package the.bytecode.club.bytecodeviewer.gui.components;
import the.bytecode.club.bytecodeviewer.Constants; import the.bytecode.club.bytecodeviewer.Constants;
import the.bytecode.club.bytecodeviewer.util.SleepUtil;
import javax.swing.*; import javax.swing.*;
import java.io.PrintStream; import java.io.PrintStream;
@ -68,13 +69,7 @@ public class JFrameConsolePrintStream extends JFrameConsole
{ {
update(); update();
try SleepUtil.sleep(10);
{
Thread.sleep(10);
}
catch (InterruptedException ignored)
{
}
} }
lastUpdate = 0; lastUpdate = 0;

View File

@ -28,6 +28,7 @@ import the.bytecode.club.bytecodeviewer.gui.resourceviewer.BytecodeViewPanel;
import the.bytecode.club.bytecodeviewer.resources.Resource; import the.bytecode.club.bytecodeviewer.resources.Resource;
import the.bytecode.club.bytecodeviewer.resources.ResourceContainer; import the.bytecode.club.bytecodeviewer.resources.ResourceContainer;
import the.bytecode.club.bytecodeviewer.util.MethodParser; import the.bytecode.club.bytecodeviewer.util.MethodParser;
import the.bytecode.club.bytecodeviewer.util.SleepUtil;
import javax.swing.*; import javax.swing.*;
import javax.swing.text.BadLocationException; import javax.swing.text.BadLocationException;
@ -102,17 +103,10 @@ public class ClassViewer extends ResourceViewer
{ {
BytecodeViewer.updateBusyStatus(true); BytecodeViewer.updateBusyStatus(true);
//wait until it's not dumping
while (Configuration.currentlyDumping) while (Configuration.currentlyDumping)
{ {
//wait until it's not dumping SleepUtil.sleep(100);
try
{
Thread.sleep(100);
}
catch (InterruptedException e)
{
e.printStackTrace();
}
} }
BytecodeViewer.updateBusyStatus(false); BytecodeViewer.updateBusyStatus(false);

View File

@ -37,6 +37,7 @@ import the.bytecode.club.bytecodeviewer.resources.classcontainer.ClassFileContai
import the.bytecode.club.bytecodeviewer.resources.classcontainer.locations.*; import the.bytecode.club.bytecodeviewer.resources.classcontainer.locations.*;
import the.bytecode.club.bytecodeviewer.resources.classcontainer.parser.TokenUtil; import the.bytecode.club.bytecodeviewer.resources.classcontainer.parser.TokenUtil;
import the.bytecode.club.bytecodeviewer.util.MethodParser; import the.bytecode.club.bytecodeviewer.util.MethodParser;
import the.bytecode.club.bytecodeviewer.util.SleepUtil;
import javax.swing.*; import javax.swing.*;
import javax.swing.event.CaretEvent; import javax.swing.event.CaretEvent;
@ -133,13 +134,7 @@ public class BytecodeViewPanelUpdater implements Runnable
//hold this thread until the swing thread has finished attaching the components //hold this thread until the swing thread has finished attaching the components
while (waitingFor) while (waitingFor)
{ {
try SleepUtil.sleep(1);
{
Thread.sleep(1);
}
catch (Exception ignored)
{
}
} }
} }
} }

View File

@ -82,20 +82,14 @@ public class Enjarify
if (output.length() > 0) if (output.length() > 0)
holdThread.set(false); holdThread.set(false);
try SleepUtil.sleep(500);
{
Thread.sleep(500);
}
catch (InterruptedException ignored)
{
}
} }
}, "Enjarify Fail Safe Thread").start(); }, "Enjarify Fail Safe Thread").start();
//hold thread while enjarify is processing //hold thread while enjarify is processing
while (holdThread.get()) while (holdThread.get())
{ {
Thread.sleep(100); SleepUtil.sleep(100);
} }
//kill the python3 process if it's still alive //kill the python3 process if it's still alive