Compare commits

...

3 Commits

3 changed files with 30 additions and 2 deletions

View File

@ -170,7 +170,7 @@ public class Gonzo {
File fscript = new File(Main.inpath + "temp/fscript");
if (fscript.exists()) {
new Rizzo(fscript, Main.inpath + "temp/"); // Lets rizz this mod up
new Rizzo(new FileInputStream(fscript), Main.inpath + "temp/"); // Lets rizz this mod up
}
if (new File(System.getProperty("user.home") + "/.firestar/temp/delete.txt").isFile()) {
@ -215,6 +215,13 @@ public class Gonzo {
}
}
// Post fscript changes
try (InputStream is = Main.class.getResourceAsStream("/post.fscript")) {
new Rizzo(is, Main.inpath + "temp/");
} catch (IOException ex) {
Logger.getLogger(Gonzo.class.getName()).log(Level.SEVERE, null, ex);
}
// create a list of the contents of data/ for psp2psarc.exe to read from
List<String> oFilesList = new ArrayList<String>();
List<String> oFilesList2 = new ArrayList<String>();

View File

@ -28,6 +28,7 @@ import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.PrintStream;
import java.io.StringWriter;
import java.nio.file.Files;
@ -59,7 +60,7 @@ public class Rizzo {
private int ver = 1;
private String workingDir;
public Rizzo(File infile, String workingDir) throws FileNotFoundException, FirescriptFormatException {
public Rizzo(InputStream infile, String workingDir) throws FileNotFoundException, FirescriptFormatException {
if (!workingDir.endsWith("/")) this.workingDir = workingDir + "/";
else this.workingDir = workingDir;
scanner = new Scanner(infile);
@ -288,6 +289,11 @@ public class Rizzo {
id = tag.substring(tag.indexOf("#")+1);
tag = tag.substring(0, tag.indexOf("#"));
}
String name = "";
if (tag.contains("$")) {
name = tag.substring(tag.indexOf("$")+1);
tag = tag.substring(0, tag.indexOf("$"));
}
if (id.length() > 0) {
NodeList ns;
if (parent instanceof Document document)
@ -301,6 +307,19 @@ public class Rizzo {
break;
}
}
} else if (name.length() > 0) {
NodeList ns;
if (parent instanceof Document document)
ns = document.getChildNodes();
else
ns = ((Element)parent).getChildNodes();
for (int i = 0; i < ns.getLength(); i++) {
Node n = ns.item(i);
if (((Element)n).getAttribute("name").equals(name)) {
newParent = (Element)n;
break;
}
}
} else {
if (parent instanceof Document document)
newParent = document.getElementsByTagName(tag).item(index);

View File

@ -0,0 +1,2 @@
# POST INSTALL FSCRIPT
fscript 1