Skip to content
This repository has been archived by the owner on Feb 26, 2023. It is now read-only.

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
Insprill committed Oct 5, 2022
2 parents fe959cc + 3b3c45e commit d1c9265
Show file tree
Hide file tree
Showing 16 changed files with 202 additions and 111 deletions.
26 changes: 16 additions & 10 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,25 +8,31 @@ jobs:
steps:
- name: Checkout Repository
uses: actions/checkout@v3

- name: Set up JDK
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'adopt'
cache: 'gradle'
- name: Validate Gradle wrapper
java-version: '18'
distribution: 'temurin'

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@master
- name: Build with Gradle
uses: gradle/gradle-build-action@main
with:
arguments: |
build
--no-daemon

- name: Setup Gradle
uses: gradle/gradle-build-action@v2

- name: Build
run: ./gradlew build -x test

- name: Run Tests
run: ./gradlew test

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
name: Custom Car Manager Executable
path: build/launch4j/CustomCarManager.exe

- name: Upload Artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
8 changes: 8 additions & 0 deletions CHANGELOG.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
1.3.0:
- Added a button to open the folder a certain car is in.
- Added more checks against corrupt .rar files.
- Added a warning on startup if Derail Valley is running.
- Updated the Java install URL.
- Cars are now sorted alphabetically.


1.2.0:
- Added alternating background to cars to make it easier to delete the correct one.
- Added better Derail Valley installation validation.
Expand Down
18 changes: 9 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
plugins {
id 'java'
id 'application'
id 'org.beryx.jlink' version '2.24.1'
id 'org.beryx.jlink' version '2.25.0'
id 'edu.sc.seis.launch4j' version '2.5.3'
id 'org.openjfx.javafxplugin' version '0.0.10'
id 'org.openjfx.javafxplugin' version '0.0.13'
id 'com.github.johnrengelman.shadow' version '7.1.2'
}

group 'net.insprill'
version '1.2.0'
version '1.3.0'

sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
Expand All @@ -19,12 +19,12 @@ repositories {
}

dependencies {
implementation 'com.google.code.gson:gson:2.9.0'
implementation 'net.lingala.zip4j:zip4j:2.10.0'
implementation 'com.github.junrar:junrar:7.5.2'
implementation 'com.google.code.gson:gson:2.9.1'
implementation 'net.lingala.zip4j:zip4j:2.11.2'
implementation 'com.github.junrar:junrar:7.5.3'

testImplementation("org.junit.jupiter:junit-jupiter-api:5.8.2")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.8.2")
testImplementation("org.junit.jupiter:junit-jupiter-api:5.9.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.9.1")
}

shadowJar {
Expand Down Expand Up @@ -67,7 +67,7 @@ launch4j {
mainClassName = 'net.insprill.customcarmanager.CustomCarManager'
icon = "${rootDir}/src/main/resources/icons/icon.ico"
outfile = "CustomCarManager.exe"
downloadUrl = "https://download.oracle.com/java/17/archive/jdk-17.0.3.1_windows-x64_bin.exe"
downloadUrl = "https://adoptium.net/temurin/archive?version=17"
}

task packageDistribution(type: Zip) {
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
6 changes: 6 additions & 0 deletions gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,12 @@ set -- \
org.gradle.wrapper.GradleWrapperMain \
"$@"

# Stop when "xargs" is not available.
if ! command -v xargs >/dev/null 2>&1
then
die "xargs is not available"
fi

# Use "xargs" to parse quoted args.
#
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
Expand Down
180 changes: 91 additions & 89 deletions gradlew.bat
Original file line number Diff line number Diff line change
@@ -1,89 +1,91 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################

@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal

set DIRNAME=%~dp0
if "%DIRNAME%"=="" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%

@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi

@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"

@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome

set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if %ERRORLEVEL% equ 0 goto execute

echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe

if exist "%JAVA_EXE%" goto execute

echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.

goto fail

:execute
@rem Setup the command line

set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar


@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*

:end
@rem End local scope for the variables with windows NT shell
if %ERRORLEVEL% equ 0 goto mainEnd

:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
set EXIT_CODE=%ERRORLEVEL%
if %EXIT_CODE% equ 0 set EXIT_CODE=1
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
exit /b %EXIT_CODE%

:mainEnd
if "%OS%"=="Windows_NT" endlocal

:omega
4 changes: 4 additions & 0 deletions src/main/java/net/insprill/customcarmanager/cars/Car.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ public String getName() {
return this.name;
}

public File getDirectory() {
return this.directory;
}

/**
* Moves the car to the recycle bin, and updates the UI.
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import java.util.Set;
import java.util.concurrent.ThreadLocalRandom;
Expand Down Expand Up @@ -48,6 +49,7 @@ public void updateCars() {
continue;
this.cars.add(new Car(file));
}
this.cars.sort(Comparator.comparing(Car::getName));
Window.getInstance().populateCarList();
}

Expand Down
5 changes: 5 additions & 0 deletions src/main/java/net/insprill/customcarmanager/ui/Window.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import net.insprill.customcarmanager.ui.factory.FXMLFactory;
import net.insprill.customcarmanager.ui.factory.FileChooserFactory;
import net.insprill.customcarmanager.ui.factory.FolderChooserFactory;
import net.insprill.customcarmanager.util.Processes;

import java.io.File;
import java.io.IOException;
Expand Down Expand Up @@ -85,6 +86,10 @@ public void start(Stage primaryStage) throws IOException {
}

getCarManager().updateCars();

if (Processes.isProcessRunning("DerailValley")) {
ErrorDialog.show(Locale.getLine("dialog.error.derail-valley-running"));
}
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import net.insprill.customcarmanager.ui.dialog.InfoDialog;
import net.insprill.customcarmanager.ui.factory.FXMLFactory;

import java.awt.Desktop;
import java.io.IOException;

/**
Expand All @@ -27,8 +28,10 @@ public CarElement(Car car) throws IOException {
FXMLFactory.FXMLElement<Controller> fxml = FXMLFactory.load("/ui/car.fxml");
this.parent = fxml.parent();
this.controller = fxml.controller();
this.controller.car = car;
this.controller.car_name.setText(car.getName());
this.controller.delete_button.setText(Locale.getLine("window.cars.delete-button"));
this.controller.open_folder_button.setText(Locale.getLine("window.cars.open-folder"));
}

/**
Expand All @@ -52,6 +55,9 @@ public static class Controller {
public Pane car_background;
public Text car_name;
public Button delete_button;
public Button open_folder_button;

public Car car;

@FXML
public void deleteCar() {
Expand All @@ -68,6 +74,11 @@ public void deleteCar() {
InfoDialog.show(Locale.getLine("dialog.info.car-deleted").formatted(carName));
}

@FXML
public void openFolder() throws IOException {
Desktop.getDesktop().open(car.getDirectory());
}

}

}
Loading

0 comments on commit d1c9265

Please sign in to comment.