Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
42 changes: 0 additions & 42 deletions .github/workflows/maven.yml

This file was deleted.

4 changes: 4 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"java.configuration.updateBuildConfiguration": "interactive",
"innosetup.pathToIscc": "C:\\Program Files (x86)\\Inno Setup 6\\ISCC.exe",
}
Binary file added Output/ResolveRPC-Setup.exe
Binary file not shown.
34 changes: 34 additions & 0 deletions ResolveRPC-Setup.iss
Original file line number Diff line number Diff line change
@@ -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;
10 changes: 5 additions & 5 deletions dependency-reduced-pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@
<modelVersion>4.0.0</modelVersion>
<groupId>net.jacobb</groupId>
<artifactId>ResolveRPC</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
Expand Down Expand Up @@ -59,8 +59,8 @@
</repository>
</repositories>
<properties>
<maven.compiler.target>16</maven.compiler.target>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>
Expand Down
53 changes: 47 additions & 6 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,16 @@

<groupId>net.jacobb</groupId>
<artifactId>ResolveRPC</artifactId>
<version>1.0.3</version>
<version>1.0.4</version>
<description>Discord Rich Presence for DaVinci Resolve</description>
<inceptionYear>2020</inceptionYear>
<organization>
<name>oh64</name>
</organization>

<properties>
<maven.compiler.source>16</maven.compiler.source>
<maven.compiler.target>16</maven.compiler.target>
<maven.compiler.source>21</maven.compiler.source>
<maven.compiler.target>21</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

Expand All @@ -20,8 +25,8 @@
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>16</source>
<target>16</target>
<source>21</source>
<target>21</target>
</configuration>
</plugin>
<plugin>
Expand All @@ -37,7 +42,7 @@
</execution>
</executions>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<finalName>${project.artifactId}</finalName>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/spring.handlers</resource>
Expand All @@ -61,6 +66,42 @@
</filters>
</configuration>
</plugin>
<plugin>
<groupId>com.akathist.maven.plugins.launch4j</groupId>
<artifactId>launch4j-maven-plugin</artifactId>
<version>2.5.0</version>
<executions>
<execution>
<id>l4j-clui</id>
<phase>package</phase>
<goals>
<goal>launch4j</goal>
</goals>
<configuration>
<headerType>gui</headerType>
<jar>${project.build.directory}/${project.artifactId}.jar</jar>
<outfile>${project.build.directory}/ResolveRPC.exe</outfile>
<errTitle>ResolveRPC</errTitle>
<classPath>
<mainClass>net.jacobb.resolverpc.Main</mainClass>
</classPath>
<jre>
<minVersion>21</minVersion>
</jre>
<versionInfo>
<fileVersion>1.0.4.0</fileVersion>
<txtFileVersion>${project.version}</txtFileVersion>
<fileDescription>Discord Rich Presence for DaVinci Resolve</fileDescription>
<productVersion>1.0.4.0</productVersion>
<txtProductVersion>${project.version}</txtProductVersion>
<productName>ResolveRPC</productName>
<internalName>ResolveRPC</internalName>
<originalFilename>ResolveRPC.exe</originalFilename>
</versionInfo>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
1 change: 0 additions & 1 deletion src/main/java/net/jacobb/resolverpc/DiscordRpc.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
49 changes: 47 additions & 2 deletions src/main/java/net/jacobb/resolverpc/Main.java
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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
Expand Down
34 changes: 18 additions & 16 deletions src/main/java/net/jacobb/resolverpc/ProcessListFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down
29 changes: 15 additions & 14 deletions src/main/java/net/jacobb/resolverpc/WindowNameFunc.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,20 +12,21 @@ public static AtomicReference<String> 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();
Expand Down