Skip to content

Commit

Permalink
1.2.8
Browse files Browse the repository at this point in the history
- Updated Everything to version 1.5.0.1390a
- Updated DDU to version 18.0.9.2
- Updated NVCleanstall to version 1.18.0
- Added dialog box before updating programs
- Improved debugging for updating programs
- Added Ubisoft.Connect to excluded programs list
  • Loading branch information
Foulest committed Feb 1, 2025
1 parent a090201 commit ecb3b40
Show file tree
Hide file tree
Showing 8 changed files with 40 additions and 15 deletions.
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ plugins {
}

group = 'net.foulest'
version = '1.2.7'
version = '1.2.8'
description = 'RepairKit'

// Set the language level to Java 17
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void setupEverything() {

// Adds a description label for Everything.
DebugUtil.debug("Creating the Everything description label...");
@NotNull JLabel description = SwingUtil.createLabel("Version: 1.5.0.1383a",
@NotNull JLabel description = SwingUtil.createLabel("Version: 1.5.0.1390a",
new Rectangle(baseWidth + 43, baseHeight + 20, 200, 30),
new Font(ConstantUtil.ARIAL, Font.BOLD, 12)
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ private void setupNVCleanstall() {

// Adds a description label for NVCleanstall.
DebugUtil.debug("Creating the NVCleanstall description label...");
@NotNull JLabel description = SwingUtil.createLabel("Version: 1.17.0",
@NotNull JLabel description = SwingUtil.createLabel("Version: 1.18.0",
new Rectangle(baseWidth + 43, baseHeight + 20, 200, 30),
new Font(ConstantUtil.ARIAL, Font.BOLD, 12)
);
Expand Down Expand Up @@ -173,7 +173,7 @@ private void setupDDU() {

// Adds a description label for DDU.
DebugUtil.debug("Creating the DDU description label...");
@NotNull JLabel description = SwingUtil.createLabel("Version: 18.0.8.9",
@NotNull JLabel description = SwingUtil.createLabel("Version: 18.0.9.2",
new Rectangle(baseWidth + 43, baseHeight + 20, 200, 30),
new Font(ConstantUtil.ARIAL, Font.BOLD, 12)
);
Expand Down
44 changes: 34 additions & 10 deletions src/main/java/net/foulest/repairkit/util/WinGetUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import net.foulest.repairkit.util.config.ConfigLoader;
import org.jetbrains.annotations.NotNull;

import javax.swing.*;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
Expand All @@ -20,23 +21,15 @@
@SuppressWarnings("resource")
public class WinGetUtil {

public static List<String> excludedPrograms = new ArrayList<>();

/**
* Updates all outdated programs.
*/
@SuppressWarnings("unchecked")
public static void updateAllPrograms() {
@NotNull List<String> outdatedPrograms = getOutdatedPrograms();

if (outdatedPrograms.isEmpty()) {
Toast.toast(ToastType.INFO, "RepairKit", "No outdated programs found.");
DebugUtil.debug("No outdated programs found.");
return;
}

@NotNull ConfigLoader configLoader = new ConfigLoader(FileUtil.getConfigFile("programs.json"));
Map<String, Object> config = configLoader.getConfig().get("excludedPrograms");

List<String> excludedPrograms;
Object values = config.get("values");

if (values == null || ((Collection<String>) values).isEmpty()) {
Expand All @@ -46,6 +39,14 @@ public static void updateAllPrograms() {
}

excludedPrograms = new ArrayList<>((Collection<String>) values);
@NotNull List<String> outdatedPrograms = getOutdatedPrograms();

if (outdatedPrograms.isEmpty()) {
Toast.toast(ToastType.INFO, "RepairKit", "No outdated programs found.");
DebugUtil.debug("No outdated programs found.");
return;
}

@NotNull List<String> updatedPrograms = new ArrayList<>();
int excludedCount = 0;

Expand Down Expand Up @@ -138,13 +139,36 @@ private static void installDependencies() {

DebugUtil.debug("Found " + programs.size() + " outdated programs.");
DebugUtil.debug("Programs: " + programs);

StringBuilder builder = new StringBuilder();
builder.append("Make sure to close the following programs before proceeding:\n");

// Adds the programs to the builder.
for (String program : programs) {
if (excludedPrograms.contains(program)) {
DebugUtil.debug("Skipping excluded program: " + program);
continue;
}

builder.append("\n- ").append(program);
}

// Check if the builder is empty, aside from the initial message.
if (builder.toString().equals("Make sure to close the following programs before proceeding:\n")) {
return programs;
}

SoundUtil.playSound(ConstantUtil.WARNING_SOUND);
JOptionPane.showMessageDialog(null, builder.toString(),
"Update Outdated Programs", JOptionPane.WARNING_MESSAGE);
return programs;
}

private static boolean updatePackage(String id) {
String output = CommandUtil.getPowerShellCommandOutput("winget upgrade --id " + id
+ " --disable-interactivity --silent --accept-package-agreements --accept-source-agreements",
false, false).toString();
DebugUtil.debug("Output: " + output);

return !output.contains("The package cannot be upgraded")
&& !output.contains("This package's version number cannot be determined")
Expand Down
Binary file modified src/main/resources/bin/DDU.7z
Binary file not shown.
Binary file modified src/main/resources/bin/Everything.7z
Binary file not shown.
Binary file modified src/main/resources/bin/NVCleanstall.7z
Binary file not shown.
3 changes: 2 additions & 1 deletion src/main/resources/config/programs.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@
"values": [
"Discord.Discord",
"Roblox.Roblox",
"PokeMMO.PokeMMO"
"PokeMMO.PokeMMO",
"Ubisoft.Connect"
]
}
}

0 comments on commit ecb3b40

Please sign in to comment.