Compare commits
No commits in common. "master" and "1.0" have entirely different histories.
210
.gitignore
vendored
Normal file
210
.gitignore
vendored
Normal file
@ -0,0 +1,210 @@
|
|||||||
|
|
||||||
|
# Created by https://www.gitignore.io/api/java,gradle,eclipse,intellij,forgegradle
|
||||||
|
# Edit at https://www.gitignore.io/?templates=java,gradle,eclipse,intellij,forgegradle
|
||||||
|
|
||||||
|
### Eclipse ###
|
||||||
|
.metadata
|
||||||
|
bin/
|
||||||
|
tmp/
|
||||||
|
*.tmp
|
||||||
|
*.bak
|
||||||
|
*.swp
|
||||||
|
*~.nib
|
||||||
|
local.properties
|
||||||
|
.settings/
|
||||||
|
.loadpath
|
||||||
|
.recommenders
|
||||||
|
|
||||||
|
# External tool builders
|
||||||
|
.externalToolBuilders/
|
||||||
|
|
||||||
|
# Locally stored "Eclipse launch configurations"
|
||||||
|
*.launch
|
||||||
|
|
||||||
|
# PyDev specific (Python IDE for Eclipse)
|
||||||
|
*.pydevproject
|
||||||
|
|
||||||
|
# CDT-specific (C/C++ Development Tooling)
|
||||||
|
.cproject
|
||||||
|
|
||||||
|
# CDT- autotools
|
||||||
|
.autotools
|
||||||
|
|
||||||
|
# Java annotation processor (APT)
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
# PDT-specific (PHP Development Tools)
|
||||||
|
.buildpath
|
||||||
|
|
||||||
|
# sbteclipse plugin
|
||||||
|
.target
|
||||||
|
|
||||||
|
# Tern plugin
|
||||||
|
.tern-project
|
||||||
|
|
||||||
|
# TeXlipse plugin
|
||||||
|
.texlipse
|
||||||
|
|
||||||
|
# STS (Spring Tool Suite)
|
||||||
|
.springBeans
|
||||||
|
|
||||||
|
# Code Recommenders
|
||||||
|
.recommenders/
|
||||||
|
|
||||||
|
# Annotation Processing
|
||||||
|
.apt_generated/
|
||||||
|
|
||||||
|
# Scala IDE specific (Scala & Java development for Eclipse)
|
||||||
|
.cache-main
|
||||||
|
.scala_dependencies
|
||||||
|
.worksheet
|
||||||
|
|
||||||
|
### Eclipse Patch ###
|
||||||
|
# Eclipse Core
|
||||||
|
.project
|
||||||
|
|
||||||
|
# JDT-specific (Eclipse Java Development Tools)
|
||||||
|
.classpath
|
||||||
|
|
||||||
|
# Annotation Processing
|
||||||
|
.apt_generated
|
||||||
|
|
||||||
|
.sts4-cache/
|
||||||
|
|
||||||
|
### ForgeGradle ###
|
||||||
|
# Minecraft client/server files
|
||||||
|
run/
|
||||||
|
|
||||||
|
### Intellij ###
|
||||||
|
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm, CLion, Android Studio and WebStorm
|
||||||
|
# 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/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
|
||||||
|
|
||||||
|
### Intellij Patch ###
|
||||||
|
# Comment Reason: https://github.com/joeblau/gitignore.io/issues/186#issuecomment-215987721
|
||||||
|
|
||||||
|
# *.iml
|
||||||
|
# modules.xml
|
||||||
|
# .idea/misc.xml
|
||||||
|
# *.ipr
|
||||||
|
|
||||||
|
# Sonarlint plugin
|
||||||
|
.idea/**/sonarlint/
|
||||||
|
|
||||||
|
# SonarQube Plugin
|
||||||
|
.idea/**/sonarIssues.xml
|
||||||
|
|
||||||
|
# Markdown Navigator plugin
|
||||||
|
.idea/**/markdown-navigator.xml
|
||||||
|
.idea/**/markdown-navigator/
|
||||||
|
|
||||||
|
### Java ###
|
||||||
|
# Compiled class file
|
||||||
|
*.class
|
||||||
|
|
||||||
|
# Log file
|
||||||
|
*.log
|
||||||
|
|
||||||
|
# BlueJ files
|
||||||
|
*.ctxt
|
||||||
|
|
||||||
|
# Mobile Tools for Java (J2ME)
|
||||||
|
.mtj.tmp/
|
||||||
|
|
||||||
|
# Package Files #
|
||||||
|
*.jar
|
||||||
|
*.war
|
||||||
|
*.nar
|
||||||
|
*.ear
|
||||||
|
*.zip
|
||||||
|
*.tar.gz
|
||||||
|
*.rar
|
||||||
|
|
||||||
|
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
|
||||||
|
hs_err_pid*
|
||||||
|
|
||||||
|
### Gradle ###
|
||||||
|
.gradle
|
||||||
|
build/
|
||||||
|
|
||||||
|
# Ignore Gradle GUI config
|
||||||
|
gradle-app.setting
|
||||||
|
|
||||||
|
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||||
|
!gradle-wrapper.jar
|
||||||
|
|
||||||
|
# Cache of project
|
||||||
|
.gradletasknamecache
|
||||||
|
|
||||||
|
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||||
|
# gradle/wrapper/gradle-wrapper.properties
|
||||||
|
|
||||||
|
### Gradle Patch ###
|
||||||
|
**/build/
|
||||||
|
|
||||||
|
# End of https://www.gitignore.io/api/java,gradle,eclipse,intellij,forgegradle
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,2 +0,0 @@
|
|||||||
#Fri May 01 18:13:14 CEST 2020
|
|
||||||
gradle.version=6.1
|
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
8
.idea/.gitignore
vendored
8
.idea/.gitignore
vendored
@ -1,8 +0,0 @@
|
|||||||
# Default ignored files
|
|
||||||
/shelf/
|
|
||||||
/workspace.xml
|
|
||||||
# Datasource local storage ignored files
|
|
||||||
/dataSources/
|
|
||||||
/dataSources.local.xml
|
|
||||||
# Editor-based HTTP Client requests
|
|
||||||
/httpRequests/
|
|
@ -1 +1 @@
|
|||||||
FlansUpdater
|
ch.m4th1eu
|
@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="CompilerConfiguration">
|
|
||||||
<bytecodeTargetLevel target="1.8" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="DiscordProjectSettings">
|
|
||||||
<option name="show" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectNotificationSettings">
|
|
||||||
<option name="askShowProject" value="false" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
4
.idea/encodings.xml
Normal file
4
.idea/encodings.xml
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<project version="4">
|
||||||
|
<component name="Encoding" addBOMForNewFiles="with NO BOM" />
|
||||||
|
</project>
|
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
||||||
<component name="GradleSettings">
|
|
||||||
<option name="linkedExternalProjectsSettings">
|
|
||||||
<GradleProjectSettings>
|
|
||||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
||||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
||||||
<option name="modules">
|
|
||||||
<set>
|
|
||||||
<option value="$PROJECT_DIR$" />
|
|
||||||
</set>
|
|
||||||
</option>
|
|
||||||
<option name="useQualifiedModuleNames" value="true" />
|
|
||||||
</GradleProjectSettings>
|
|
||||||
</option>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RemoteRepositoriesConfiguration">
|
|
||||||
<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>
|
|
||||||
<remote-repository>
|
|
||||||
<option name="id" value="MavenRepo" />
|
|
||||||
<option name="name" value="MavenRepo" />
|
|
||||||
<option name="url" value="https://repo.maven.apache.org/maven2/" />
|
|
||||||
</remote-repository>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@ -1,13 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
<component name="ExternalStorageConfigurationManager" enabled="true" />
|
||||||
<component name="FrameworkDetectionExcludesConfiguration">
|
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||||
<file type="web" url="file://$PROJECT_DIR$" />
|
|
||||||
</component>
|
|
||||||
<component name="JavaScriptSettings">
|
|
||||||
<option name="languageLevel" value="ES6" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
|
||||||
<output url="file://$PROJECT_DIR$/out" />
|
<output url="file://$PROJECT_DIR$/out" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
@ -1,124 +0,0 @@
|
|||||||
<?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>
|
|
@ -1,6 +1,6 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<project version="4">
|
<project version="4">
|
||||||
<component name="VcsDirectoryMappings">
|
<component name="VcsDirectoryMappings">
|
||||||
<mapping directory="" vcs="Git" />
|
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||||
</component>
|
</component>
|
||||||
</project>
|
</project>
|
21
LICENSE
Normal file
21
LICENSE
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
MIT License
|
||||||
|
|
||||||
|
Copyright (c) 2020 Mathieu B.
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in all
|
||||||
|
copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
||||||
|
SOFTWARE.
|
9
README.md
Normal file
9
README.md
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
![logo](https://i.imgur.com/tms6CqT.png)
|
||||||
|
|
||||||
|
# Flan's Mod Updater
|
||||||
|
Ce programme met lui-même à jour vos packs Flan's Mod de 1.7.10/1.8/etc. à 1.12.2.
|
||||||
|
*This program update himself your flan's mod packs from 1.7.10/1.8/etc. to 1.12.2.*
|
||||||
|
|
||||||
|
## Documentation
|
||||||
|
- **Français** : https://m4th1eu.github.io/Flan-s-Mod-Updater/
|
||||||
|
- **English** : *comming soon*
|
1
_config.yml
Normal file
1
_config.yml
Normal file
@ -0,0 +1 @@
|
|||||||
|
theme: jekyll-theme-cayman
|
34
build.gradle
34
build.gradle
@ -1,33 +1,41 @@
|
|||||||
plugins {
|
plugins {
|
||||||
id 'java'
|
id 'java'
|
||||||
id "com.github.johnrengelman.shadow" version "5.2.0"
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
apply plugin: 'java'
|
||||||
|
apply plugin: 'eclipse'
|
||||||
|
apply plugin: 'application'
|
||||||
|
|
||||||
group 'org.example'
|
group 'flansupdater'
|
||||||
version '1.0-SNAPSHOT'
|
version '1.0-SNAPSHOT'
|
||||||
|
|
||||||
|
sourceCompatibility = 1.8
|
||||||
|
targetCompatibility = 1.8
|
||||||
|
mainClassName = 'ch.m4th1eu.flansupdater.Main'
|
||||||
|
compileJava.options.encoding = 'UTF-8'
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
}
|
}
|
||||||
|
|
||||||
compileJava {
|
|
||||||
sourceCompatibility = targetCompatibility = '1.8'
|
|
||||||
compileJava.options.encoding = 'UTF-8'
|
|
||||||
}
|
|
||||||
|
|
||||||
dependencies {
|
dependencies {
|
||||||
compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.13.2'
|
compile group: 'commons-io', name: 'commons-io', version: '2.4'
|
||||||
compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.13.2'
|
compile group: 'com.google.code.gson', name: 'gson', version: '2.8.6'
|
||||||
compile group: 'commons-io', name: 'commons-io', version: '2.6'
|
compile group: 'net.lingala.zip4j', name: 'zip4j', version: '2.2.8'
|
||||||
implementation 'com.google.code.gson:gson:2.8.6'
|
testCompile "junit:junit:4.12"
|
||||||
implementation 'org.zeroturnaround:zt-zip:1.14'
|
|
||||||
}
|
}
|
||||||
|
|
||||||
jar {
|
jar {
|
||||||
|
baseName = 'flans-updater'
|
||||||
|
version = '0.1'
|
||||||
|
|
||||||
|
from {
|
||||||
|
configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
|
||||||
|
}
|
||||||
|
|
||||||
manifest {
|
manifest {
|
||||||
attributes(
|
attributes(
|
||||||
"Class-Path": configurations.compile.collect { it.getName() }.join(' '))
|
'Main-Class': 'ch.m4th1eu.flansupdater.Main'
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,4 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
Class-Path: log4j-core-2.13.2.jar log4j-api-2.13.2.jar commons-io-2.6.
|
|
||||||
jar
|
|
||||||
Main-Class: ch.m4th1eu.flansupdater.Main
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 69 KiB |
@ -1,43 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
|
||||||
<?import javafx.scene.image.Image?>
|
|
||||||
<?import javafx.scene.image.ImageView?>
|
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
|
||||||
<?import javafx.scene.text.Font?>
|
|
||||||
<AnchorPane style="-fx-background-color: #303030;" xmlns="http://javafx.com/javafx/8.0.171"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.m4th1eu.flansupdater.FrameController">
|
|
||||||
<Label layoutX="414.0" layoutY="357.0" text="Flans Updater V2 - Développé par M4TH1EU_" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font size="11.0" fx:id="x3"/>
|
|
||||||
</font>
|
|
||||||
</Label>
|
|
||||||
<Button fx:id="bug" layoutX="182.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
|
||||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Signaler un bug"
|
|
||||||
textFill="WHITE"/>
|
|
||||||
|
|
||||||
<Button fx:id="idea" layoutX="333.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
|
||||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Une idée ?" textFill="WHITE"/>
|
|
||||||
|
|
||||||
<Separator layoutY="347.0" prefHeight="16.0" prefWidth="640.0"/>
|
|
||||||
|
|
||||||
<Button fx:id="convertir" layoutX="197.0" layoutY="200.0" mnemonicParsing="false" prefHeight="48.0"
|
|
||||||
prefWidth="252.0" style="-fx-background-color: transparent; -fx-border-color: white; -fx-border-width: 2;"
|
|
||||||
text="Mettre à jour mon pack" textFill="WHITE">
|
|
||||||
<font>
|
|
||||||
<Font size="20.0"/>
|
|
||||||
</font>
|
|
||||||
</Button>
|
|
||||||
<Button fx:id="selectpack" layoutX="347.0" layoutY="147.0" mnemonicParsing="false" prefHeight="21.0"
|
|
||||||
prefWidth="101.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Choisir un pack"
|
|
||||||
textFill="WHITE"/>
|
|
||||||
<TextField fx:id="packname" layoutX="196.0" layoutY="147.0" prefHeight="27.0" prefWidth="149.0"
|
|
||||||
style="-fx-background-color: transparent; -fx-border-color: white; -fx-text-fill: white"/>
|
|
||||||
<Label layoutX="197.0" layoutY="127.0" text="Nom du pack" textFill="WHITE"/>
|
|
||||||
<ImageView fitHeight="118.0" fitWidth="583.0" layoutX="84.0" layoutY="-4.0" pickOnBounds="true"
|
|
||||||
preserveRatio="true">
|
|
||||||
<image>
|
|
||||||
<Image url="@logo_transparent.png"/>
|
|
||||||
</image>
|
|
||||||
</ImageView>
|
|
||||||
</AnchorPane>
|
|
@ -1,76 +0,0 @@
|
|||||||
{
|
|
||||||
"parent": "builtin/generated",
|
|
||||||
"textures": {
|
|
||||||
"layer0": "flansmod:items/your_item_texture"
|
|
||||||
},
|
|
||||||
"display": {
|
|
||||||
"thirdperson_lefthand": {
|
|
||||||
"rotation": [
|
|
||||||
0,
|
|
||||||
90,
|
|
||||||
-35
|
|
||||||
],
|
|
||||||
"translation": [
|
|
||||||
0,
|
|
||||||
1.25,
|
|
||||||
-2.5
|
|
||||||
],
|
|
||||||
"scale": [
|
|
||||||
0.80,
|
|
||||||
0.80,
|
|
||||||
0.80
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"thirdperson_righthand": {
|
|
||||||
"rotation": [
|
|
||||||
0,
|
|
||||||
90,
|
|
||||||
-35
|
|
||||||
],
|
|
||||||
"translation": [
|
|
||||||
0,
|
|
||||||
1.25,
|
|
||||||
-2.5
|
|
||||||
],
|
|
||||||
"scale": [
|
|
||||||
0.80,
|
|
||||||
0.80,
|
|
||||||
0.80
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"firstperson_lefthand": {
|
|
||||||
"rotation": [
|
|
||||||
0,
|
|
||||||
-45,
|
|
||||||
25
|
|
||||||
],
|
|
||||||
"translation": [
|
|
||||||
0,
|
|
||||||
4,
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"scale": [
|
|
||||||
0.80,
|
|
||||||
0.80,
|
|
||||||
0.80
|
|
||||||
]
|
|
||||||
},
|
|
||||||
"firstperson_righthand": {
|
|
||||||
"rotation": [
|
|
||||||
0,
|
|
||||||
-45,
|
|
||||||
25
|
|
||||||
],
|
|
||||||
"translation": [
|
|
||||||
0,
|
|
||||||
4,
|
|
||||||
2
|
|
||||||
],
|
|
||||||
"scale": [
|
|
||||||
0.80,
|
|
||||||
0.80,
|
|
||||||
0.80
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -2,10 +2,8 @@
|
|||||||
Pour utiliser le programme il faut aller télécharger le .jar ou le .exe sur [la page des releases](https://github.com/M4TH1EU/Flan-s-Mod-Updater/releases).
|
Pour utiliser le programme il faut aller télécharger le .jar ou le .exe sur [la page des releases](https://github.com/M4TH1EU/Flan-s-Mod-Updater/releases).
|
||||||
Une fois téléchargé, ouvrez le programme, vous allez voir une fenêtre semblable s'ouvir.
|
Une fois téléchargé, ouvrez le programme, vous allez voir une fenêtre semblable s'ouvir.
|
||||||
|
|
||||||
![App](https://i.imgur.com/pqFvBVu.png)
|
![App](https://i.imgur.com/liEhjJu.png)
|
||||||
|
|
||||||
Pour mettre à jour votre pack il suffit de cliquer sur le bouton "Choisir un pack", l'explorateur de fichier va s'ouvir et vous pourrez séléctionner votre pack **en format .zip, .rar ou .jar !**
|
Pour mettre à jour votre pack il suffit de cliquer sur le bouton "Choisir un pack", l'explorateur de fichier va s'ouvir et vous pourrez séléctionner votre pack **en format .zip !** *(si votre pack est en .jar, .rar ou autre renommez le tout simplement avec le .zip)*
|
||||||
|
|
||||||
Séléctionner votre pack et cliquer sur "Ouvrir", la fenêtre se fermera et vous n'aurez plus qu'a cliquer sur "Mettre à jour mon pack".
|
Séléctionner votre pack et cliquer sur "Ouvrir", la fenêtre se fermera et vous n'aurez plus qu'a cliquer sur "Mettre à jour mon pack".
|
||||||
|
|
||||||
Dès que la mise à jour sera terminée, un pop-up va s'afficher et vous pourrez allez chercher votre pack.
|
|
||||||
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,6 @@
|
|||||||
#Fri May 01 18:13:48 CEST 2020
|
#Tue Dec 31 11:42:11 CET 2019
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-all.zip
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStorePath=wrapper/dists
|
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
|
zipStorePath=wrapper/dists
|
||||||
|
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10-all.zip
|
||||||
|
51
gradlew
vendored
51
gradlew
vendored
@ -1,21 +1,5 @@
|
|||||||
#!/usr/bin/env sh
|
#!/usr/bin/env sh
|
||||||
|
|
||||||
#
|
|
||||||
# Copyright 2015 the original author or authors.
|
|
||||||
#
|
|
||||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
# you may not use this file except in compliance with the License.
|
|
||||||
# You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# https://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
#
|
|
||||||
|
|
||||||
##############################################################################
|
##############################################################################
|
||||||
##
|
##
|
||||||
## Gradle start up script for UN*X
|
## Gradle start up script for UN*X
|
||||||
@ -44,7 +28,7 @@ APP_NAME="Gradle"
|
|||||||
APP_BASE_NAME=`basename "$0"`
|
APP_BASE_NAME=`basename "$0"`
|
||||||
|
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
DEFAULT_JVM_OPTS=""
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD="maximum"
|
MAX_FD="maximum"
|
||||||
@ -125,8 +109,8 @@ if $darwin; then
|
|||||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
# For Cygwin, switch paths to Windows format before running java
|
||||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
if $cygwin ; then
|
||||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||||
@ -154,19 +138,19 @@ if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
|||||||
else
|
else
|
||||||
eval `echo args$i`="\"$arg\""
|
eval `echo args$i`="\"$arg\""
|
||||||
fi
|
fi
|
||||||
i=`expr $i + 1`
|
i=$((i+1))
|
||||||
done
|
done
|
||||||
case $i in
|
case $i in
|
||||||
0) set -- ;;
|
(0) set -- ;;
|
||||||
1) set -- "$args0" ;;
|
(1) set -- "$args0" ;;
|
||||||
2) set -- "$args0" "$args1" ;;
|
(2) set -- "$args0" "$args1" ;;
|
||||||
3) set -- "$args0" "$args1" "$args2" ;;
|
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||||
esac
|
esac
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -175,9 +159,14 @@ save () {
|
|||||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||||
echo " "
|
echo " "
|
||||||
}
|
}
|
||||||
APP_ARGS=`save "$@"`
|
APP_ARGS=$(save "$@")
|
||||||
|
|
||||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||||
|
|
||||||
|
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||||
|
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||||
|
cd "$(dirname "$0")"
|
||||||
|
fi
|
||||||
|
|
||||||
exec "$JAVACMD" "$@"
|
exec "$JAVACMD" "$@"
|
||||||
|
18
gradlew.bat
vendored
18
gradlew.bat
vendored
@ -1,19 +1,3 @@
|
|||||||
@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
|
@if "%DEBUG%" == "" @echo off
|
||||||
@rem ##########################################################################
|
@rem ##########################################################################
|
||||||
@rem
|
@rem
|
||||||
@ -30,7 +14,7 @@ set APP_BASE_NAME=%~n0
|
|||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
@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"
|
set DEFAULT_JVM_OPTS=
|
||||||
|
|
||||||
@rem Find java.exe
|
@rem Find java.exe
|
||||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
rootProject.name = 'FlansUpdater'
|
rootProject.name = 'ch.m4th1eu'
|
||||||
|
|
||||||
|
@ -1,101 +0,0 @@
|
|||||||
package ch.m4th1eu.flansupdater;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import static ch.m4th1eu.flansupdater.FileUtils.*;
|
|
||||||
|
|
||||||
public class ArmorUtils {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the new armor's file from the old one.
|
|
||||||
*
|
|
||||||
* @param path old armor's file path
|
|
||||||
*/
|
|
||||||
public static void createNewArmorFile(Path path) {
|
|
||||||
//new armor file based on the newpack path and the current filename.
|
|
||||||
String NEWFILENAME = Main.ARMOR_NEWPATH + path.getFileName().toString().toLowerCase().replaceAll(" ", "");
|
|
||||||
|
|
||||||
//check if the newpack folder exists, if not we create it.
|
|
||||||
File armorsFolder = new File(Main.ARMOR_NEWPATH);
|
|
||||||
if (!armorsFolder.exists()) {
|
|
||||||
boolean isCreated = armorsFolder.mkdirs();
|
|
||||||
if (isCreated) {
|
|
||||||
Logger.info("Successfully created new armors folder.");
|
|
||||||
} else {
|
|
||||||
Logger.error("Cannot create new armors folder!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(NEWFILENAME), StandardCharsets.UTF_8);
|
|
||||||
myWriter.write(processArmorFile(readFile(path.toFile())));
|
|
||||||
myWriter.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("An error occurred when creating armor's file : " + path.getFileName().toString().toLowerCase().replaceAll(" ", ""));
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace arguments to lowercase, replace space, etc...
|
|
||||||
*
|
|
||||||
* @param string the file content
|
|
||||||
*/
|
|
||||||
public static String processArmorFile(String string) {
|
|
||||||
//ShortName
|
|
||||||
String shortName = get("ShortName", string).toLowerCase().replaceAll(" ", "_");
|
|
||||||
string = set("ShortName", shortName, string);
|
|
||||||
|
|
||||||
//Texture
|
|
||||||
String texture = get("ArmourTexture", string).toLowerCase().replaceAll(" ", "_");
|
|
||||||
string = set("ArmourTexture", texture, string);
|
|
||||||
|
|
||||||
//Icon
|
|
||||||
String icon = get("Icon", string).toLowerCase().replaceAll(" ", "_");
|
|
||||||
string = set("Icon", icon, string);
|
|
||||||
|
|
||||||
//Add to lang array.
|
|
||||||
addLang(shortName, get("Name", string));
|
|
||||||
|
|
||||||
//Create json model file
|
|
||||||
FileUtils.createModels(shortName, icon);
|
|
||||||
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readAllArmorsFiles() {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Main.ARMOR_PATH))) {
|
|
||||||
paths.filter(Files::isRegularFile).forEach(ArmorUtils::createNewArmorFile);
|
|
||||||
Logger.info("Successfully generated new armors files and filled the lang file.");
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readAllArmorsTextures() {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Main.ARMOR_TEXTURES_PATH))) {
|
|
||||||
paths.filter(Files::isRegularFile).forEach(path -> {
|
|
||||||
Path newPath = Paths.get(Main.ARMOR_TEXTURES_NEWPATH + path.getFileName().toString().toLowerCase().replaceAll(" ", ""));
|
|
||||||
|
|
||||||
try {
|
|
||||||
org.apache.commons.io.FileUtils.copyFile(path.toFile(), newPath.toFile(), false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("Cannot rename/move armors textures file : " + path.getFileName());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Logger.info("Successfully copied and renamed the armors textures files.");
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
130
src/main/java/ch/m4th1eu/flansupdater/Controller.java
Normal file
130
src/main/java/ch/m4th1eu/flansupdater/Controller.java
Normal file
@ -0,0 +1,130 @@
|
|||||||
|
package ch.m4th1eu.flansupdater;
|
||||||
|
|
||||||
|
import javafx.application.Platform;
|
||||||
|
import javafx.fxml.FXML;
|
||||||
|
import javafx.scene.control.Button;
|
||||||
|
import javafx.scene.control.TextField;
|
||||||
|
import javafx.stage.FileChooser;
|
||||||
|
import net.lingala.zip4j.ZipFile;
|
||||||
|
import net.lingala.zip4j.exception.ZipException;
|
||||||
|
|
||||||
|
import java.awt.*;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.net.URI;
|
||||||
|
import java.net.URISyntaxException;
|
||||||
|
|
||||||
|
import static ch.m4th1eu.flansupdater.Main.primaryStage;
|
||||||
|
|
||||||
|
|
||||||
|
public class Controller {
|
||||||
|
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
TextField packname;
|
||||||
|
@FXML
|
||||||
|
Button bug;
|
||||||
|
@FXML
|
||||||
|
Button idea;
|
||||||
|
@FXML
|
||||||
|
Button convertir;
|
||||||
|
@FXML
|
||||||
|
Button selectpack;
|
||||||
|
|
||||||
|
private File selectedFile;
|
||||||
|
|
||||||
|
@FXML
|
||||||
|
private void initialize() {
|
||||||
|
registerHoverableButton(bug);
|
||||||
|
registerHoverableButton(idea);
|
||||||
|
registerHoverableButton(convertir);
|
||||||
|
registerHoverableButton(selectpack);
|
||||||
|
|
||||||
|
registerLinkableButton(bug, "xyz");
|
||||||
|
registerLinkableButton(idea, "xyz");
|
||||||
|
|
||||||
|
packname.setEditable(false);
|
||||||
|
convertir.setDisable(true);
|
||||||
|
|
||||||
|
convertir.setOnAction(event -> {
|
||||||
|
|
||||||
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
selectpack.setDisable(true);
|
||||||
|
convertir.setDisable(true);
|
||||||
|
packname.setDisable(true);
|
||||||
|
|
||||||
|
convertir.setText("Extraction du pack...");
|
||||||
|
});
|
||||||
|
|
||||||
|
new ZipFile(selectedFile).extractAll(selectedFile.getParent() + "\\");
|
||||||
|
} catch (ZipException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
Platform.runLater(() -> convertir.setText("Erreur, extraction échouée !"));
|
||||||
|
}
|
||||||
|
|
||||||
|
java.lang.String[] args = new java.lang.String[]{selectedFile.getParent()};
|
||||||
|
try {
|
||||||
|
Platform.runLater(() -> convertir.setText("Mise à jour..."));
|
||||||
|
Updater.main(args);
|
||||||
|
Platform.runLater(() -> convertir.setText("Terminé !"));
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
Platform.runLater(() -> convertir.setText("Erreur, mise à jour échouée !"));
|
||||||
|
}
|
||||||
|
|
||||||
|
try {
|
||||||
|
Thread.sleep(1000);
|
||||||
|
} catch (InterruptedException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
Platform.runLater(() -> {
|
||||||
|
selectpack.setDisable(false);
|
||||||
|
selectpack.setText("");
|
||||||
|
selectedFile = new File("");
|
||||||
|
convertir.setText("Mettre à jour mon pack");
|
||||||
|
convertir.setDisable(false);
|
||||||
|
packname.setDisable(false);
|
||||||
|
});
|
||||||
|
}).start();
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
|
selectpack.setOnAction(event -> {
|
||||||
|
FileChooser fileChooser = new FileChooser();
|
||||||
|
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("ZIP Files", "*.zip"));
|
||||||
|
selectedFile = fileChooser.showOpenDialog(primaryStage);
|
||||||
|
|
||||||
|
if(selectedFile != null){
|
||||||
|
packname.setText(selectedFile.getName());
|
||||||
|
}
|
||||||
|
convertir.setDisable(false);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerHoverableButton(Button button) {
|
||||||
|
button.setOnMouseEntered(event -> {
|
||||||
|
button.setStyle("-fx-background-color: grey; " +
|
||||||
|
"-fx-border-color: grey;" +
|
||||||
|
"-fx-text-fill: white;");
|
||||||
|
});
|
||||||
|
|
||||||
|
button.setOnMouseExited(event -> {
|
||||||
|
button.setStyle("-fx-background-color: transparent; " +
|
||||||
|
"-fx-border-color: grey;");
|
||||||
|
});
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
public void registerLinkableButton(Button button, String url) {
|
||||||
|
button.setOnAction(event -> {
|
||||||
|
try {
|
||||||
|
Desktop.getDesktop().browse(new URI(url));
|
||||||
|
} catch (IOException | URISyntaxException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
@ -1,284 +0,0 @@
|
|||||||
package ch.m4th1eu.flansupdater;
|
|
||||||
|
|
||||||
|
|
||||||
import com.google.gson.Gson;
|
|
||||||
import com.google.gson.GsonBuilder;
|
|
||||||
import com.google.gson.JsonObject;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Arrays;
|
|
||||||
import java.util.Scanner;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
public class FileUtils {
|
|
||||||
|
|
||||||
public static final ArrayList<String> langs = new ArrayList<>();
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get params from a file's path.
|
|
||||||
*
|
|
||||||
* @param argument argument's name
|
|
||||||
* @param url file's path
|
|
||||||
* @return argument's value
|
|
||||||
*/
|
|
||||||
public static String get(String argument, Path url) {
|
|
||||||
BufferedReader reader;
|
|
||||||
try {
|
|
||||||
reader = new BufferedReader(new FileReader(url.toString()));
|
|
||||||
String line = reader.readLine();
|
|
||||||
while (line != null) {
|
|
||||||
if (line.startsWith(argument)) {
|
|
||||||
return line.replaceFirst(argument + " ", "");
|
|
||||||
}
|
|
||||||
|
|
||||||
// read next line
|
|
||||||
line = reader.readLine();
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "null";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Get params from a file's content
|
|
||||||
*
|
|
||||||
* @param argument argument's name
|
|
||||||
* @param content file's content
|
|
||||||
* @return argument's value
|
|
||||||
*/
|
|
||||||
public static String get(String argument, String content) {
|
|
||||||
String str;
|
|
||||||
BufferedReader reader = new BufferedReader(new StringReader(content));
|
|
||||||
try {
|
|
||||||
while ((str = reader.readLine()) != null) {
|
|
||||||
if (argument.equals("Name")) {
|
|
||||||
if (str.contains("Name") && !str.contains("ShortName")) {
|
|
||||||
return str.replaceFirst(argument + " ", "");
|
|
||||||
}
|
|
||||||
} else if (str.startsWith(argument)) {
|
|
||||||
return str.replaceFirst(argument + " ", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
//doesn't work neither
|
|
||||||
/*List<String> lines = new ArrayList<>();
|
|
||||||
try {
|
|
||||||
lines = IOUtils.readLines(new StringReader(content));
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return lines.stream().filter(s -> s.startsWith(argument)).findFirst().map(s -> s.replaceFirst(argument + " ", "")).orElse("null");*/
|
|
||||||
|
|
||||||
|
|
||||||
//disabled because I think it skip the firstline
|
|
||||||
/*Scanner scanner = new Scanner(content);
|
|
||||||
while (scanner.hasNextLine()) {
|
|
||||||
String line = scanner.nextLine();
|
|
||||||
|
|
||||||
if (line.startsWith(argument)) {
|
|
||||||
return line.replaceFirst(argument + " ", "");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
scanner.close();*/
|
|
||||||
|
|
||||||
return "not found";
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set params in a file's content
|
|
||||||
*
|
|
||||||
* @param argument argument's name
|
|
||||||
* @param content file's content
|
|
||||||
* @return argument's value
|
|
||||||
*/
|
|
||||||
public static String set(String argument, String value, String content) {
|
|
||||||
Scanner scanner = new Scanner(content);
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
|
|
||||||
while (scanner.hasNextLine()) {
|
|
||||||
String line = scanner.nextLine();
|
|
||||||
|
|
||||||
if (line.startsWith(argument)) {
|
|
||||||
line = argument + " " + value;
|
|
||||||
}
|
|
||||||
|
|
||||||
stringBuilder.append(line).append("\n");
|
|
||||||
}
|
|
||||||
scanner.close();
|
|
||||||
|
|
||||||
return stringBuilder.toString();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Read a file and convert it to string.
|
|
||||||
*
|
|
||||||
* @param file file to read
|
|
||||||
* @return file's content
|
|
||||||
*/
|
|
||||||
public static String readFile(File file) {
|
|
||||||
if (!file.exists()) {
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
StringBuilder fileData = new StringBuilder();
|
|
||||||
BufferedReader reader = new BufferedReader(
|
|
||||||
new InputStreamReader(new FileInputStream(file.toString()), StandardCharsets.UTF_8));
|
|
||||||
char[] buf = new char[1024];
|
|
||||||
int numRead;
|
|
||||||
while ((numRead = reader.read(buf)) != -1) {
|
|
||||||
String readData = String.valueOf(buf, 0, numRead);
|
|
||||||
fileData.append(readData);
|
|
||||||
}
|
|
||||||
reader.close();
|
|
||||||
return fileData.toString();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
return "";
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void addLang(String shortName, String name) {
|
|
||||||
langs.add("item." + shortName + ".name=" + name);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writeLangs(ArrayList<String> langs) {
|
|
||||||
try {
|
|
||||||
//check if the newpack folder exists, if not we create it.
|
|
||||||
File langsFolder = new File(Main.LANG_NEWPATH);
|
|
||||||
if (!langsFolder.exists()) {
|
|
||||||
boolean isCreated = langsFolder.mkdirs();
|
|
||||||
if (isCreated) {
|
|
||||||
Logger.info("Successfully created new langs folder.");
|
|
||||||
} else {
|
|
||||||
Logger.error("Cannot create new langs folder!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
StringBuilder stringBuilder = new StringBuilder();
|
|
||||||
langs.forEach(str -> stringBuilder.append(str).append("\n"));
|
|
||||||
|
|
||||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(Main.LANG_NEWPATH + "en_US.lang"), StandardCharsets.UTF_8);
|
|
||||||
myWriter.write(stringBuilder.toString());
|
|
||||||
myWriter.close();
|
|
||||||
Logger.info("Successfully generated the new lang file.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readAllIcons() {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Main.ICONS_PATH))) {
|
|
||||||
paths.filter(Files::isRegularFile).forEach(path -> {
|
|
||||||
Path newPath = Paths.get(Main.ICONS_NEWPATH + path.getFileName().toString().toLowerCase().replaceAll(" ", ""));
|
|
||||||
|
|
||||||
try {
|
|
||||||
org.apache.commons.io.FileUtils.copyFile(path.toFile(), newPath.toFile(), false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("Cannot rename/move icons file : " + path.getFileName());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Logger.info("Successfully copied and renamed the icons files.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createModels(String shortName, String icon) {
|
|
||||||
//check if the models folder exists, if not we create it.
|
|
||||||
File modelsFolder = new File(Main.JSON_NEWPATH);
|
|
||||||
if (!modelsFolder.exists()) {
|
|
||||||
boolean isCreated = modelsFolder.mkdirs();
|
|
||||||
if (isCreated) {
|
|
||||||
Logger.info("Successfully created jsons folder.");
|
|
||||||
} else {
|
|
||||||
Logger.error("Cannot create -jsons folder!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String jsonString = "{\"parent\":\"builtin/generated\",\"textures\":{\"layer0\":\"flansmod:items/your_item_texture\"},\"display\":{\"thirdperson_lefthand\":{\"rotation\":[0,90,-35],\"translation\":[0,1.25,-2.5],\"scale\":[0.8,0.8,0.8]},\"thirdperson_righthand\":{\"rotation\":[0,90,-35],\"translation\":[0,1.25,-2.5],\"scale\":[0.8,0.8,0.8]},\"firstperson_lefthand\":{\"rotation\":[0,-45,25],\"translation\":[0,4,2],\"scale\":[0.8,0.8,0.8]},\"firstperson_righthand\":{\"rotation\":[0,-45,25],\"translation\":[0,4,2],\"scale\":[0.8,0.8,0.8]}}}";
|
|
||||||
jsonString = jsonString.replaceFirst("your_item_texture", icon);
|
|
||||||
|
|
||||||
if (Paths.get(Main.JSON_PATH + shortName + ".json").toFile().exists()) {
|
|
||||||
jsonString = readFile(new File(Main.JSON_PATH + shortName + ".json"));
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(Main.JSON_NEWPATH + shortName + ".json"), StandardCharsets.UTF_8);
|
|
||||||
myWriter.write(jsonString);
|
|
||||||
myWriter.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("Cannot create the json model file for : " + shortName);
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void copyModels() {
|
|
||||||
try {
|
|
||||||
org.apache.commons.io.FileUtils.copyDirectory(new File(Main.MODELS_PATH), new File(Main.MODELS_NEWPATH));
|
|
||||||
Logger.info("Successfully copied the models directory.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("Cannot copy models directory!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public static void deleteTempsFolder() {
|
|
||||||
recursiveDelete(new File(Main.PACK_PATH));
|
|
||||||
recursiveDelete(new File(Main.NEWPACK_PATH));
|
|
||||||
Logger.info("Sucessfully deleted temporary directories.");
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
private static void recursiveDelete(File file) {
|
|
||||||
//to end the recursive loop
|
|
||||||
if (!file.exists())
|
|
||||||
return;
|
|
||||||
|
|
||||||
//if directory, go inside and call recursively
|
|
||||||
if (file.isDirectory()) {
|
|
||||||
//call recursively
|
|
||||||
Arrays.stream(file.listFiles()).forEach(FileUtils::recursiveDelete);
|
|
||||||
}
|
|
||||||
//call delete to delete files and empty directory
|
|
||||||
file.delete();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void createPackInfo() {
|
|
||||||
JsonObject jsonObject = new JsonObject();
|
|
||||||
JsonObject pack = new JsonObject();
|
|
||||||
pack.addProperty("pack_format", 1);
|
|
||||||
pack.addProperty("description", "Generated by Flans Updater.");
|
|
||||||
jsonObject.add("pack", pack);
|
|
||||||
|
|
||||||
Gson gson = new GsonBuilder().setPrettyPrinting().create();
|
|
||||||
String jsonString = gson.toJson(jsonObject);
|
|
||||||
|
|
||||||
try {
|
|
||||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(Main.NEWPACK_PATH + "pack_info.mcmeta"), StandardCharsets.UTF_8);
|
|
||||||
myWriter.write(jsonString);
|
|
||||||
myWriter.close();
|
|
||||||
Logger.info("Successfully created the pack_info file.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("Cannot create the pack_info file!");
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,141 +0,0 @@
|
|||||||
package ch.m4th1eu.flansupdater;
|
|
||||||
|
|
||||||
import javafx.application.Platform;
|
|
||||||
import javafx.fxml.FXML;
|
|
||||||
import javafx.scene.control.Alert;
|
|
||||||
import javafx.scene.control.Button;
|
|
||||||
import javafx.scene.control.TextField;
|
|
||||||
import javafx.stage.FileChooser;
|
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
|
||||||
|
|
||||||
import java.awt.*;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.net.URI;
|
|
||||||
import java.net.URISyntaxException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
public class FrameController {
|
|
||||||
@FXML
|
|
||||||
TextField packname;
|
|
||||||
@FXML
|
|
||||||
Button bug;
|
|
||||||
@FXML
|
|
||||||
Button idea;
|
|
||||||
@FXML
|
|
||||||
Button convertir;
|
|
||||||
@FXML
|
|
||||||
Button selectpack;
|
|
||||||
|
|
||||||
private File selectedFile;
|
|
||||||
|
|
||||||
@FXML
|
|
||||||
private void initialize() {
|
|
||||||
registerHoverableButton(bug);
|
|
||||||
registerHoverableButton(idea);
|
|
||||||
registerHoverableButton(convertir);
|
|
||||||
registerHoverableButton(selectpack);
|
|
||||||
|
|
||||||
registerLinkableButton(bug, "https://github.com/M4TH1EU/Flan-s-Mod-Updater/issues/new?assignees=&labels=&template=bug_report.md&title=");
|
|
||||||
registerLinkableButton(idea, "https://github.com/M4TH1EU/Flan-s-Mod-Updater/issues/new?assignees=&labels=&template=feature_request.md&title=");
|
|
||||||
|
|
||||||
packname.setEditable(false);
|
|
||||||
convertir.setDisable(true);
|
|
||||||
|
|
||||||
convertir.setOnAction(event -> new Thread(() -> {
|
|
||||||
try {
|
|
||||||
Main.PACK_PATH = Files.createTempDirectory("flans-pack-old" + UUID.randomUUID()).toString() + "\\";
|
|
||||||
Main.NEWPACK_PATH = Files.createTempDirectory("flans-pack-updated" + UUID.randomUUID()).toString() + "\\";
|
|
||||||
Logger.info("Successfully set the new path to temps directories.");
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
selectpack.setDisable(true);
|
|
||||||
convertir.setDisable(true);
|
|
||||||
packname.setDisable(true);
|
|
||||||
|
|
||||||
convertir.setText("Extraction du pack...");
|
|
||||||
ZipUtil.unpack(new File(Main.PACK_ZIP), new File(Main.PACK_PATH));
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(2000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Platform.runLater(() -> convertir.setText("Mise à jour..."));
|
|
||||||
Main.convert();
|
|
||||||
Platform.runLater(() -> convertir.setText("Terminé !"));
|
|
||||||
} catch (Exception e) {
|
|
||||||
Platform.runLater(() -> convertir.setText("Erreur, mise à jour échouée !"));
|
|
||||||
}
|
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
Alert alert = new Alert(Alert.AlertType.INFORMATION);
|
|
||||||
alert.setTitle("Information");
|
|
||||||
alert.setHeaderText("Mise à jour terminée.");
|
|
||||||
alert.setContentText("La mise à jour du pack " + packname.getText() + " est terminée !" + "\nChemin : " + selectedFile.getParent());
|
|
||||||
|
|
||||||
alert.showAndWait();
|
|
||||||
});
|
|
||||||
|
|
||||||
try {
|
|
||||||
Thread.sleep(1000);
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
|
|
||||||
FileUtils.deleteTempsFolder();
|
|
||||||
|
|
||||||
Platform.runLater(() -> {
|
|
||||||
packname.setText("");
|
|
||||||
selectedFile = new File("");
|
|
||||||
convertir.setText("Mettre à jour mon pack");
|
|
||||||
convertir.setDisable(false);
|
|
||||||
packname.setDisable(false);
|
|
||||||
selectpack.setDisable(false);
|
|
||||||
});
|
|
||||||
}).start());
|
|
||||||
|
|
||||||
selectpack.setOnAction(event -> {
|
|
||||||
FileChooser fileChooser = new FileChooser();
|
|
||||||
fileChooser.getExtensionFilters().addAll(new FileChooser.ExtensionFilter("Flans Pack", "*.zip", "*.jar", "*.rar"));
|
|
||||||
selectedFile = fileChooser.showOpenDialog(Main.PRIMARY_STAGE);
|
|
||||||
|
|
||||||
if (selectedFile != null) {
|
|
||||||
packname.setText(selectedFile.getName());
|
|
||||||
Main.PACK_ZIP = selectedFile.getAbsolutePath();
|
|
||||||
}
|
|
||||||
convertir.setDisable(false);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerHoverableButton(javafx.scene.control.Button button) {
|
|
||||||
button.setOnMouseEntered(event -> {
|
|
||||||
button.setStyle("-fx-background-color: grey; " +
|
|
||||||
"-fx-border-color: grey;" +
|
|
||||||
"-fx-text-fill: white;");
|
|
||||||
});
|
|
||||||
|
|
||||||
button.setOnMouseExited(event -> {
|
|
||||||
button.setStyle("-fx-background-color: transparent; " +
|
|
||||||
"-fx-border-color: grey;");
|
|
||||||
});
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerLinkableButton(javafx.scene.control.Button button, String url) {
|
|
||||||
button.setOnAction(event -> {
|
|
||||||
try {
|
|
||||||
Desktop.getDesktop().browse(new URI(url));
|
|
||||||
} catch (IOException | URISyntaxException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package ch.m4th1eu.flansupdater;
|
|
||||||
|
|
||||||
public class Logger {
|
|
||||||
public static final String ANSI_RESET = "\u001B[0m";
|
|
||||||
public static final String ANSI_RED = "\u001B[31m";
|
|
||||||
public static final String ANSI_GREEN = "\u001B[32m";
|
|
||||||
public static final String ANSI_YELLOW = "\u001B[33m";
|
|
||||||
public static final String RED_BOLD = "\033[1;31m"; // RED
|
|
||||||
|
|
||||||
public static void error(String message) {
|
|
||||||
System.out.println(ANSI_RED + "[ERROR] " + message + ANSI_RESET);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void info(String message) {
|
|
||||||
System.out.println(ANSI_GREEN + "[INFO] " + message + ANSI_RESET);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void warn(String message) {
|
|
||||||
System.out.println(ANSI_YELLOW + "[WARN] " + message + ANSI_RESET);
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void fatal(String message) {
|
|
||||||
System.out.println(RED_BOLD + "[FATAL] " + message + ANSI_RESET);
|
|
||||||
}
|
|
||||||
}
|
|
@ -6,84 +6,27 @@ import javafx.scene.Parent;
|
|||||||
import javafx.scene.Scene;
|
import javafx.scene.Scene;
|
||||||
import javafx.scene.image.Image;
|
import javafx.scene.image.Image;
|
||||||
import javafx.stage.Stage;
|
import javafx.stage.Stage;
|
||||||
import org.zeroturnaround.zip.ZipUtil;
|
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.IOException;
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
public class Main extends Application {
|
public class Main extends Application {
|
||||||
private static final Main INSTANCE = new Main();
|
public static Stage primaryStage = null;
|
||||||
|
|
||||||
public static String PACK_ZIP = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack.zip";
|
public static void main(String[] args) {
|
||||||
public static String PACK_PATH = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack\\";
|
launch(args);
|
||||||
public static String VEHICLES_PATH = PACK_PATH + "vehicles\\";
|
|
||||||
public static String ARMOR_PATH = PACK_PATH + "armorFiles\\";
|
|
||||||
public static String ARMOR_TEXTURES_PATH = PACK_PATH + "assets\\flansmod\\armor\\";
|
|
||||||
public static String VEHICLESSKINS_PATH = PACK_PATH + "assets\\flansmod\\skins\\";
|
|
||||||
public static String MODELS_PATH = PACK_PATH + "com\\";
|
|
||||||
public static String ICONS_PATH = PACK_PATH + "assets\\flansmod\\textures\\items\\";
|
|
||||||
public static String NEWPACK_PATH = "C:\\Users\\Mathieu\\Downloads\\Altis Mine Pack NEW\\";
|
|
||||||
public static String VEHICLES_NEWPATH = NEWPACK_PATH + "vehicles\\";
|
|
||||||
public static String ARMOR_NEWPATH = NEWPACK_PATH + "armorFiles\\";
|
|
||||||
public static String ARMOR_TEXTURES_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\armor\\";
|
|
||||||
public static String VEHICLESSKINS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\skins\\";
|
|
||||||
public static String JSON_PATH = PACK_PATH + "assets\\flansmod\\models\\item\\";
|
|
||||||
public static String JSON_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\models\\item\\";
|
|
||||||
public static String LANG_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\lang\\";
|
|
||||||
public static String MODELS_NEWPATH = NEWPACK_PATH + "com\\";
|
|
||||||
public static String ICONS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\textures\\items\\";
|
|
||||||
public static Stage PRIMARY_STAGE = null;
|
|
||||||
|
|
||||||
public static void convert() {
|
|
||||||
Logger.info("Starting new pack update.");
|
|
||||||
refreshVariables();
|
|
||||||
|
|
||||||
FileUtils.copyModels();
|
|
||||||
VehiclesUtils.readAllVehiclesFiles();
|
|
||||||
VehiclesUtils.readAllVehiclesSkins();
|
|
||||||
ArmorUtils.readAllArmorsFiles();
|
|
||||||
ArmorUtils.readAllArmorsTextures();
|
|
||||||
FileUtils.readAllIcons();
|
|
||||||
FileUtils.createPackInfo();
|
|
||||||
FileUtils.writeLangs(FileUtils.langs);
|
|
||||||
|
|
||||||
ZipUtil.pack(new File(NEWPACK_PATH),
|
|
||||||
new File(Paths.get(PACK_ZIP).getParent() + "\\" + Paths.get(PACK_ZIP).getFileName().toString().replaceAll(".zip", "")
|
|
||||||
.replaceAll(".jar", "")
|
|
||||||
.replaceAll(".rar", "")
|
|
||||||
+ "_UPDATED.jar"));
|
|
||||||
|
|
||||||
Logger.info("Update complete.");
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void refreshVariables() {
|
|
||||||
VEHICLES_PATH = PACK_PATH + "vehicles\\";
|
|
||||||
ARMOR_PATH = PACK_PATH + "armorFiles\\";
|
|
||||||
JSON_PATH = PACK_PATH + "assets\\flansmod\\models\\item\\";
|
|
||||||
ARMOR_TEXTURES_PATH = PACK_PATH + "assets\\flansmod\\armor\\";
|
|
||||||
VEHICLESSKINS_PATH = PACK_PATH + "assets\\flansmod\\skins\\";
|
|
||||||
MODELS_PATH = PACK_PATH + "com\\";
|
|
||||||
ICONS_PATH = PACK_PATH + "assets\\flansmod\\textures\\items\\";
|
|
||||||
VEHICLES_NEWPATH = NEWPACK_PATH + "vehicles\\";
|
|
||||||
ARMOR_NEWPATH = NEWPACK_PATH + "armorFiles\\";
|
|
||||||
ARMOR_TEXTURES_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\armor\\";
|
|
||||||
VEHICLESSKINS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\skins\\";
|
|
||||||
JSON_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\models\\item\\";
|
|
||||||
LANG_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\lang\\";
|
|
||||||
MODELS_NEWPATH = NEWPACK_PATH + "com\\";
|
|
||||||
ICONS_NEWPATH = NEWPACK_PATH + "assets\\flansmod\\textures\\items\\";
|
|
||||||
Logger.info("Refreshed the variables.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void start(Stage primaryStage) throws Exception {
|
public void start(Stage primaryStage) throws IOException {
|
||||||
Parent root = FXMLLoader.load(Main.class.getResource("/menu.fxml"));
|
|
||||||
|
|
||||||
Main.PRIMARY_STAGE = primaryStage;
|
|
||||||
Main.PRIMARY_STAGE.setTitle("Flans Updater");
|
Parent root = FXMLLoader.load(Updater.class.getResource("/menu.fxml"));
|
||||||
Main.PRIMARY_STAGE.setResizable(false);
|
|
||||||
Main.PRIMARY_STAGE.setScene(new Scene(root, 625, 365));
|
Main.primaryStage = primaryStage;
|
||||||
Main.PRIMARY_STAGE.getIcons().add(new Image(this.getClass().getResourceAsStream("/icon.png")));
|
Main.primaryStage.setTitle("Flans Updater");
|
||||||
Main.PRIMARY_STAGE.show();
|
Main.primaryStage.setResizable(false);
|
||||||
|
Main.primaryStage.setScene(new Scene(root, 625, 365));
|
||||||
|
Main.primaryStage.getIcons().add(new Image(this.getClass().getResourceAsStream("/icon.png")));
|
||||||
|
Main.primaryStage.show();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
369
src/main/java/ch/m4th1eu/flansupdater/Updater.java
Normal file
369
src/main/java/ch/m4th1eu/flansupdater/Updater.java
Normal file
@ -0,0 +1,369 @@
|
|||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Mathieu Broillet (M4TH1EU_#0001 (on discord))
|
||||||
|
* @description This program update himself your flan's mod packs from 1.7.10/1.8/etc. to 1.12.2
|
||||||
|
*
|
||||||
|
* @important This program is not meant to be very pretty or well coded.
|
||||||
|
* It just works, that's all we ask.
|
||||||
|
*/
|
||||||
|
|
||||||
|
package ch.m4th1eu.flansupdater;
|
||||||
|
|
||||||
|
import com.google.gson.Gson;
|
||||||
|
import com.google.gson.JsonObject;
|
||||||
|
import org.apache.commons.io.IOUtils;
|
||||||
|
|
||||||
|
import java.io.*;
|
||||||
|
import java.nio.charset.Charset;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
|
import java.nio.file.Paths;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.stream.Stream;
|
||||||
|
|
||||||
|
public class Updater {
|
||||||
|
|
||||||
|
private static String ICON_NAME = "";
|
||||||
|
private static File MODEL_FILE = new File("");
|
||||||
|
|
||||||
|
private static String PATH = null;
|
||||||
|
|
||||||
|
public static void main(String[] args) throws Exception {
|
||||||
|
PATH = args[0];
|
||||||
|
|
||||||
|
ArrayList<Path> files = new ArrayList<>();
|
||||||
|
|
||||||
|
try (Stream<Path> filePathStream = Files.walk(Paths.get(PATH))) {
|
||||||
|
filePathStream.forEach(filePath -> {
|
||||||
|
if (Files.isRegularFile(filePath)) {
|
||||||
|
files.add(filePath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
generateLangs();
|
||||||
|
|
||||||
|
//MCMETA
|
||||||
|
if (!new File(PATH + "\\pack_info.mcmeta").exists()) {
|
||||||
|
PrintWriter printWriter = new PrintWriter(new File(PATH + "\\pack_info.mcmeta"));
|
||||||
|
printWriter.println("{\n" +
|
||||||
|
" \"pack\": {\n" +
|
||||||
|
" \"pack_format\": 1,\n" +
|
||||||
|
" \"description\": \"Generated by M4TH1EU's Flans Updater.\"\n" +
|
||||||
|
" }\n" +
|
||||||
|
"}");
|
||||||
|
printWriter.close();
|
||||||
|
}
|
||||||
|
if (new File(PATH + "\\pack.mcmeta").exists()) {
|
||||||
|
new File(PATH + "\\pack.mcmeta").delete();
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Listen all files and check if they ends by ".txt".
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
|
||||||
|
/* armorFiles / models / lang / icons */
|
||||||
|
if (files.get(i).getParent().toString().endsWith("armorFiles")) {
|
||||||
|
if (files.get(i).getFileName().toString().endsWith(".txt")) {
|
||||||
|
|
||||||
|
//ARMOR FILES / ICONS(replaceNames)
|
||||||
|
renameFileToLowercase(files.get(i).toFile());
|
||||||
|
replaceNames(Paths.get(files.get(i).toString().replaceAll(" ", "_").toLowerCase()));
|
||||||
|
|
||||||
|
//MODELS
|
||||||
|
renameFileToLowercase(MODEL_FILE);
|
||||||
|
|
||||||
|
if (hasModel(files.get(i))) {
|
||||||
|
replaceModelIcon(MODEL_FILE.toPath());
|
||||||
|
} else {
|
||||||
|
createModelFile(MODEL_FILE.toPath());
|
||||||
|
replaceModelIcon(MODEL_FILE.toPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* armors textures */
|
||||||
|
if (files.get(i).getParent().toString().endsWith("armor")) {
|
||||||
|
|
||||||
|
if (files.get(i).getFileName().toString().endsWith(".png")) {
|
||||||
|
renameFileToLowercase(files.get(i).toFile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* vehicles / models / lang / icons */
|
||||||
|
if (files.get(i).getParent().toString().endsWith("vehicles")) {
|
||||||
|
if (files.get(i).getFileName().toString().endsWith(".txt")) {
|
||||||
|
|
||||||
|
//VEHICLES FILES / ICONS(replaceNames)
|
||||||
|
renameFileToLowercase(files.get(i).toFile());
|
||||||
|
replaceNames(Paths.get(files.get(i).toString().replaceAll(" ", "_").toLowerCase()));
|
||||||
|
|
||||||
|
//MODELS
|
||||||
|
renameFileToLowercase(MODEL_FILE);
|
||||||
|
|
||||||
|
if (hasModel(files.get(i))) {
|
||||||
|
replaceModelIcon(MODEL_FILE.toPath());
|
||||||
|
} else {
|
||||||
|
createModelFile(MODEL_FILE.toPath());
|
||||||
|
replaceModelIcon(MODEL_FILE.toPath());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
/* vehicles textures */
|
||||||
|
if (files.get(i).getParent().toString().endsWith("skins")) {
|
||||||
|
if (files.get(i).getFileName().toString().endsWith(".png")) {
|
||||||
|
renameFileToLowercase(files.get(i).toFile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* items icons */
|
||||||
|
if (files.get(i).getParent().toString().endsWith("items")) {
|
||||||
|
if (files.get(i).getFileName().toString().endsWith(".png")) {
|
||||||
|
renameFileToLowercase(files.get(i).toFile());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
System.out.println("UPDATED SUCCESSFULLY");
|
||||||
|
}
|
||||||
|
|
||||||
|
public static boolean hasModel(Path filePath) {
|
||||||
|
return new File(PATH + "\\assets\\flansmod\\models\\item\\" + filePath.getFileName().toString().replaceAll(".txt", ".json")).exists();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the file gave by @filePath and split all lines to find "ShortName" and "ArmourTexture"
|
||||||
|
*
|
||||||
|
* @param filePath
|
||||||
|
*/
|
||||||
|
public static void replaceNames(Path filePath) {
|
||||||
|
try {
|
||||||
|
// Open the file
|
||||||
|
FileInputStream fstream = new FileInputStream(String.valueOf(filePath));
|
||||||
|
// Get the object of DataInputStream
|
||||||
|
DataInputStream in = new DataInputStream(fstream);
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||||
|
String strLine;
|
||||||
|
|
||||||
|
int i = 0;
|
||||||
|
//Read File Line By Line
|
||||||
|
while ((strLine = br.readLine()) != null) {
|
||||||
|
if (strLine.contains("ShortName")) {
|
||||||
|
String[] parts = strLine.split(" ");
|
||||||
|
String oldName = "ShortName " + parts[1];
|
||||||
|
String newName = "ShortName " + parts[1].toLowerCase().replaceAll(" ", "_");
|
||||||
|
MODEL_FILE = new File(filePath.getParent().getParent() + "\\assets\\flansmod\\models\\item\\" + parts[1].toLowerCase().replaceAll(" ", "_") + ".json");
|
||||||
|
modifyFile(String.valueOf(filePath), oldName, newName);
|
||||||
|
}
|
||||||
|
if (strLine.contains("ArmourTexture")) {
|
||||||
|
String[] parts = strLine.split(" ");
|
||||||
|
String oldName = "ArmourTexture " + parts[1];
|
||||||
|
String newName = "ArmourTexture " + parts[1].toLowerCase();
|
||||||
|
modifyFile(String.valueOf(filePath), oldName, newName);
|
||||||
|
}
|
||||||
|
if (strLine.contains("Texture")) {
|
||||||
|
String[] parts = strLine.split(" ");
|
||||||
|
String oldName = "Texture " + parts[1];
|
||||||
|
String newName = "Texture " + parts[1].toLowerCase().replaceAll(" ", "_");
|
||||||
|
modifyFile(String.valueOf(filePath), oldName, newName);
|
||||||
|
}
|
||||||
|
if (strLine.contains("Icon")) {
|
||||||
|
String[] parts = strLine.split(" ");
|
||||||
|
String oldName = "Icon " + parts[1];
|
||||||
|
String newName = "Icon " + parts[1].toLowerCase().replaceAll(" ", "_");
|
||||||
|
ICON_NAME = parts[1].toLowerCase().replaceAll(" ", "_");
|
||||||
|
modifyFile(String.valueOf(filePath), oldName, newName);
|
||||||
|
}
|
||||||
|
i++;
|
||||||
|
}
|
||||||
|
|
||||||
|
//Close the input stream
|
||||||
|
in.close();
|
||||||
|
} catch (Exception e) {//Catch exception if any
|
||||||
|
System.err.println("Error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Read the file gave by @filePath and split all lines to find "ShortName" and "ArmourTexture"
|
||||||
|
*
|
||||||
|
* @param filePath
|
||||||
|
*/
|
||||||
|
public static void replaceModelIcon(Path filePath) {
|
||||||
|
|
||||||
|
Gson gson = new Gson();
|
||||||
|
JsonObject jsonObject = null;
|
||||||
|
try {
|
||||||
|
jsonObject = gson.fromJson(new FileReader(filePath.toFile()), JsonObject.class);
|
||||||
|
} catch (FileNotFoundException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (jsonObject != null) {
|
||||||
|
String oldIcon = jsonObject.getAsJsonObject("textures").get("layer0").getAsString();
|
||||||
|
String newIcon = "flansmod:items/" + ICON_NAME;
|
||||||
|
|
||||||
|
modifyFile(String.valueOf(filePath), oldIcon, newIcon);
|
||||||
|
} else {
|
||||||
|
try {
|
||||||
|
createModelFile(MODEL_FILE.toPath());
|
||||||
|
replaceModelIcon(filePath);
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace an old string by a new one in a file
|
||||||
|
*
|
||||||
|
* @param filePath
|
||||||
|
* @param oldString
|
||||||
|
* @param newString
|
||||||
|
*/
|
||||||
|
static void modifyFile(String filePath, String oldString, String newString) {
|
||||||
|
File fileToBeModified = new File(filePath);
|
||||||
|
String oldContent = "";
|
||||||
|
BufferedReader reader = null;
|
||||||
|
FileWriter writer = null;
|
||||||
|
try {
|
||||||
|
reader = new BufferedReader(new FileReader(fileToBeModified));
|
||||||
|
String line = reader.readLine();
|
||||||
|
while (line != null) {
|
||||||
|
oldContent = oldContent + line + System.lineSeparator();
|
||||||
|
line = reader.readLine();
|
||||||
|
}
|
||||||
|
String newContent = oldContent.replaceAll(oldString, newString);
|
||||||
|
writer = new FileWriter(fileToBeModified);
|
||||||
|
writer.write(newContent);
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
try {
|
||||||
|
reader.close();
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Replace all uppercase to lowercase.
|
||||||
|
*
|
||||||
|
* @param file
|
||||||
|
*/
|
||||||
|
private static void renameFileToLowercase(File file) {
|
||||||
|
boolean rename = file.renameTo(new File(file.getPath().replaceAll(file.getName(), "") + file.getName().replaceAll(" ", "_").toLowerCase()));
|
||||||
|
if (!rename) {
|
||||||
|
for (int i = 0; i < 3; i++) {
|
||||||
|
file.renameTo(new File(file.getPath().replaceAll(file.getName(), "") + file.getName().replaceAll(" ", "_").toLowerCase()));
|
||||||
|
System.gc();
|
||||||
|
Thread.yield();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get the model.json tempalte and create new file with.
|
||||||
|
*
|
||||||
|
* @param filePath
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
private static void createModelFile(Path filePath) throws Exception {
|
||||||
|
|
||||||
|
InputStream in = Updater.class.getResourceAsStream("/model.json");
|
||||||
|
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
IOUtils.copy(in, writer, Charset.forName("utf-8"));
|
||||||
|
String theString = writer.toString();
|
||||||
|
|
||||||
|
filePath.getParent().toFile().mkdirs();
|
||||||
|
PrintWriter printWriter = new PrintWriter(filePath.toFile());
|
||||||
|
printWriter.println(theString);
|
||||||
|
printWriter.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static void createLangFile(Path filePath) throws Exception {
|
||||||
|
PrintWriter printWriter = new PrintWriter(filePath.toFile());
|
||||||
|
printWriter.println(" ");
|
||||||
|
printWriter.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lists all files and get their name & shortname to fill the lang file.
|
||||||
|
*
|
||||||
|
* @throws Exception
|
||||||
|
*/
|
||||||
|
public static void generateLangs() throws Exception {
|
||||||
|
File LANG_FILE = new File(PATH + "\\assets\\flansmod\\lang\\en_US.lang");
|
||||||
|
|
||||||
|
PrintWriter printWriter = new PrintWriter(LANG_FILE);
|
||||||
|
printWriter.println("");
|
||||||
|
printWriter.close();
|
||||||
|
|
||||||
|
ArrayList<Path> files = new ArrayList<>();
|
||||||
|
try (Stream<Path> filePathStream = Files.walk(Paths.get(PATH))) {
|
||||||
|
filePathStream.forEach(filePath -> {
|
||||||
|
if (Files.isRegularFile(filePath)) {
|
||||||
|
files.add(filePath);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
Listen all files and check if they ends by ".txt".
|
||||||
|
*/
|
||||||
|
for (int i = 0; i < files.size(); i++) {
|
||||||
|
if (!LANG_FILE.exists()) {
|
||||||
|
new File(LANG_FILE.getParent()).mkdirs();
|
||||||
|
LANG_FILE.createNewFile();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (files.get(i).getParent().toString().endsWith("armorFiles")) {
|
||||||
|
if (files.get(i).getFileName().toString().endsWith(".txt")) {
|
||||||
|
try {
|
||||||
|
// Open the file
|
||||||
|
FileInputStream fstream = new FileInputStream(String.valueOf(files.get(i)));
|
||||||
|
// Get the object of DataInputStream
|
||||||
|
DataInputStream in = new DataInputStream(fstream);
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(in));
|
||||||
|
String strLine;
|
||||||
|
|
||||||
|
|
||||||
|
String id = "";
|
||||||
|
String name = "";
|
||||||
|
//Read File Line By Line
|
||||||
|
while ((strLine = br.readLine()) != null) {
|
||||||
|
if (strLine.startsWith("ShortName")) {
|
||||||
|
String[] parts = strLine.split(" ");
|
||||||
|
id = parts[1].toLowerCase();
|
||||||
|
}
|
||||||
|
if (strLine.startsWith("Name")) {
|
||||||
|
name = strLine.replaceAll("Name", "").replaceFirst(" ", "");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
InputStream inputStream = new FileInputStream(LANG_FILE);
|
||||||
|
|
||||||
|
StringWriter writer = new StringWriter();
|
||||||
|
IOUtils.copy(inputStream, writer, Charset.forName("utf-8"));
|
||||||
|
String theString = writer.toString();
|
||||||
|
theString = theString + "item." + id + ".name=" + name;
|
||||||
|
|
||||||
|
PrintWriter writer1 = new PrintWriter(LANG_FILE);
|
||||||
|
writer1.println(theString);
|
||||||
|
writer1.close();
|
||||||
|
|
||||||
|
|
||||||
|
//Close the input stream
|
||||||
|
inputStream.close();
|
||||||
|
} catch (Exception e) {//Catch exception if any
|
||||||
|
System.err.println("Error: " + e.getMessage());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -1,100 +0,0 @@
|
|||||||
package ch.m4th1eu.flansupdater;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.nio.charset.StandardCharsets;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
import java.util.stream.Stream;
|
|
||||||
|
|
||||||
import static ch.m4th1eu.flansupdater.FileUtils.*;
|
|
||||||
|
|
||||||
public class VehiclesUtils {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Create the new vehicle's file from the old one.
|
|
||||||
*
|
|
||||||
* @param path old vehicle's file path
|
|
||||||
*/
|
|
||||||
public static void createNewVehicleFile(Path path) {
|
|
||||||
//new vehicle file based on the newpack path and the current filename.
|
|
||||||
String NEWFILENAME = Main.VEHICLES_NEWPATH + path.getFileName().toString().toLowerCase().replaceAll(" ", "");
|
|
||||||
|
|
||||||
//check if the newpack folder exists, if not we create it.
|
|
||||||
File vehiclesFolder = new File(Main.VEHICLES_NEWPATH);
|
|
||||||
if (!vehiclesFolder.exists()) {
|
|
||||||
boolean isCreated = vehiclesFolder.mkdirs();
|
|
||||||
if (isCreated) {
|
|
||||||
Logger.info("Successfully created new vehicles folder.");
|
|
||||||
} else {
|
|
||||||
Logger.error("Cannot create new vehicles folder!");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
Writer myWriter = new OutputStreamWriter(new FileOutputStream(NEWFILENAME), StandardCharsets.UTF_8);
|
|
||||||
myWriter.write(processVehicleFile(readFile(path.toFile())));
|
|
||||||
myWriter.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("An error occurred when creating vehicle's file : " + path.getFileName().toString().toLowerCase().replaceAll(" ", ""));
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Replace arguments to lowercase, replace space, etc...
|
|
||||||
*
|
|
||||||
* @param string the file content
|
|
||||||
*/
|
|
||||||
public static String processVehicleFile(String string) {
|
|
||||||
//ShortName
|
|
||||||
String shortName = get("ShortName", string).toLowerCase().replaceAll(" ", "_");
|
|
||||||
string = set("ShortName", shortName, string);
|
|
||||||
|
|
||||||
//Texture
|
|
||||||
String texture = get("Texture", string).toLowerCase().replaceAll(" ", "_");
|
|
||||||
string = set("Texture", texture, string);
|
|
||||||
|
|
||||||
//Icon
|
|
||||||
String icon = get("Icon", string).toLowerCase().replaceAll(" ", "_");
|
|
||||||
string = set("Icon", icon, string);
|
|
||||||
|
|
||||||
//Add to lang array.
|
|
||||||
addLang(shortName, get("Name", string));
|
|
||||||
|
|
||||||
//Create json model file
|
|
||||||
FileUtils.createModels(shortName, icon);
|
|
||||||
|
|
||||||
return string;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readAllVehiclesFiles() {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Main.VEHICLES_PATH))) {
|
|
||||||
paths.filter(Files::isRegularFile).forEach(VehiclesUtils::createNewVehicleFile);
|
|
||||||
Logger.info("Successfully generated new vehicles files and filled the new lang file.");
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void readAllVehiclesSkins() {
|
|
||||||
try (Stream<Path> paths = Files.walk(Paths.get(Main.VEHICLESSKINS_PATH))) {
|
|
||||||
paths.filter(Files::isRegularFile).forEach(path -> {
|
|
||||||
Path newPath = Paths.get(Main.VEHICLESSKINS_NEWPATH + path.getFileName().toString().toLowerCase().replaceAll(" ", ""));
|
|
||||||
|
|
||||||
try {
|
|
||||||
org.apache.commons.io.FileUtils.copyFile(path.toFile(), newPath.toFile(), false);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Logger.error("Cannot rename/move skins file : " + path.getFileName());
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
Logger.info("Successfully copied and renamed the skins files.");
|
|
||||||
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
43
src/main/java/ch/m4th1eu/flansupdater/Zip.java
Normal file
43
src/main/java/ch/m4th1eu/flansupdater/Zip.java
Normal file
@ -0,0 +1,43 @@
|
|||||||
|
package ch.m4th1eu.flansupdater;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileInputStream;
|
||||||
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.zip.ZipEntry;
|
||||||
|
import java.util.zip.ZipInputStream;
|
||||||
|
|
||||||
|
public class Zip {
|
||||||
|
public static void unzip(File file) throws IOException {
|
||||||
|
String fileZip = file.getPath();
|
||||||
|
File destDir = new File(file.getPath());
|
||||||
|
byte[] buffer = new byte[1024];
|
||||||
|
ZipInputStream zis = new ZipInputStream(new FileInputStream(fileZip));
|
||||||
|
ZipEntry zipEntry = zis.getNextEntry();
|
||||||
|
while (zipEntry != null) {
|
||||||
|
File newFile = newFile(destDir, zipEntry);
|
||||||
|
FileOutputStream fos = new FileOutputStream(newFile);
|
||||||
|
int len;
|
||||||
|
while ((len = zis.read(buffer)) > 0) {
|
||||||
|
fos.write(buffer, 0, len);
|
||||||
|
}
|
||||||
|
fos.close();
|
||||||
|
zipEntry = zis.getNextEntry();
|
||||||
|
}
|
||||||
|
zis.closeEntry();
|
||||||
|
zis.close();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static File newFile(File destinationDir, ZipEntry zipEntry) throws IOException {
|
||||||
|
File destFile = new File(destinationDir, zipEntry.getName());
|
||||||
|
|
||||||
|
String destDirPath = destinationDir.getCanonicalPath();
|
||||||
|
String destFilePath = destFile.getCanonicalPath();
|
||||||
|
|
||||||
|
if (!destFilePath.startsWith(destDirPath + File.separator)) {
|
||||||
|
throw new IOException("Entry is outside of the target dir: " + zipEntry.getName());
|
||||||
|
}
|
||||||
|
|
||||||
|
return destFile;
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +0,0 @@
|
|||||||
Manifest-Version: 1.0
|
|
||||||
Class-Path: log4j-core-2.13.2.jar log4j-api-2.13.2.jar commons-io-2.6.
|
|
||||||
jar
|
|
||||||
Main-Class: ch.m4th1eu.flansupdater.Main
|
|
Binary file not shown.
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
Binary file not shown.
Before Width: | Height: | Size: 69 KiB After Width: | Height: | Size: 15 KiB |
@ -1,43 +1,37 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
|
||||||
<?import javafx.scene.control.*?>
|
<?import javafx.scene.control.Button?>
|
||||||
|
<?import javafx.scene.control.Label?>
|
||||||
|
<?import javafx.scene.control.Separator?>
|
||||||
|
<?import javafx.scene.control.TextField?>
|
||||||
<?import javafx.scene.image.Image?>
|
<?import javafx.scene.image.Image?>
|
||||||
<?import javafx.scene.image.ImageView?>
|
<?import javafx.scene.image.ImageView?>
|
||||||
<?import javafx.scene.layout.AnchorPane?>
|
<?import javafx.scene.layout.AnchorPane?>
|
||||||
<?import javafx.scene.text.Font?>
|
<?import javafx.scene.text.Font?>
|
||||||
<AnchorPane style="-fx-background-color: #303030;" xmlns="http://javafx.com/javafx/8.0.171"
|
|
||||||
xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.m4th1eu.flansupdater.FrameController">
|
<AnchorPane style="-fx-background-color: #303030;" xmlns="http://javafx.com/javafx/8.0.172-ea" xmlns:fx="http://javafx.com/fxml/1" fx:controller="ch.m4th1eu.flansupdater.Controller">
|
||||||
<Label layoutX="414.0" layoutY="357.0" text="Flans Updater V2 - Développé par M4TH1EU_" textFill="WHITE">
|
<Label layoutX="386.0" layoutY="357.0" text="Flans Updater - Developped by M4TH1EU_" textFill="WHITE">
|
||||||
<font>
|
<font>
|
||||||
<Font size="11.0" fx:id="x3"/>
|
<Font size="11.0" fx:id="x3" />
|
||||||
</font>
|
</font>
|
||||||
</Label>
|
</Label>
|
||||||
<Button fx:id="bug" layoutX="182.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
<Button fx:id="bug" layoutX="182.0" layoutY="290.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Signaler un bug" textFill="WHITE" />
|
||||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Signaler un bug"
|
|
||||||
textFill="WHITE"/>
|
|
||||||
|
|
||||||
<Button fx:id="idea" layoutX="333.0" layoutY="292.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0"
|
<Button fx:id="idea" layoutX="333.0" layoutY="290.0" mnemonicParsing="false" prefHeight="30.0" prefWidth="126.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Une idée ?" textFill="WHITE" />
|
||||||
style="-fx-background-color: transparent; -fx-border-color: white;" text="Une idée ?" textFill="WHITE"/>
|
|
||||||
|
|
||||||
<Separator layoutY="347.0" prefHeight="16.0" prefWidth="640.0"/>
|
<Separator layoutY="347.0" prefHeight="16.0" prefWidth="640.0" />
|
||||||
|
|
||||||
<Button fx:id="convertir" layoutX="197.0" layoutY="200.0" mnemonicParsing="false" prefHeight="48.0"
|
<Button fx:id="convertir" layoutX="197.0" layoutY="179.0" mnemonicParsing="false" prefHeight="48.0" prefWidth="252.0" style="-fx-background-color: transparent; -fx-border-color: white; -fx-border-width: 2;" text="Mettre à jour mon pack" textFill="WHITE">
|
||||||
prefWidth="252.0" style="-fx-background-color: transparent; -fx-border-color: white; -fx-border-width: 2;"
|
|
||||||
text="Mettre à jour mon pack" textFill="WHITE">
|
|
||||||
<font>
|
<font>
|
||||||
<Font size="20.0"/>
|
<Font size="20.0" />
|
||||||
</font>
|
</font>
|
||||||
</Button>
|
</Button>
|
||||||
<Button fx:id="selectpack" layoutX="347.0" layoutY="147.0" mnemonicParsing="false" prefHeight="21.0"
|
<Button fx:id="selectpack" layoutX="347.0" layoutY="130.0" mnemonicParsing="false" prefHeight="21.0" prefWidth="101.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Choisir un pack" textFill="WHITE" />
|
||||||
prefWidth="101.0" style="-fx-background-color: transparent; -fx-border-color: white;" text="Choisir un pack"
|
<TextField fx:id="packname" layoutX="196.0" layoutY="130.0" prefHeight="27.0" prefWidth="149.0" style="-fx-background-color: transparent; -fx-border-color: white; -fx-text-fill: white" />
|
||||||
textFill="WHITE"/>
|
<Label layoutX="197.0" layoutY="111.0" text="Nom du pack" textFill="WHITE" />
|
||||||
<TextField fx:id="packname" layoutX="196.0" layoutY="147.0" prefHeight="27.0" prefWidth="149.0"
|
<ImageView fitHeight="135.0" fitWidth="437.0" layoutX="103.0" layoutY="-2.0" pickOnBounds="true" preserveRatio="true">
|
||||||
style="-fx-background-color: transparent; -fx-border-color: white; -fx-text-fill: white"/>
|
|
||||||
<Label layoutX="197.0" layoutY="127.0" text="Nom du pack" textFill="WHITE"/>
|
|
||||||
<ImageView fitHeight="118.0" fitWidth="583.0" layoutX="84.0" layoutY="-4.0" pickOnBounds="true"
|
|
||||||
preserveRatio="true">
|
|
||||||
<image>
|
<image>
|
||||||
<Image url="@logo_transparent.png"/>
|
<Image url="@logo_transparent.png" />
|
||||||
</image>
|
</image>
|
||||||
</ImageView>
|
</ImageView>
|
||||||
</AnchorPane>
|
</AnchorPane>
|
||||||
|
Reference in New Issue
Block a user