哈哈哈哈哈哈哈哈哈哈哈哈哈哈
This commit is contained in:
@@ -56,6 +56,9 @@ public class CefAppManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化Cef
|
||||
*/
|
||||
private static void initializeDefaultSettings() {
|
||||
initLock.lock();
|
||||
try {
|
||||
@@ -112,6 +115,10 @@ public class CefAppManager {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断地区主题是否为黑色主题
|
||||
* @return 是否
|
||||
*/
|
||||
private static boolean isDarkTheme() {
|
||||
if (AxisInnovatorsBox.getMain() == null){
|
||||
return false;
|
||||
|
||||
@@ -140,6 +140,7 @@ public class MainApplication {
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static void popupCodeEditorWindow() {
|
||||
AtomicReference<BrowserWindow> window = new AtomicReference<>();
|
||||
SwingUtilities.invokeLater(() -> {
|
||||
|
||||
@@ -21,6 +21,13 @@ public class CodeExecutor {
|
||||
void onOutput(String newOutput);
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行代码
|
||||
* @param code 代码字符串
|
||||
* @param language 代码类型
|
||||
* @param listener 回调,代码的输出回调
|
||||
* @return 返回i执行结果
|
||||
*/
|
||||
public static String executeCode(String code, String language, OutputListener listener) {
|
||||
switch (language.toLowerCase()) {
|
||||
case "python":
|
||||
@@ -35,6 +42,10 @@ public class CodeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行Java代码
|
||||
* @return 返回执行结果
|
||||
*/
|
||||
public static String executeJavaCode(String code, OutputListener listener) {
|
||||
Path tempDir = null;
|
||||
try {
|
||||
@@ -176,6 +187,9 @@ public class CodeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行C代码
|
||||
*/
|
||||
private static String executeC(String code, OutputListener listener) {
|
||||
Path tempDir = null;
|
||||
Path cFile = null;
|
||||
@@ -316,63 +330,6 @@ public class CodeExecutor {
|
||||
}
|
||||
}
|
||||
|
||||
private static String captureProcessOutput(Process process, OutputListener listener)
|
||||
throws IOException {
|
||||
StringBuilder totalOutput = new StringBuilder();
|
||||
try (BufferedReader reader = new BufferedReader(
|
||||
new InputStreamReader(process.getInputStream()))) {
|
||||
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
totalOutput.append(line).append("\n");
|
||||
if (listener != null) {
|
||||
listener.onOutput(line + "\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
return totalOutput.toString();
|
||||
}
|
||||
|
||||
// 输出监控线程
|
||||
private static class OutputMonitor implements Runnable {
|
||||
private final BufferedReader reader;
|
||||
private final OutputListener listener;
|
||||
private volatile boolean running = true;
|
||||
private final StringBuilder totalOutput = new StringBuilder();
|
||||
|
||||
public OutputMonitor(BufferedReader reader, OutputListener listener) {
|
||||
this.reader = reader;
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public void run() {
|
||||
try {
|
||||
while (running) {
|
||||
if (reader.ready()) {
|
||||
String line = reader.readLine();
|
||||
if (line != null) {
|
||||
totalOutput.append(line).append("\n");
|
||||
if (listener != null) {
|
||||
listener.onOutput(line + "\n");
|
||||
}
|
||||
}
|
||||
} else {
|
||||
Thread.sleep(50);
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
running = false;
|
||||
}
|
||||
|
||||
public String getTotalOutput() {
|
||||
return totalOutput.toString();
|
||||
}
|
||||
}
|
||||
|
||||
// 使用方法
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -108,6 +108,25 @@ public class RegistrationTool {
|
||||
}
|
||||
}));
|
||||
|
||||
MainWindow.ToolCategory hahahah = new MainWindow.ToolCategory(
|
||||
"good工具",
|
||||
"haha/ok.png",
|
||||
"good "
|
||||
);
|
||||
hahahah.addTool(new MainWindow.ToolItem("123", "ai/local/local_main.png",
|
||||
"456789" +
|
||||
"\n作者:Vinfya", ++id, new AbstractAction() {
|
||||
@Override
|
||||
public void actionPerformed(ActionEvent e) {
|
||||
// 在这里写
|
||||
// 这个就是弹窗Ok
|
||||
JOptionPane.showMessageDialog(null, "你好...");
|
||||
|
||||
}
|
||||
}));
|
||||
|
||||
|
||||
|
||||
MainWindow.ToolCategory systemCategory = new MainWindow.ToolCategory("系统工具",
|
||||
"windows/windows.png",
|
||||
"系统工具");
|
||||
@@ -125,6 +144,8 @@ public class RegistrationTool {
|
||||
addToolCategory(aICategory,"system:fridaTools");
|
||||
addToolCategory(programmingToolsCategory, "system:programmingTools");
|
||||
addToolCategory(systemCategory, "system:systemTools");
|
||||
addToolCategory(hahahah, "system:mc");
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1463,12 +1463,24 @@ public class MainWindow extends JFrame {
|
||||
private final String description;
|
||||
private final UUID id = UUID.randomUUID();
|
||||
private final List<ToolItem> tools = new ArrayList<>();
|
||||
|
||||
/**
|
||||
* 分类
|
||||
* @param name 分类名称
|
||||
* @param icon 分类的图标
|
||||
* @param description 分类的描述
|
||||
*/
|
||||
public ToolCategory(String name, String icon, String description) {
|
||||
this.name = name; this.icon = icon; this.description = description; this.iconImage = null;
|
||||
}
|
||||
public ToolCategory(String name, ImageIcon icon, String description) {
|
||||
this.name = name; this.iconImage = icon; this.description = description; this.icon = null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 在当前分类中创建一个新的工具卡片
|
||||
* @param tool 工具卡片
|
||||
*/
|
||||
public void addTool(ToolItem tool) { tools.add(tool); }
|
||||
public String getDescription() { return description; }
|
||||
public String getIcon() {
|
||||
@@ -1490,6 +1502,15 @@ public class MainWindow extends JFrame {
|
||||
private final String description;
|
||||
private final int id;
|
||||
private final Action action;
|
||||
|
||||
/**
|
||||
* 创建一个新的工具
|
||||
* @param title 工具的标题
|
||||
* @param icon 工具的图标
|
||||
* @param description 工具的介绍
|
||||
* @param id 工具的id(不要重复即可)
|
||||
* @param action 点击工具卡片后触发的事件
|
||||
*/
|
||||
public ToolItem(String title, String icon, String description, int id, Action action) {
|
||||
this.title = title; this.icon = icon; this.description = description; this.id = id; this.action = action; this.imageIcon = null;
|
||||
}
|
||||
|
||||
BIN
src/main/resources/icons/haha/ok.png
Normal file
BIN
src/main/resources/icons/haha/ok.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 114 KiB |
Reference in New Issue
Block a user