mirror of
https://github.com/Maschell/JNUSTool.git
synced 2025-01-08 06:10:45 +01:00
5c1c02daba
added one line to config file (for updatelist) added updatelist.csv added a new crappy gui for the update list (i need someone for the gui stuff:'D) removed JAVA 7 support (sorry)
95 lines
1.7 KiB
Java
95 lines
1.7 KiB
Java
package de.mas.jnustool;
|
|
|
|
import java.util.Collection;
|
|
import java.util.TreeMap;
|
|
|
|
import javax.swing.tree.DefaultMutableTreeNode;
|
|
|
|
public class Directory {
|
|
String name = "";
|
|
TreeMap<String,Directory> folder = new TreeMap<>();
|
|
TreeMap<String,FEntry> files = new TreeMap<>();
|
|
|
|
public Directory get(String s){
|
|
return folder.get(s);
|
|
}
|
|
|
|
public Directory(String name){
|
|
setName(name);
|
|
}
|
|
|
|
public boolean containsFolder(String s){
|
|
return folder.containsKey(s);
|
|
}
|
|
|
|
public Directory getFolder(String s){
|
|
return folder.get(s);
|
|
}
|
|
|
|
public Directory addFolder(Directory s){
|
|
return folder.put(s.getName(),s);
|
|
}
|
|
public boolean containsFile(String s){
|
|
return files.containsKey(s);
|
|
}
|
|
|
|
public FEntry getFile(String s){
|
|
return files.get(s);
|
|
}
|
|
|
|
public FEntry addFile(FEntry s){
|
|
return files.put(s.getFileName(),s);
|
|
}
|
|
|
|
public String getName() {
|
|
return name;
|
|
}
|
|
|
|
public void setName(String name) {
|
|
this.name = name;
|
|
}
|
|
|
|
|
|
public Collection<Directory> getFolder() {
|
|
return folder.values();
|
|
}
|
|
|
|
|
|
|
|
public Collection<FEntry> getFiles() {
|
|
return files.values();
|
|
}
|
|
|
|
public void setFiles(TreeMap<String, FEntry> files) {
|
|
this.files = files;
|
|
}
|
|
|
|
@Override
|
|
public String toString(){
|
|
StringBuilder sb = new StringBuilder();
|
|
sb.append(name + ":" + "\n");
|
|
for(Directory d : folder.values()){
|
|
sb.append(d + "\n");
|
|
}
|
|
for(String s : files.keySet()){
|
|
sb.append(s + "\n");
|
|
}
|
|
return sb.toString();
|
|
}
|
|
|
|
public DefaultMutableTreeNode getNodes(){
|
|
DefaultMutableTreeNode node = new DefaultMutableTreeNode(getName());
|
|
|
|
for(Directory f: getFolder()){
|
|
node.add(f.getNodes());
|
|
}
|
|
|
|
for(FEntry f: getFiles()){
|
|
node.add(new DefaultMutableTreeNode(f));
|
|
}
|
|
return node;
|
|
}
|
|
|
|
|
|
}
|