Initial Commit
Dieser Commit ist enthalten in:
Commit
6a3c77ce62
87
.gitignore
vendored
Normale Datei
87
.gitignore
vendored
Normale Datei
@ -0,0 +1,87 @@
|
||||
### Maven template
|
||||
target/
|
||||
pom.xml.tag
|
||||
pom.xml.releaseBackup
|
||||
pom.xml.versionsBackup
|
||||
pom.xml.next
|
||||
release.properties
|
||||
dependency-reduced-pom.xml
|
||||
buildNumber.properties
|
||||
.mvn/timing.properties
|
||||
# https://github.com/takari/maven-wrapper#usage-without-binary-jar
|
||||
.mvn/wrapper/maven-wrapper.jar
|
||||
|
||||
### JetBrains template
|
||||
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio, WebStorm and Rider
|
||||
# Reference: https://intellij-support.jetbrains.com/hc/en-us/articles/206544839
|
||||
|
||||
# User-specific stuff
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/**/usage.statistics.xml
|
||||
.idea/**/dictionaries
|
||||
.idea/**/shelf
|
||||
|
||||
# Generated files
|
||||
.idea/**/contentModel.xml
|
||||
|
||||
# Sensitive or high-churn files
|
||||
.idea/**/dataSources/
|
||||
.idea/**/dataSources.ids
|
||||
.idea/**/dataSources.local.xml
|
||||
.idea/**/sqlDataSources.xml
|
||||
.idea/**/dynamic.xml
|
||||
.idea/**/uiDesigner.xml
|
||||
.idea/**/dbnavigator.xml
|
||||
|
||||
# Gradle
|
||||
.idea/**/gradle.xml
|
||||
.idea/**/libraries
|
||||
|
||||
# Gradle and Maven with auto-import
|
||||
# When using Gradle or Maven with auto-import, you should exclude module files,
|
||||
# since they will be recreated, and may cause churn. Uncomment if using
|
||||
# auto-import.
|
||||
# .idea/artifacts
|
||||
# .idea/compiler.xml
|
||||
# .idea/jarRepositories.xml
|
||||
# .idea/modules.xml
|
||||
# .idea/*.iml
|
||||
# .idea/modules
|
||||
# *.iml
|
||||
# *.ipr
|
||||
|
||||
# CMake
|
||||
cmake-build-*/
|
||||
|
||||
# Mongo Explorer plugin
|
||||
.idea/**/mongoSettings.xml
|
||||
|
||||
# File-based project format
|
||||
*.iws
|
||||
|
||||
# IntelliJ
|
||||
out/
|
||||
|
||||
# mpeltonen/sbt-idea plugin
|
||||
.idea_modules/
|
||||
|
||||
# JIRA plugin
|
||||
atlassian-ide-plugin.xml
|
||||
|
||||
# Cursive Clojure plugin
|
||||
.idea/replstate.xml
|
||||
|
||||
# Crashlytics plugin (for Android Studio and IntelliJ)
|
||||
com_crashlytics_export_strings.xml
|
||||
crashlytics.properties
|
||||
crashlytics-build.properties
|
||||
fabric.properties
|
||||
|
||||
# Editor-based Rest Client
|
||||
.idea/httpRequests
|
||||
|
||||
# Android studio 3.1+ serialized cache file
|
||||
.idea/caches/build_file_checksums.ser
|
||||
./.idea
|
||||
|
0
.idea/sonarlint/issuestore/index.pb
Normale Datei
0
.idea/sonarlint/issuestore/index.pb
Normale Datei
11
config.json
Normale Datei
11
config.json
Normale Datei
@ -0,0 +1,11 @@
|
||||
{
|
||||
"projectPath": "~/IdeaProjects/",
|
||||
"libPath": "~/libs/",
|
||||
"defaultName": "default",
|
||||
"libUrl": "https://steamwar.de/lib.php",
|
||||
"additionalArgs": ["-d"],
|
||||
"credentials": {
|
||||
"username": "[EnterName]",
|
||||
"password": "[EnterPW]"
|
||||
}
|
||||
}
|
92
pom.xml
Normale Datei
92
pom.xml
Normale Datei
@ -0,0 +1,92 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<groupId>de.chaos</groupId>
|
||||
<artifactId>swlnmngr</artifactId>
|
||||
<version>1.0-SNAPSHOT</version>
|
||||
<name>SteamWarLinkManager</name>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>17</maven.compiler.source>
|
||||
<maven.compiler.target>17</maven.compiler.target>
|
||||
</properties>
|
||||
|
||||
<build>
|
||||
<defaultGoal>clean package</defaultGoal>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<shadedArtifactAttached>true</shadedArtifactAttached>
|
||||
<transformers>
|
||||
<transformer implementation=
|
||||
"org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>de.chaos.swlnmngr.Main</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
<finalName>${name}</finalName>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
<resources>
|
||||
<resource>
|
||||
<directory>src/main/resources</directory>
|
||||
<includes>
|
||||
<include>*.*</include>
|
||||
</includes>
|
||||
<filtering>false</filtering>
|
||||
</resource>
|
||||
</resources>
|
||||
<finalName>${name}-noshade</finalName>
|
||||
</build>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.json</groupId>
|
||||
<artifactId>json</artifactId>
|
||||
<version>20211205</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>junit</groupId>
|
||||
<artifactId>junit</artifactId>
|
||||
<version>4.13.2</version>
|
||||
<scope>test</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<version>1.18.22</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-cli</groupId>
|
||||
<artifactId>commons-cli</artifactId>
|
||||
<version>1.5.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-api</artifactId>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.logging.log4j</groupId>
|
||||
<artifactId>log4j-core</artifactId>
|
||||
<version>2.17.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.apache.httpcomponents</groupId>
|
||||
<artifactId>httpclient</artifactId>
|
||||
<version>4.5.13</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
30
src/main/java/de/chaos/swlnmngr/Main.java
Normale Datei
30
src/main/java/de/chaos/swlnmngr/Main.java
Normale Datei
@ -0,0 +1,30 @@
|
||||
package de.chaos.swlnmngr;
|
||||
|
||||
import de.chaos.swlnmngr.config.CLIConfig;
|
||||
import de.chaos.swlnmngr.config.Config;
|
||||
import lombok.Getter;
|
||||
import org.apache.logging.log4j.Level;
|
||||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
import org.apache.logging.log4j.core.config.Configurator;
|
||||
|
||||
import java.util.Arrays;
|
||||
|
||||
public class Main {
|
||||
|
||||
@Getter
|
||||
private static final Logger logger = LogManager.getLogger(Main.class);
|
||||
@Getter
|
||||
private static String[] allArgs;
|
||||
|
||||
public static void main(String[] args) {
|
||||
logger.log(Level.INFO, "SteamWarLinkManager by Chaoscaot");
|
||||
allArgs = new String[args.length + Config.ADDITIONAL_ARGS.length];
|
||||
System.arraycopy(args, 0, allArgs, 0, args.length);
|
||||
System.arraycopy(Config.ADDITIONAL_ARGS, 0, allArgs, args.length, Config.ADDITIONAL_ARGS.length);
|
||||
if(CLIConfig.IS_DEBUG) {
|
||||
Configurator.setRootLevel(Level.DEBUG);
|
||||
}
|
||||
logger.debug("Arguments: {}", Arrays.toString(allArgs));
|
||||
}
|
||||
}
|
33
src/main/java/de/chaos/swlnmngr/config/CLIConfig.java
Normale Datei
33
src/main/java/de/chaos/swlnmngr/config/CLIConfig.java
Normale Datei
@ -0,0 +1,33 @@
|
||||
package de.chaos.swlnmngr.config;
|
||||
|
||||
import de.chaos.swlnmngr.Main;
|
||||
import org.apache.commons.cli.*;
|
||||
|
||||
public class CLIConfig {
|
||||
|
||||
public static final boolean IS_DEBUG;
|
||||
public static final boolean UPDATE;
|
||||
public static final String[] ARGS;
|
||||
|
||||
static {
|
||||
Options options = new Options();
|
||||
options.addOption(new Option("d", "debug", false, "Set the Log Level to Debug"));
|
||||
options.addOption(new Option("u", "update", false, "Update the Default libs"));
|
||||
|
||||
CommandLine cli = null;
|
||||
CommandLineParser parser = new DefaultParser();
|
||||
HelpFormatter formatter = new HelpFormatter();
|
||||
|
||||
try {
|
||||
cli = parser.parse(options, Main.getAllArgs());
|
||||
} catch (ParseException e) {
|
||||
Main.getLogger().error(e.getMessage());
|
||||
formatter.printHelp("swlnmngr", options, true);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
ARGS = cli.getArgs();
|
||||
IS_DEBUG = cli.hasOption("d");
|
||||
UPDATE = cli.hasOption("u");
|
||||
}
|
||||
}
|
37
src/main/java/de/chaos/swlnmngr/config/Config.java
Normale Datei
37
src/main/java/de/chaos/swlnmngr/config/Config.java
Normale Datei
@ -0,0 +1,37 @@
|
||||
package de.chaos.swlnmngr.config;
|
||||
|
||||
import de.chaos.swlnmngr.Main;
|
||||
import org.json.JSONObject;
|
||||
import org.json.JSONTokener;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileInputStream;
|
||||
import java.nio.file.Files;
|
||||
import java.nio.file.StandardOpenOption;
|
||||
|
||||
public class Config {
|
||||
|
||||
private static final File CONFIG_FILE = new File("config.json");
|
||||
|
||||
public static final String[] ADDITIONAL_ARGS;
|
||||
|
||||
static {
|
||||
JSONObject config = null;
|
||||
try {
|
||||
if(!CONFIG_FILE.exists()) {
|
||||
Files.write(CONFIG_FILE.toPath(), Config.class.getResourceAsStream("/default_config.json").readAllBytes(), StandardOpenOption.CREATE_NEW);
|
||||
}
|
||||
|
||||
config = new JSONObject(new JSONTokener(new FileInputStream(CONFIG_FILE)));
|
||||
} catch (Exception e) {
|
||||
Main.getLogger().fatal("Could not load Config", e);
|
||||
System.exit(1);
|
||||
}
|
||||
|
||||
ADDITIONAL_ARGS = config.getJSONArray("additionalArgs").toList().toArray(new String[0]);
|
||||
}
|
||||
|
||||
public static void reset() {
|
||||
|
||||
}
|
||||
}
|
4
src/main/java/de/chaos/swlnmngr/route/Router.java
Normale Datei
4
src/main/java/de/chaos/swlnmngr/route/Router.java
Normale Datei
@ -0,0 +1,4 @@
|
||||
package de.chaos.swlnmngr.route;
|
||||
|
||||
public class Router {
|
||||
}
|
7
src/main/java/de/chaos/swlnmngr/route/routes/Route.java
Normale Datei
7
src/main/java/de/chaos/swlnmngr/route/routes/Route.java
Normale Datei
@ -0,0 +1,7 @@
|
||||
package de.chaos.swlnmngr.route.routes;
|
||||
|
||||
public interface Route {
|
||||
String getName();
|
||||
|
||||
boolean route(String[] args);
|
||||
}
|
5
src/main/java/de/chaos/swlnmngr/route/routes/Routes.java
Normale Datei
5
src/main/java/de/chaos/swlnmngr/route/routes/Routes.java
Normale Datei
@ -0,0 +1,5 @@
|
||||
package de.chaos.swlnmngr.route.routes;
|
||||
|
||||
public enum Routes {
|
||||
|
||||
}
|
11
src/main/resources/default_config.json
Normale Datei
11
src/main/resources/default_config.json
Normale Datei
@ -0,0 +1,11 @@
|
||||
{
|
||||
"projectPath": "~/IdeaProjects/",
|
||||
"libPath": "~/libs/",
|
||||
"defaultName": "default",
|
||||
"libUrl": "https://steamwar.de/lib.php",
|
||||
"additionalArgs": [],
|
||||
"credentials": {
|
||||
"username": "[EnterName]",
|
||||
"password": "[EnterPW]"
|
||||
}
|
||||
}
|
0
src/main/resources/default_swlnmngr.bat
Normale Datei
0
src/main/resources/default_swlnmngr.bat
Normale Datei
0
src/main/resources/default_swlnmngr.sh
Normale Datei
0
src/main/resources/default_swlnmngr.sh
Normale Datei
18
src/main/resources/log4j2.xml
Normale Datei
18
src/main/resources/log4j2.xml
Normale Datei
@ -0,0 +1,18 @@
|
||||
<Configuration xmlns="http://logging.apache.org/log4j/2.0/config">
|
||||
<Appenders>
|
||||
<Console name="STDOUT" target="SYSTEM_OUT">
|
||||
<PatternLayout pattern="%d{HH:mm:ss} [%level]: %msg%n"/>
|
||||
</Console>
|
||||
</Appenders>
|
||||
<Loggers>
|
||||
<Logger name="org.apache.hc.client5.http" level="DEBUG">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Logger>
|
||||
<Logger name="org.apache.hc.client5.http.wire" level="DEBUG">
|
||||
<AppenderRef ref="STDOUT"/>
|
||||
</Logger>
|
||||
<Root level="INFO">
|
||||
<AppenderRef ref="STDOUT" />
|
||||
</Root>
|
||||
</Loggers>
|
||||
</Configuration>
|
In neuem Issue referenzieren
Einen Benutzer sperren