Archived
Private
Public Access
1
0

Initial commit

This commit is contained in:
2022-09-04 12:45:01 +02:00
commit f4a01d6a69
11601 changed files with 4206660 additions and 0 deletions

3
Java/Bootstrap/.idea/.gitignore generated vendored Normal file
View File

@@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

13
Java/Bootstrap/.idea/compiler.xml generated Normal file
View File

@@ -0,0 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<annotationProcessing>
<profile name="Maven default annotation processors profile" enabled="true">
<sourceOutputDir name="target/generated-sources/annotations" />
<sourceTestOutputDir name="target/generated-test-sources/test-annotations" />
<outputRelativeToContentRoot value="true" />
<module name="Bootstrap" />
</profile>
</annotationProcessing>
</component>
</project>

7
Java/Bootstrap/.idea/discord.xml generated Normal file
View File

@@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DiscordProjectSettings">
<option name="show" value="PROJECT_FILES" />
<option name="description" value="" />
</component>
</project>

20
Java/Bootstrap/.idea/jarRepositories.xml generated Normal file
View File

@@ -0,0 +1,20 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="RemoteRepositoriesConfiguration">
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Central Repository" />
<option name="url" value="https://repo.maven.apache.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="central" />
<option name="name" value="Maven Central repository" />
<option name="url" value="https://repo1.maven.org/maven2" />
</remote-repository>
<remote-repository>
<option name="id" value="jboss.community" />
<option name="name" value="JBoss Community repository" />
<option name="url" value="https://repository.jboss.org/nexus/content/repositories/public/" />
</remote-repository>
</component>
</project>

14
Java/Bootstrap/.idea/misc.xml generated Normal file
View File

@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="ExternalStorageConfigurationManager" enabled="true" />
<component name="MavenProjectsManager">
<option name="originalFiles">
<list>
<option value="$PROJECT_DIR$/pom.xml" />
</list>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_14" default="true" project-jdk-name="14" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
</project>

124
Java/Bootstrap/.idea/uiDesigner.xml generated Normal file
View File

@@ -0,0 +1,124 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="Palette2">
<group name="Swing">
<item class="com.intellij.uiDesigner.HSpacer" tooltip-text="Horizontal Spacer" icon="/com/intellij/uiDesigner/icons/hspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="1" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="com.intellij.uiDesigner.VSpacer" tooltip-text="Vertical Spacer" icon="/com/intellij/uiDesigner/icons/vspacer.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="1" anchor="0" fill="2" />
</item>
<item class="javax.swing.JPanel" icon="/com/intellij/uiDesigner/icons/panel.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3" />
</item>
<item class="javax.swing.JScrollPane" icon="/com/intellij/uiDesigner/icons/scrollPane.png" removable="false" auto-create-binding="false" can-attach-label="true">
<default-constraints vsize-policy="7" hsize-policy="7" anchor="0" fill="3" />
</item>
<item class="javax.swing.JButton" icon="/com/intellij/uiDesigner/icons/button.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="0" fill="1" />
<initial-values>
<property name="text" value="Button" />
</initial-values>
</item>
<item class="javax.swing.JRadioButton" icon="/com/intellij/uiDesigner/icons/radioButton.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="RadioButton" />
</initial-values>
</item>
<item class="javax.swing.JCheckBox" icon="/com/intellij/uiDesigner/icons/checkBox.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="3" anchor="8" fill="0" />
<initial-values>
<property name="text" value="CheckBox" />
</initial-values>
</item>
<item class="javax.swing.JLabel" icon="/com/intellij/uiDesigner/icons/label.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="8" fill="0" />
<initial-values>
<property name="text" value="Label" />
</initial-values>
</item>
<item class="javax.swing.JTextField" icon="/com/intellij/uiDesigner/icons/textField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JPasswordField" icon="/com/intellij/uiDesigner/icons/passwordField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JFormattedTextField" icon="/com/intellij/uiDesigner/icons/formattedTextField.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1">
<preferred-size width="150" height="-1" />
</default-constraints>
</item>
<item class="javax.swing.JTextArea" icon="/com/intellij/uiDesigner/icons/textArea.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTextPane" icon="/com/intellij/uiDesigner/icons/textPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JEditorPane" icon="/com/intellij/uiDesigner/icons/editorPane.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JComboBox" icon="/com/intellij/uiDesigner/icons/comboBox.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="2" anchor="8" fill="1" />
</item>
<item class="javax.swing.JTable" icon="/com/intellij/uiDesigner/icons/table.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JList" icon="/com/intellij/uiDesigner/icons/list.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="2" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTree" icon="/com/intellij/uiDesigner/icons/tree.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3">
<preferred-size width="150" height="50" />
</default-constraints>
</item>
<item class="javax.swing.JTabbedPane" icon="/com/intellij/uiDesigner/icons/tabbedPane.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSplitPane" icon="/com/intellij/uiDesigner/icons/splitPane.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="3" hsize-policy="3" anchor="0" fill="3">
<preferred-size width="200" height="200" />
</default-constraints>
</item>
<item class="javax.swing.JSpinner" icon="/com/intellij/uiDesigner/icons/spinner.png" removable="false" auto-create-binding="true" can-attach-label="true">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSlider" icon="/com/intellij/uiDesigner/icons/slider.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="8" fill="1" />
</item>
<item class="javax.swing.JSeparator" icon="/com/intellij/uiDesigner/icons/separator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="6" anchor="0" fill="3" />
</item>
<item class="javax.swing.JProgressBar" icon="/com/intellij/uiDesigner/icons/progressbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1" />
</item>
<item class="javax.swing.JToolBar" icon="/com/intellij/uiDesigner/icons/toolbar.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="6" anchor="0" fill="1">
<preferred-size width="-1" height="20" />
</default-constraints>
</item>
<item class="javax.swing.JToolBar$Separator" icon="/com/intellij/uiDesigner/icons/toolbarSeparator.png" removable="false" auto-create-binding="false" can-attach-label="false">
<default-constraints vsize-policy="0" hsize-policy="0" anchor="0" fill="1" />
</item>
<item class="javax.swing.JScrollBar" icon="/com/intellij/uiDesigner/icons/scrollbar.png" removable="false" auto-create-binding="true" can-attach-label="false">
<default-constraints vsize-policy="6" hsize-policy="0" anchor="0" fill="2" />
</item>
</group>
</component>
</project>

