Compare commits
No commits in common. "main" and "20240511204240" have entirely different histories.
main
...
2024051120
15 changed files with 61 additions and 135 deletions
2
.github/workflows/maven.yml
vendored
2
.github/workflows/maven.yml
vendored
|
@ -9,7 +9,7 @@ on:
|
|||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: docker
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout Repository
|
||||
uses: actions/checkout@v3
|
||||
|
|
10
pom.xml
10
pom.xml
|
@ -52,16 +52,6 @@
|
|||
<artifactId>github-api</artifactId>
|
||||
<version>1.127</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.sun.mail</groupId>
|
||||
<artifactId>javax.mail</artifactId>
|
||||
<version>1.6.2</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>mysql</groupId>
|
||||
<artifactId>mysql-connector-java</artifactId>
|
||||
<version>8.0.33</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>io.qtjambi</groupId>
|
||||
<artifactId>qtjambi</artifactId>
|
||||
|
|
|
@ -7,11 +7,14 @@ import java.net.URL;
|
|||
|
||||
import javax.swing.JFrame;
|
||||
import javax.swing.JLabel;
|
||||
import javax.swing.JOptionPane;
|
||||
import javax.swing.JProgressBar;
|
||||
import javax.swing.JScrollPane;
|
||||
import javax.swing.JTextArea;
|
||||
|
||||
import api.GetApiData;
|
||||
import gui.MainGUI;
|
||||
import readsafefile.SafeFileManager;
|
||||
import settingsfunctions.LoadSettings;
|
||||
import settingsfunctions.MigrateData;
|
||||
|
||||
|
@ -83,12 +86,13 @@ public class DownloadLevels {
|
|||
fileOutputStream.write(dataBuffer, 0, bytesRead);
|
||||
|
||||
}
|
||||
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
area.append(" >> ERFOLGREICH \n");
|
||||
}
|
||||
|
||||
JOptionPane.showMessageDialog(null, "Alle " + ManageFiles.getMissinglevels().size() + " Level wurden erfolgreich heruntergeladen.", "Download abgeschlossen", JOptionPane.INFORMATION_MESSAGE);
|
||||
main.dispose();
|
||||
|
||||
MainGUI gui = new MainGUI();
|
||||
|
|
|
@ -6,9 +6,10 @@ import java.nio.charset.StandardCharsets;
|
|||
import java.util.ArrayList;
|
||||
|
||||
import org.apache.commons.io.FileUtils;
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
import database.DatabaseManager;
|
||||
|
||||
public class GuiData {
|
||||
|
||||
private ArrayList<String> localLevels = new ArrayList<String>();
|
||||
|
@ -65,6 +66,9 @@ public class GuiData {
|
|||
}
|
||||
|
||||
public void IndexData(ArrayList<String> migrate) throws IOException {
|
||||
DatabaseManager mgr = new DatabaseManager();
|
||||
|
||||
|
||||
File filelength = new File("C:\\ExtremeDemonList\\levels");
|
||||
File[] filelengthindex = filelength.listFiles();
|
||||
|
||||
|
@ -81,15 +85,8 @@ public class GuiData {
|
|||
|
||||
localLevels.add(obj.getString("name"));
|
||||
id.add(obj.getInt("id") + "");
|
||||
|
||||
try {
|
||||
verifier.add(obj.getString("verifier"));
|
||||
creator.add(obj.getString("author"));
|
||||
} catch (JSONException e) {
|
||||
verifier.add(Long.toString(obj.getLong("verifier")));
|
||||
creator.add(Long.toString(obj.getLong("author")));
|
||||
}
|
||||
|
||||
verifier.add(obj.getString("verifier"));
|
||||
creator.add(obj.getString("author"));
|
||||
qualification.add(obj.getInt("percentToQualify") + "");
|
||||
ytlink.add(obj.getString("verification") + "");
|
||||
creators.add(obj.getJSONArray("creators") + "");
|
||||
|
|
|
@ -29,7 +29,7 @@ public class DatabaseManager {
|
|||
public void migrateData() {
|
||||
Sqlite database = new Sqlite("levels");
|
||||
FetchData fetch = new FetchData();
|
||||
status = LoadingStatus.getInstance();
|
||||
status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
|
||||
|
||||
status.initialize();
|
||||
|
||||
|
|
|
@ -129,8 +129,8 @@ public class Sqlite {
|
|||
+ " attempts INTEGER NOT NULL,\n"
|
||||
+ " completed BOOLEAN NOT NULL,\n"
|
||||
+ " locked BOOLEAN NOT NULL,\n" // Neue Spalte
|
||||
+ " personalBest STRING NOT NULL,\n"
|
||||
+ " levelLength String NOT NULL\n"
|
||||
+ " personalBest STRING,\n"
|
||||
+ " levelLength String\n"
|
||||
+ ");";
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(url);
|
||||
|
@ -176,40 +176,36 @@ public class Sqlite {
|
|||
}
|
||||
|
||||
public void queryData(String tablename) {
|
||||
FetchData fetch = new FetchData();
|
||||
|
||||
String sql = "SELECT levelname, levelID, author, creators, verifier, verificationLink, " +
|
||||
"percentToQualify, completed, records, levelNameRaw, attempts, locked, " +
|
||||
"personalBest, levelLength FROM " + tablename + " WHERE levelNameRaw = ?";
|
||||
String sql = "SELECT * FROM " + tablename;
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(url);
|
||||
PreparedStatement pstmt = conn.prepareStatement(sql)) {
|
||||
Statement stmt = conn.createStatement();
|
||||
ResultSet rs = stmt.executeQuery(sql)) {
|
||||
|
||||
// loop through the result set
|
||||
while (rs.next()) {
|
||||
levelname.add(rs.getString("levelname"));
|
||||
levelID.add(rs.getInt("levelID") + "");
|
||||
author.add(rs.getString("author"));
|
||||
creators.add(rs.getString("creators"));
|
||||
verifier.add(rs.getString("verifier"));
|
||||
verificationLink.add(rs.getString("verificationLink"));
|
||||
percenttoqualify.add(rs.getInt("percentToQualify") + "");
|
||||
completed.add(rs.getBoolean("completed") + "");
|
||||
records.add(rs.getString("records"));
|
||||
rawLevelNames.add(rs.getString("levelNameRaw"));
|
||||
attempts.add(rs.getInt("attempts"));
|
||||
locked.add(rs.getBoolean("locked")); // Get the value of the new column
|
||||
pbarr.add(rs.getString("personalBest"));
|
||||
levelLength.add(rs.getString("levelLength"));
|
||||
|
||||
for (int i = 0; i < fetch.allLevels().size(); i++) {
|
||||
pstmt.setString(1, fetch.allLevels().get(i));
|
||||
try (ResultSet rs = pstmt.executeQuery()) {
|
||||
while (rs.next()) { // Sicherstellen, dass alle Zeilen verarbeitet werden
|
||||
levelname.add(rs.getString("levelname"));
|
||||
levelID.add(rs.getInt("levelID") + "");
|
||||
author.add(rs.getString("author"));
|
||||
creators.add(rs.getString("creators"));
|
||||
verifier.add(rs.getString("verifier"));
|
||||
verificationLink.add(rs.getString("verificationLink"));
|
||||
percenttoqualify.add(rs.getInt("percentToQualify") + "");
|
||||
completed.add(rs.getBoolean("completed") + "");
|
||||
records.add(rs.getString("records"));
|
||||
rawLevelNames.add(rs.getString("levelNameRaw"));
|
||||
attempts.add(rs.getInt("attempts"));
|
||||
locked.add(rs.getBoolean("locked"));
|
||||
pbarr.add(rs.getString("personalBest"));
|
||||
levelLength.add(rs.getString("levelLength"));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public void sortData(String tablename) throws SQLException {
|
||||
|
@ -372,17 +368,21 @@ status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
|
|||
public void checkColumns(String tablename) {
|
||||
String[] spalten = {"placement", "levelname", "levelnameRaw", "levelID", "author", "creators", "verifier", "verificationLink", "percentToQualify", "records", "attempts", "completed", "locked", "personalBest", "levelLength"};
|
||||
|
||||
// Datenbankverbindung
|
||||
try (Connection connection = DriverManager.getConnection(url)) {
|
||||
DatabaseMetaData metaData = connection.getMetaData();
|
||||
ResultSet resultSet;
|
||||
|
||||
int missing = 0;
|
||||
|
||||
// Schleife über die Spalten
|
||||
for (String spalte : spalten) {
|
||||
// Abfrage der Spalteninformationen
|
||||
resultSet = metaData.getColumns(null, null, tablename, spalte);
|
||||
|
||||
if (!resultSet.next()) {
|
||||
System.out.println("Spalte " + spalte + " existiert nicht. Eine neue Spalte wird erstellt.");
|
||||
// Eine neue Spalte erstellen
|
||||
createNewColumn(tablename, spalte);
|
||||
missing++;
|
||||
}
|
||||
|
@ -398,7 +398,7 @@ status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
|
|||
}
|
||||
|
||||
private void createNewColumn(String tablename, String columnName) {
|
||||
String sql = "ALTER TABLE " + tablename + " ADD COLUMN " + columnName + " TEXT NOT NULL";
|
||||
String sql = "ALTER TABLE " + tablename + " ADD COLUMN " + columnName + " TEXT";
|
||||
try (Connection conn = DriverManager.getConnection(url);
|
||||
Statement stmt = conn.createStatement()) {
|
||||
stmt.executeUpdate(sql);
|
||||
|
@ -407,7 +407,6 @@ status = LoadingStatus.getInstance(); // Holen der Singleton-Instanz
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
public void moveDataToNewDatabase(String tablename) {
|
||||
// Neuen Tabellennamen für die Kopie
|
||||
String newTableName = tablename + "_new";
|
||||
|
|
|
@ -1,21 +0,0 @@
|
|||
package errorhandler;
|
||||
|
||||
import java.io.PrintWriter;
|
||||
import java.io.StringWriter;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
public class ErrorHandler {
|
||||
|
||||
public void newError(Throwable e) {
|
||||
e.printStackTrace();
|
||||
|
||||
StringWriter sw = new StringWriter();
|
||||
PrintWriter pw = new PrintWriter(sw);
|
||||
e.printStackTrace(pw);
|
||||
|
||||
JOptionPane.showMessageDialog(null, sw.toString() + "", e.getMessage(), JOptionPane.ERROR_MESSAGE);
|
||||
System.exit(-1);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,18 +0,0 @@
|
|||
package errorhandler;
|
||||
|
||||
import java.util.Properties;
|
||||
|
||||
import javax.mail.Authenticator;
|
||||
import javax.mail.Message;
|
||||
import javax.mail.MessagingException;
|
||||
import javax.mail.PasswordAuthentication;
|
||||
import javax.mail.Session;
|
||||
import javax.mail.Transport;
|
||||
import javax.mail.internet.InternetAddress;
|
||||
import javax.mail.internet.MimeMessage;
|
||||
|
||||
public class ErrorSubmission {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -23,13 +23,6 @@ public class LoadingStatus {
|
|||
initialize();
|
||||
}
|
||||
|
||||
public static synchronized LoadingStatus getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new LoadingStatus();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void initialize() {
|
||||
main.setSize(400, 300);
|
||||
main.setLayout(null);
|
||||
|
@ -60,6 +53,13 @@ public class LoadingStatus {
|
|||
main.setVisible(true);
|
||||
}
|
||||
|
||||
public static synchronized LoadingStatus getInstance() {
|
||||
if (instance == null) {
|
||||
instance = new LoadingStatus();
|
||||
}
|
||||
return instance;
|
||||
}
|
||||
|
||||
public void update(String level, int barValue) {
|
||||
area.append(level + "\n");
|
||||
bar.setValue(barValue + 1);
|
||||
|
|
|
@ -3,6 +3,7 @@ package gui;
|
|||
import java.awt.Button;
|
||||
import java.awt.Color;
|
||||
import java.awt.Dimension;
|
||||
import java.awt.Font;
|
||||
import java.awt.GridLayout;
|
||||
import java.awt.Insets;
|
||||
import java.awt.Toolkit;
|
||||
|
@ -17,6 +18,10 @@ import java.awt.event.KeyListener;
|
|||
import java.awt.event.MouseEvent;
|
||||
import java.awt.event.MouseListener;
|
||||
import java.io.IOException;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.ProtocolException;
|
||||
import java.net.URL;
|
||||
|
||||
import javax.swing.BorderFactory;
|
||||
import javax.swing.ImageIcon;
|
||||
|
@ -329,14 +334,10 @@ public class MainGUI {
|
|||
attemptslabel.setText("Attempts: " + data.getAttempts().get(index));
|
||||
level.setVerticalAlignment(SwingConstants.CENTER);
|
||||
|
||||
String levellength = data.getLevelLength().get(index);
|
||||
lengthLabel.setText("Länge: lädt...");
|
||||
|
||||
String levellength = data.getLevelLength().get(index);
|
||||
|
||||
System.out.println("test:" + data.getLevelLength().get(index) + ".");
|
||||
|
||||
|
||||
if(data.getLevelLength().get(index).equals("N/A") || data.getLevelLength().get(index) == null) {
|
||||
if(data.getLevelLength().get(index).equals("N/A")) {
|
||||
levellength = api.getLevelLength(Integer.parseInt(data.getLevelID().get(index)));
|
||||
data.modifyData(data.getLevelname().get(index), comp[index], Integer.parseInt(attempts.getText()), lockbool[index], data.getPbarr().get(index), levellength);
|
||||
System.out.println("request");
|
||||
|
@ -396,6 +397,7 @@ public class MainGUI {
|
|||
if(show.getSelectedIndex() == 1) {
|
||||
if(!(Integer.parseInt(rank.getName()) >= 0 && Integer.parseInt(rank.getName()) <= 2)) {
|
||||
levelpanel.remove(contents);
|
||||
|
||||
levelpanel.repaint();
|
||||
levelpanel.revalidate();
|
||||
}
|
||||
|
|
|
@ -3,14 +3,11 @@ package main;
|
|||
import java.io.IOException;
|
||||
import java.util.zip.DataFormatException;
|
||||
|
||||
import javax.swing.JOptionPane;
|
||||
|
||||
import api.GetApiData;
|
||||
import data.FetchData;
|
||||
import data.ManageFiles;
|
||||
import database.DatabaseManager;
|
||||
import database.Sqlite;
|
||||
import errorhandler.ErrorHandler;
|
||||
import filestructure.CreateFileStructure;
|
||||
import gui.LoadMenu;
|
||||
import preload.PreChecks;
|
||||
|
@ -19,16 +16,6 @@ import settingsfunctions.LoadSettings;
|
|||
public class Main {
|
||||
|
||||
public static void main(String[] args) throws IOException, DataFormatException {
|
||||
|
||||
Thread.setDefaultUncaughtExceptionHandler(new Thread.UncaughtExceptionHandler() {
|
||||
@Override
|
||||
public void uncaughtException(Thread t, Throwable e) {
|
||||
ErrorHandler error = new ErrorHandler();
|
||||
error.newError(e);
|
||||
}
|
||||
});
|
||||
|
||||
try {
|
||||
|
||||
LoadMenu load = new LoadMenu();
|
||||
load.onLoad();
|
||||
|
@ -67,10 +54,6 @@ public class Main {
|
|||
|
||||
load.updateBar("Ladevorgang abgeschlossen");
|
||||
load.close();
|
||||
|
||||
} catch (Exception e) {
|
||||
System.out.println("fehler");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -10,5 +10,4 @@
|
|||
requires java.xml;
|
||||
requires org.apache.commons.codec;
|
||||
requires github.api;
|
||||
requires java.mail;
|
||||
}
|
|
@ -24,4 +24,5 @@ public class PreChecks {
|
|||
migration.migrateData();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ import org.apache.commons.codec.binary.Base64;
|
|||
|
||||
public class DecryptXOR {
|
||||
|
||||
private static final String[] SAVES = {"CCGameManager.dat"};
|
||||
private static final String[] SAVES = {"CCGameManager.dat"};
|
||||
private static final int XOR_KEY = 11;
|
||||
|
||||
private static byte[] xor(byte[] data, int key) {
|
||||
|
|
|
@ -22,10 +22,6 @@ public class SafeFileManager {
|
|||
}
|
||||
|
||||
public void ReadIndexAttempts() throws IOException {
|
||||
Thread thread = new Thread(new Runnable() {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
|
||||
read.readAttempts();
|
||||
|
||||
|
@ -44,6 +40,8 @@ public class SafeFileManager {
|
|||
|
||||
lengthComp.putAll(read.lengthMap);
|
||||
|
||||
|
||||
|
||||
String attempts;
|
||||
String percent;
|
||||
String length;
|
||||
|
@ -65,17 +63,9 @@ public class SafeFileManager {
|
|||
prog.update(database.getLevelname().get(i), Integer.parseInt(attempts), Integer.parseInt(percent), i);
|
||||
if(!database.getLocked().get(i)) {
|
||||
database.modifyData(database.getLevelname().get(i), Boolean.parseBoolean(database.getCompleted().get(i)), Integer.parseInt(attempts), database.getLocked().get(i), percent, lengthArr[Integer.parseInt(length)]);
|
||||
} else {
|
||||
database.modifyData(database.getLevelname().get(i), Boolean.parseBoolean(database.getCompleted().get(i)), database.getAttempts().get(i), database.getLocked().get(i), database.getRecords().get(i), lengthArr[Integer.parseInt(length)]);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
prog.close();
|
||||
}
|
||||
|
||||
});
|
||||
thread.start();
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue