diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml
deleted file mode 100644
index 1328607..0000000
--- a/.github/workflows/maven.yml
+++ /dev/null
@@ -1,42 +0,0 @@
-# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
-# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
-
-# This workflow uses actions that are not certified by GitHub.
-# They are provided by a third-party and are governed by
-# separate terms of service, privacy policy, and support
-# documentation.
-
-name: Java CI with Maven
-
-on:
- workflow_dispatch:
- inputs:
- tag:
- description: 'Tag for the release'
- default: "v1.0.0"
-jobs:
- build:
-
- runs-on: ubuntu-latest
-
- steps:
- - uses: actions/checkout@v3
- - name: Set up JDK 16
- uses: actions/setup-java@v3
- with:
- java-version: '16'
- distribution: 'temurin'
- cache: maven
- - name: Build with Maven
- run: mvn -B package --file pom.xml
- - name: Publish GitHub Release Artifacts
- uses: softprops/action-gh-release@v2
- with:
- files: |
- target/*.jar
- tag_name: ${{ github.event.inputs.tag }}
- token: ${{ secrets.GITHUB_TOKEN }}
- # Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive
- - name: Update dependency graph
- uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6
-
diff --git a/.vscode/settings.json b/.vscode/settings.json
new file mode 100644
index 0000000..b59d5f8
--- /dev/null
+++ b/.vscode/settings.json
@@ -0,0 +1,4 @@
+{
+ "java.configuration.updateBuildConfiguration": "interactive",
+ "innosetup.pathToIscc": "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe",
+}
\ No newline at end of file
diff --git a/Output/ResolveRPC-Setup.exe b/Output/ResolveRPC-Setup.exe
new file mode 100644
index 0000000..e3d6231
Binary files /dev/null and b/Output/ResolveRPC-Setup.exe differ
diff --git a/ResolveRPC-Setup.iss b/ResolveRPC-Setup.iss
new file mode 100644
index 0000000..aa52720
--- /dev/null
+++ b/ResolveRPC-Setup.iss
@@ -0,0 +1,34 @@
+[Setup]
+AppName=ResolveRPC
+AppVersion=1.0
+PrivilegesRequired=admin
+DefaultDirName={commonpf64}\ResolveRPC
+DefaultGroupName=ResolveRPC
+OutputBaseFilename=ResolveRPC-Setup
+Compression=lzma
+SolidCompression=yes
+
+[Files]
+Source: "target\ResolveRPC.exe"; DestDir: "{app}"; Flags: ignoreversion
+
+[Icons]
+Name: "{group}\ResolveRPC"; Filename: "{app}\ResolveRPC.exe"; WorkingDir: "{app}"; IconFilename: "{app}\ResolveRPC.exe"
+Name: "{commonstartup}\ResolveRPC"; Filename: "{app}\ResolveRPC.exe"; WorkingDir: "{app}"; IconFilename: "{app}\ResolveRPC.exe"
+
+[Run]
+Filename: "{app}\ResolveRPC.exe"; WorkingDir: "{app}"; Description: "Launch ResolveRPC now"; Flags: nowait postinstall skipifsilent
+
+[Code]
+
+procedure KillResolveRPC();
+var
+ ResultCode: Integer;
+begin
+ Exec('taskkill', '/F /IM ResolveRPC.exe', '', SW_HIDE, ewWaitUntilTerminated, ResultCode);
+end;
+
+function InitializeSetup(): Boolean;
+begin
+ KillResolveRPC();
+ Result := True;
+end;
\ No newline at end of file
diff --git a/dependency-reduced-pom.xml b/dependency-reduced-pom.xml
index 1b02751..50ed62c 100644
--- a/dependency-reduced-pom.xml
+++ b/dependency-reduced-pom.xml
@@ -3,15 +3,15 @@
4.0.0
net.jacobb
ResolveRPC
- 1.0.3
+ 1.0.4
maven-compiler-plugin
3.8.1
- 16
- 16
+ 21
+ 21
@@ -59,8 +59,8 @@
- 16
- 16
+ 21
+ 21
UTF-8
diff --git a/pom.xml b/pom.xml
index a80b440..92e9cdf 100644
--- a/pom.xml
+++ b/pom.xml
@@ -6,11 +6,16 @@
net.jacobb
ResolveRPC
- 1.0.3
+ 1.0.4
+ Discord Rich Presence for DaVinci Resolve
+ 2020
+
+ oh64
+
- 16
- 16
+ 21
+ 21
UTF-8
@@ -20,8 +25,8 @@
maven-compiler-plugin
3.8.1
- 16
- 16
+ 21
+ 21
@@ -37,7 +42,7 @@
- ${project.artifactId}-${project.version}
+ ${project.artifactId}
META-INF/spring.handlers
@@ -61,6 +66,42 @@
+
+ com.akathist.maven.plugins.launch4j
+ launch4j-maven-plugin
+ 2.5.0
+
+
+ l4j-clui
+ package
+
+ launch4j
+
+
+ gui
+ ${project.build.directory}/${project.artifactId}.jar
+ ${project.build.directory}/ResolveRPC.exe
+ ResolveRPC
+
+ net.jacobb.resolverpc.Main
+
+
+ 21
+
+
+ 1.0.4.0
+ ${project.version}
+ Discord Rich Presence for DaVinci Resolve
+ 1.0.4.0
+ ${project.version}
+ ResolveRPC
+ ResolveRPC
+ ResolveRPC.exe
+
+
+
+
+
diff --git a/src/main/java/net/jacobb/resolverpc/DiscordRpc.java b/src/main/java/net/jacobb/resolverpc/DiscordRpc.java
index ba3d24b..31d2612 100644
--- a/src/main/java/net/jacobb/resolverpc/DiscordRpc.java
+++ b/src/main/java/net/jacobb/resolverpc/DiscordRpc.java
@@ -3,7 +3,6 @@
import com.jagrosh.discordipc.*;
import com.jagrosh.discordipc.entities.RichPresence;
import com.jagrosh.discordipc.entities.pipe.PipeStatus;
-import com.jagrosh.discordipc.entities.pipe.WindowsPipe;
import com.jagrosh.discordipc.exceptions.NoDiscordClientException;
import java.io.IOException;
diff --git a/src/main/java/net/jacobb/resolverpc/Main.java b/src/main/java/net/jacobb/resolverpc/Main.java
index 1264de2..b485f49 100644
--- a/src/main/java/net/jacobb/resolverpc/Main.java
+++ b/src/main/java/net/jacobb/resolverpc/Main.java
@@ -1,10 +1,10 @@
package net.jacobb.resolverpc;
-import com.jagrosh.discordipc.IPCClient;
-import com.jagrosh.discordipc.entities.RichPresence;
import com.jagrosh.discordipc.entities.pipe.PipeStatus;
+import java.awt.*;
import java.io.IOException;
+import java.net.URL;
import java.util.Timer;
import java.util.TimerTask;
@@ -14,6 +14,51 @@
public class Main {
public static void main(String[] args) {
+ if (!SystemTray.isSupported()) {
+ System.err.println("System tray is not supported.");
+ return;
+ }
+
+ SystemTray tray = SystemTray.getSystemTray();
+ URL imageURL = Main.class.getClassLoader().getResource("icon.png");
+ Image image;
+ if (imageURL != null) {
+ image = Toolkit.getDefaultToolkit().getImage(imageURL);
+ } else {
+ System.err.println("Resource not found: icon.png");
+ image = Toolkit.getDefaultToolkit().createImage(new byte[0]);
+ }
+
+
+ PopupMenu popup = new PopupMenu();
+ MenuItem exitItem = new MenuItem("Stop");
+ exitItem.addActionListener(e -> {
+ client.close();
+ System.exit(0);
+ });
+ popup.add(exitItem);
+
+ MenuItem uninstallItem = new MenuItem("Uninstall");
+ uninstallItem.addActionListener(e -> {
+ try {
+ new ProcessBuilder("unins000.exe").start();
+ System.exit(0);
+ } catch (IOException ex) {
+ ex.printStackTrace();
+ }
+ });
+ popup.add(uninstallItem);
+
+ TrayIcon trayIcon = new TrayIcon(image, "ResolveRPC", popup);
+ trayIcon.setImageAutoSize(true);
+
+ try {
+ tray.add(trayIcon);
+ } catch (AWTException e) {
+ System.err.println("TrayIcon could not be added.");
+ return;
+ }
+
Timer timer = new Timer();
TimerTask timerTask = new TimerTask() {
@Override
diff --git a/src/main/java/net/jacobb/resolverpc/ProcessListFunc.java b/src/main/java/net/jacobb/resolverpc/ProcessListFunc.java
index d018c99..d96510a 100644
--- a/src/main/java/net/jacobb/resolverpc/ProcessListFunc.java
+++ b/src/main/java/net/jacobb/resolverpc/ProcessListFunc.java
@@ -12,14 +12,15 @@ public static boolean processList() throws IOException, InterruptedException {
Process process = new ProcessBuilder("tasklist.exe", "/fo", "csv", "/nh").start();
new Thread(() -> {
- Scanner sc = new Scanner(process.getInputStream());
- if (sc.hasNextLine()) sc.nextLine();
- while (sc.hasNextLine()) {
- String line = sc.nextLine();
- String[] parts = line.split(",");
- String unq = parts[0].substring(1).replaceFirst(".$", "");
- if (unq.equals("Resolve.exe")) {
- found.set(true);
+ try (Scanner sc = new Scanner(process.getInputStream())) {
+ if (sc.hasNextLine()) sc.nextLine();
+ while (sc.hasNextLine()) {
+ String line = sc.nextLine();
+ String[] parts = line.split(",");
+ String unq = parts[0].substring(1).replaceFirst(".$", "");
+ if (unq.equals("Resolve.exe")) {
+ found.set(true);
+ }
}
}
}).start();
@@ -34,14 +35,15 @@ public static boolean discordProcessList() throws IOException, InterruptedExcept
Process process = new ProcessBuilder("tasklist.exe", "/fo", "csv", "/nh").start();
new Thread(() -> {
- Scanner sc = new Scanner(process.getInputStream());
- if (sc.hasNextLine()) sc.nextLine();
- while (sc.hasNextLine()) {
- String line = sc.nextLine();
- String[] parts = line.split(",");
- String unq = parts[0].substring(1).replaceFirst(".$", "");
- if (unq.equals("Discord.exe") || unq.equals("DiscordCanary.exe") || unq.equals("DiscordPTB.exe")) {
- found.set(true);
+ try (Scanner sc = new Scanner(process.getInputStream())) {
+ if (sc.hasNextLine()) sc.nextLine();
+ while (sc.hasNextLine()) {
+ String line = sc.nextLine();
+ String[] parts = line.split(",");
+ String unq = parts[0].substring(1).replaceFirst(".$", "");
+ if (unq.equals("Discord.exe") || unq.equals("DiscordCanary.exe") || unq.equals("DiscordPTB.exe")) {
+ found.set(true);
+ }
}
}
}).start();
diff --git a/src/main/java/net/jacobb/resolverpc/WindowNameFunc.java b/src/main/java/net/jacobb/resolverpc/WindowNameFunc.java
index efd71d5..dd9ad4c 100644
--- a/src/main/java/net/jacobb/resolverpc/WindowNameFunc.java
+++ b/src/main/java/net/jacobb/resolverpc/WindowNameFunc.java
@@ -12,20 +12,21 @@ public static AtomicReference WindowName() throws InterruptedException,
Process process = new ProcessBuilder("tasklist", "/v", "/fo", "csv").start();
new Thread(() -> {
- Scanner sc = new Scanner(process.getInputStream());
- if (sc.hasNextLine()) sc.nextLine();
- while (sc.hasNextLine()) {
- String line = sc.nextLine();
- String[] parts = line.split(",");
- String unq = parts[8].substring(1).replaceFirst(".$", "");
- unq = unq.replace("N/A", "");
- if (unq.contains("Project Manager")) {
- current.set("Inside: Project Manager");
- }
- else if (unq.contains("DaVinci Resolve - ") || unq.contains("DaVinci Resolve Studio - ")) {
- unq = unq.replace("DaVinci Resolve - ", "")
- .replace("DaVinci Resolve Studio - ", "");
- current.set("Editing: " + unq);
+ try (Scanner sc = new Scanner(process.getInputStream())) {
+ if (sc.hasNextLine()) sc.nextLine();
+ while (sc.hasNextLine()) {
+ String line = sc.nextLine();
+ String[] parts = line.split(",");
+ String unq = parts[8].substring(1).replaceFirst(".$", "");
+ unq = unq.replace("N/A", "");
+ if (unq.contains("Project Manager")) {
+ current.set("Inside: Project Manager");
+ }
+ else if (unq.contains("DaVinci Resolve - ") || unq.contains("DaVinci Resolve Studio - ")) {
+ unq = unq.replace("DaVinci Resolve - ", "")
+ .replace("DaVinci Resolve Studio - ", "");
+ current.set("Editing: " + unq);
+ }
}
}
}).start();