This commit is contained in:
potzplitz 2024-03-14 09:28:14 +01:00
commit 896b7bcb5c
5 changed files with 60 additions and 159 deletions

View file

@ -1,7 +1,7 @@
on:
push:
branches:
- main
- release
pull_request:
branches:
- main

View file

@ -8,6 +8,8 @@
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<dependency>

View file

@ -21,6 +21,7 @@ public class GuiData {
private ArrayList<String> verifier = new ArrayList<String>();
private ArrayList<String> creator = new ArrayList<String>();
private ArrayList<String> ytlink = new ArrayList<String>();
public ArrayList<String> completed = new ArrayList<String>();
private FetchData data = new FetchData();
@ -60,7 +61,7 @@ public class GuiData {
public void IndexLevelName() throws IOException {
public void IndexData() throws IOException {
FetchData data = new FetchData();
@ -70,174 +71,25 @@ public class GuiData {
String jsonstring;
localLength = filelengthindex.length;
System.out.println(filelengthindex.length);
for(int i = 0; i < filelengthindex.length; i++) {
jsonstring = FileUtils.readFileToString(new File("C:\\ExtremeDemonList\\levels\\" + data.allLevels().get(i) + ".json"), StandardCharsets.UTF_8);
jsonstring = jsonstring.trim().replace("\n", "").replace("\t", "").replace("\\", "");
JSONObject obj = new JSONObject(jsonstring);
JSONArray recordsArray = obj.getJSONArray("records");
localLevels.add(obj.getString("name"));
}
}
public void IndexLevelID() throws IOException {
File filelength = new File("C:\\ExtremeDemonList\\levels");
File[] filelengthindex = filelength.listFiles();
String jsonstring;
localLength = filelengthindex.length;
System.out.println(filelengthindex.length);
for(int i = 0; i < filelengthindex.length; i++) {
jsonstring = FileUtils.readFileToString(new File("C:\\ExtremeDemonList\\levels\\" + data.allLevels().get(i) + ".json"), StandardCharsets.UTF_8);
jsonstring = jsonstring.trim().replace("\n", "").replace("\t", "").replace("\\", "");
JSONObject obj = new JSONObject(jsonstring);
id.add(obj.getInt("id") + "");
}
}
public void IndexVerifiers() throws IOException {
FetchData data = new FetchData();
File filelength = new File("C:\\ExtremeDemonList\\levels");
File[] filelengthindex = filelength.listFiles();
String jsonstring;
localLength = filelengthindex.length;
System.out.println(filelengthindex.length);
for(int i = 0; i < filelengthindex.length; i++) {
jsonstring = FileUtils.readFileToString(new File("C:\\ExtremeDemonList\\levels\\" + data.allLevels().get(i) + ".json"), StandardCharsets.UTF_8);
jsonstring = jsonstring.trim().replace("\n", "").replace("\t", "").replace("\\", "");
JSONObject obj = new JSONObject(jsonstring);
verifier.add(obj.getString("verifier"));
}
}
public void IndexCreators() throws IOException {
FetchData data = new FetchData();
File filelength = new File("C:\\ExtremeDemonList\\levels");
File[] filelengthindex = filelength.listFiles();
String jsonstring;
localLength = filelengthindex.length;
System.out.println(filelengthindex.length);
for(int i = 0; i < filelengthindex.length; i++) {
jsonstring = FileUtils.readFileToString(new File("C:\\ExtremeDemonList\\levels\\" + data.allLevels().get(i) + ".json"), StandardCharsets.UTF_8);
jsonstring = jsonstring.trim().replace("\n", "").replace("\t", "").replace("\\", "");
JSONObject obj = new JSONObject(jsonstring);
creator.add(obj.getString("author"));
qualification.add(obj.getInt("percentToQualify") + "");
ytlink.add(obj.getString("verification") + "");
}
}
public void IndexQualification() throws IOException {
FetchData data = new FetchData();
File filelength = new File("C:\\ExtremeDemonList\\levels");
File[] filelengthindex = filelength.listFiles();
String jsonstring;
localLength = filelengthindex.length;
System.out.println(filelengthindex.length);
for(int i = 0; i < filelengthindex.length; i++) {
jsonstring = FileUtils.readFileToString(new File("C:\\ExtremeDemonList\\levels\\" + data.allLevels().get(i) + ".json"), StandardCharsets.UTF_8);
jsonstring = jsonstring.trim().replace("\n", "").replace("\t", "").replace("\\", "");
JSONObject obj = new JSONObject(jsonstring);
qualification.add(obj.getInt("percentToQualify") + "");
}
}
public ArrayList<String> IndexYoutubeLink() throws IOException {
FetchData data = new FetchData();
File filelength = new File("C:\\ExtremeDemonList\\levels");
File[] filelengthindex = filelength.listFiles();
String jsonstring;
localLength = filelengthindex.length;
System.out.println(filelengthindex.length);
for(int i = 0; i < filelengthindex.length; i++) {
jsonstring = FileUtils.readFileToString(new File("C:\\ExtremeDemonList\\levels\\" + data.allLevels().get(i) + ".json"), StandardCharsets.UTF_8);
jsonstring = jsonstring.trim().replace("\n", "").replace("\t", "").replace("\\", "");
JSONObject obj = new JSONObject(jsonstring);
ytlink.add(obj.getString("verification") + "");
}
return ytlink;
}
}
public static ArrayList<String> allVictors(String levelname) throws IOException {
ArrayList<String> completed = new ArrayList<>();
@ -259,7 +111,4 @@ public class GuiData {
return completed;
}
}

22
src/gui/SettingsGui.java Normal file
View file

@ -0,0 +1,22 @@
package gui;
import java.awt.Button;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javax.swing.JFrame;
import settingsfunctions.DeleteDatabase;
public class SettingsGui {
public void showSettings() {
JFrame settings = new JFrame("Einstellungen");
settings.setLayout(null);
settings.setResizable(false);
settings.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
settings.setSize(500, 500);
settings.setVisible(true);
}
}

View file

@ -0,0 +1,28 @@
package settingsfunctions;
import java.io.File;
public class DeleteDatabase {
private void deleter(String database) {
File filelength = new File("C:\\ExtremeDemonList\\" + database);
File[] filelengthindex = filelength.listFiles();
for(File file : filelengthindex) {
file.delete();
}
}
public void deleteCompleted() {
deleter("completed");
}
public void deleteUncompleted() {
deleter("levels");
}
public void deleteAll() {
deleteCompleted();
deleteUncompleted();
}
}