16
Java/Bootstrap/pom.xml Normal file
View File

@@ -0,0 +1,16 @@
<?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.craftix</groupId>
<artifactId>Bootstrap</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>14</maven.compiler.source>
<maven.compiler.target>14</maven.compiler.target>
</properties>
</project>

View File

@@ -0,0 +1,43 @@
package de.craftix.bootstrap;
import de.craftix.bootstrap.logging.Logger;
import de.craftix.bootstrap.logging.language.Lang;
import de.craftix.bootstrap.logging.language.LangManager;
import de.craftix.bootstrap.logging.language.languages.German;
public final class Bootstrap {
private static Bootstrap instance;
private LangManager langManager;
private Logger logger;
public static void main(String[] args) {
try {
instance = new Bootstrap();
instance.initialize();
}catch (Exception e) {
instance.logger.throwException(e);
}
}
public static Bootstrap getInstance() {
return instance;
}
private void initialize() {
logger = new Logger(System.out, System.out, System.err);
langManager = new LangManager("de-DE");
langManager.addLanguages(new German());
logger.info(Lang.LOGGER_INITIALIZED);
logger.info(Lang.LANG_MANAGER_INITIALIZED);
logger.info(Lang.DEFAULT_LANGUAGE, langManager.getCurrentLanguage().getLocalName());
}
public LangManager getLangManager() {
return langManager;
}
public Logger getLogger() {
return logger;
}
}

View File

@@ -0,0 +1,47 @@
package de.craftix.bootstrap.logging;
import de.craftix.bootstrap.Bootstrap;
import java.io.PrintStream;
public class Logger {
private PrintStream infoStream;
private PrintStream warningStream;
private PrintStream errorStream;
public Logger(PrintStream infoStream, PrintStream warningStream, PrintStream errorStream) {
this.infoStream = infoStream;
this.warningStream = warningStream;
this.errorStream = errorStream;
}
public void info(Object key, String... variables) {
String message = Bootstrap.getInstance().getLangManager().getMessage(key.toString(), variables);
message = convertColorCodes(message);
infoStream.println(message);
}
public void warning(Object key, String... variables) {
String message = Bootstrap.getInstance().getLangManager().getMessage(key.toString(), variables);
message = convertColorCodes(message);
warningStream.println(message);
}
public void error(Object key, String... variables) {
String message = Bootstrap.getInstance().getLangManager().getMessage(key.toString(), variables);
message = convertColorCodes(message);
errorStream.println(message);
}
public void throwException(Exception e) {
e.printStackTrace(errorStream);
System.exit(0);
}
private String convertColorCodes(String message) {
//TODO: CONVERT COLOR CODES
return message;
}
}

View File

@@ -0,0 +1,22 @@
package de.craftix.bootstrap.logging.language;
public enum Lang {
MESSAGE_NOT_FOUND("message-not-found"),
LOGGER_INITIALIZED("logger-loaded"),
LANG_MANAGER_INITIALIZED("lang-manager-initialized"),
LANG_MANAGER_INITIALIZE_LANGUAGES("lang-manager-languages-initialize"),
LANG_MANAGER_INITIALIZE_LANGUAGE("lang-manager-language-initialize"),
LANG_MANAGER_TEST_LANGUAGES("lang-manager-languages-test"),
LANG_MANAGER_TEST_LANGUAGE("lang-manager-language-test"),
DEFAULT_LANGUAGE("language-default");
private final String key;
Lang(String key) {
this.key = key;
}
@Override
public String toString() {
return key;
}
}

View File

@@ -0,0 +1,52 @@
package de.craftix.bootstrap.logging.language;
import de.craftix.bootstrap.Bootstrap;
import java.util.HashMap;
import java.util.Map;
public class LangManager {
private final Map<String, Language> languages = new HashMap<>();
private String currentLang;
public LangManager(String defaultLanguage) {
currentLang = defaultLanguage;
}
public String getMessage(String key, String[] variables) {
String raw = languages.get(currentLang).getMessage(key);
for (int i = 0; i < variables.length; i++) {
raw = raw.replace("{" + i + "}", variables[i]);
}
return raw;
}
public Language getLanguage(String langKey) {
return languages.get(langKey);
}
public void setLanguage(String langKey) {
if (!languages.containsKey(langKey))
throw new NullPointerException("Language [" + langKey + "] not found!");
currentLang = langKey;
}
public void addLanguages(Language... languages) {
for (Language language : languages) {
language.setupLanguage();
if (!language.testLanguage())
throw new IllegalStateException("Language [" + language.getLangKey() + "] does not implement all Messages");
this.languages.put(language.getLangKey(), language);
Bootstrap.getInstance().getLogger().info(Lang.LANG_MANAGER_TEST_LANGUAGE, language.getGlobalName());
Bootstrap.getInstance().getLogger().info(Lang.LANG_MANAGER_INITIALIZE_LANGUAGE, language.getGlobalName());
}
Bootstrap.getInstance().getLogger().info(Lang.LANG_MANAGER_TEST_LANGUAGES);
Bootstrap.getInstance().getLogger().info(Lang.LANG_MANAGER_INITIALIZE_LANGUAGES);
}
public Language getCurrentLanguage() {
return languages.get(currentLang);
}
}

View File

@@ -0,0 +1,59 @@
package de.craftix.bootstrap.logging.language;
import de.craftix.bootstrap.Bootstrap;
import java.io.Serializable;
import java.util.HashMap;
import java.util.Map;
import java.util.Objects;
public abstract class Language implements Serializable {
protected Map<String, String> messages = new HashMap<>();
protected void setMessage(Object key, String message) {
messages.remove(key.toString());
messages.put(key.toString(), message);
}
public String getMessage(String key) {
String message = messages.get(key);
if (message == null) return Bootstrap.getInstance().getLangManager().getMessage(Lang.MESSAGE_NOT_FOUND.toString(), new String[] {key});
else return message;
}
public Language() {
setMessage(Lang.MESSAGE_NOT_FOUND, "[" + getGlobalName() + "] Could not find message with Key '{0}'");
}
protected abstract void setupLanguage();
public abstract String getLangKey();
public abstract String getLocalName();
public abstract String getGlobalName();
protected boolean testLanguage() {
for (Lang value : Lang.values()) {
if (messages.get(value.toString()) == null) return false;
}
return true;
}
@Override
public String toString() {
return "Language{" + getLangKey() + "}";
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
Language language = (Language) o;
return Objects.equals(getLangKey(), language.getLangKey());
}
@Override
public int hashCode() {
return Objects.hash(getLangKey());
}
}

View File

@@ -0,0 +1,27 @@
package de.craftix.bootstrap.logging.language.languages;
import de.craftix.bootstrap.logging.language.Lang;
import de.craftix.bootstrap.logging.language.Language;
public final class German extends Language {
@Override
protected void setupLanguage() {
setMessage(Lang.LOGGER_INITIALIZED, "Der Logger wurde erfolgreich initialisiert.");
setMessage(Lang.DEFAULT_LANGUAGE, "Die Standartsprache ist jetzt {0}.");
setMessage(Lang.LANG_MANAGER_INITIALIZED, "Der Language Manager wurde erfolgreich initialisiert.");
setMessage(Lang.LANG_MANAGER_INITIALIZE_LANGUAGE, "Die Sprache {0} wurde erfolgreich initialisiert.");
setMessage(Lang.LANG_MANAGER_INITIALIZE_LANGUAGES, "Alle Sprachen wurden erfolgreich initialisiert.");
setMessage(Lang.LANG_MANAGER_TEST_LANGUAGE, "Die Sprache {0} wurde auf Vollständigkeit überprüft.");
setMessage(Lang.LANG_MANAGER_TEST_LANGUAGES, "Alle Sprachen wurden auf Vollständigkeit überprüft.");
}
public String getLangKey() {
return "de-DE";
}
public String getLocalName() {
return "Deutsch";
}
public String getGlobalName() {
return "German";
}
}