Skip to content

Commit

Permalink
More Bugfixes
Browse files Browse the repository at this point in the history
namespace is now included as part of I/O
  • Loading branch information
rexc159 committed Mar 3, 2018
1 parent a3c82a4 commit 9590c92
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions src/StellarisDK/FileClasses/DataParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ public static ArrayList<TreeItem> parseAll(File file) throws IOException {
Scanner scan = new Scanner(file);
String temp;
TreeItem<String> consts = new TreeItem<>("Constants");
TreeItem<String> namespace = new TreeItem<>("Namespace");
Pattern name = Pattern.compile("namespace\\s*=\\s*\"(\\w+)\"");
do {
temp = scan.findWithinHorizon(name, 0);
if (temp != null)
namespace.getChildren().add(new TreeItem<>(temp));
}while (temp != null);
if(!namespace.getChildren().isEmpty())
out.add(namespace);
do {
temp = scan.findWithinHorizon(constants, 0);
if (temp != null)
Expand Down
2 changes: 2 additions & 0 deletions src/StellarisDK/FileClasses/Event.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@

public class Event extends GenericData {

private String namespace;

public Event() {
super();
ui = new EventUI(this);
Expand Down
1 change: 0 additions & 1 deletion src/StellarisDK/FileClasses/GenericData.java
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,6 @@ public String toString() {
if(color.find()){
data.add(new VPair(matcher.group(1).trim(), new VPair(matcher.group(2).trim(), new StellarisColor(color.group(1).trim(),color.group(2).trim(),color.group(3).trim(),color.group(4).trim()))));
}
// data.add(new VPair(matcher.group(1).trim(), new VPair(matcher.group(2).trim(), matcher.group(3).trim())));
} else if (matcher.group(4) != null) {
data.add(new VPair(matcher.group(4).trim(), new VPair(matcher.group(5).trim(), sLrecursion(matcher.group(6)))));
} else if (matcher.group(7) != null) {
Expand Down
4 changes: 2 additions & 2 deletions src/StellarisDK/GUI/guiController.java
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,7 @@ private void saveFiles(File saveLoc, TreeItem current) {
boolean output = false;
String temp = "";
for (Object item : current.getChildren()) {
if (((TreeItem) item).getValue() instanceof GenericData || ((TreeItem) item).getValue().equals("Constants")) {
if (((TreeItem) item).getValue() instanceof GenericData || ((TreeItem) item).getValue().equals("Constants") || ((TreeItem) item).getValue().equals("Namespace")) {
if (((TreeItem) item).getChildren().size() != 0) {
for (Object constant : ((TreeItem) item).getChildren()) {
output = true;
Expand All @@ -395,7 +395,7 @@ private void saveFiles(File saveLoc, TreeItem current) {
output = false;
temp = ((Locale) ((TreeItem) item).getValue()).export();
} else if (((TreeItem) item).getChildren().size() != 0) {
if (((TreeItem) item).getValue().equals("Constants")) {
if (((TreeItem) item).getValue().equals("Constants") || ((TreeItem) item).getValue().equals("Namespace")) {
saveFiles(saveLoc, (TreeItem) item);
} else {
saveLoc.mkdir();
Expand Down

0 comments on commit 9590c92

Please sign in to comment.