summaryrefslogtreecommitdiff
path: root/tools/tmwcon/src/converter/Main.java
diff options
context:
space:
mode:
authorBen Longbons <b.r.longbons@gmail.com>2011-06-19 14:08:55 -0700
committerBen Longbons <b.r.longbons@gmail.com>2011-06-19 14:19:55 -0700
commita185fab9ff741a8f1da3eb8cc2aef6860338e986 (patch)
tree9b2eefa5785696de2435c8afb60a2ba8a5bad22b /tools/tmwcon/src/converter/Main.java
parentee0ef0d8ce591a0c364f4f53130eb9581118d4cc (diff)
downloadserverdata-a185fab9ff741a8f1da3eb8cc2aef6860338e986.tar.gz
serverdata-a185fab9ff741a8f1da3eb8cc2aef6860338e986.tar.bz2
serverdata-a185fab9ff741a8f1da3eb8cc2aef6860338e986.tar.xz
serverdata-a185fab9ff741a8f1da3eb8cc2aef6860338e986.zip
Make converter nicer
Diffstat (limited to 'tools/tmwcon/src/converter/Main.java')
-rw-r--r--tools/tmwcon/src/converter/Main.java42
1 files changed, 16 insertions, 26 deletions
diff --git a/tools/tmwcon/src/converter/Main.java b/tools/tmwcon/src/converter/Main.java
index 80dfe30e..ab7786a9 100644
--- a/tools/tmwcon/src/converter/Main.java
+++ b/tools/tmwcon/src/converter/Main.java
@@ -66,45 +66,35 @@ public class Main {
return name;
}
- public static void run(String[] args, int unused) {
- reader = new XMLMapTransformer();
+ public static void main(String[] args) throws IOException {
+ if (args.length != 2) {
+ System.out.println("Usage: java Converter client-data-dir server-data-dir");
+ System.exit(1);
+ }
- PrintWriter summary = null;
+ File client_data = new File(args[0]);
+ File server_data = new File(args[1]);
- try {
- File temp = new File("summary.txt");
- temp.createNewFile();
- summary = new PrintWriter(temp);
- } catch (Exception e) {
- System.out.println("Problem opening summary file for writing:");
- e.printStackTrace();
- }
+ reader = new XMLMapTransformer();
+
+ PrintWriter summary = new PrintWriter("converter.txt");
- File folder = new File("server-data/data/");
- folder.mkdirs();
- Process.prepWLK(folder);
+ Process.setServerData(server_data);
- folder = new File("tmwdata/maps/");
+ File folder = new File(client_data, "maps/");
Collection<File> tmxs = getTMXFiles(folder);
- Vector<String> folders = new Vector<String>();
+ ArrayList<String> folders = new ArrayList<String>();
String name;
for (File f : tmxs) {
name = getName(folder, f);
System.out.printf("== %s ==\n", name);
- if (summary != null) summary.printf("== %s ==\n", name);
folders.add(Process.processMap(name, loadMap(f), f, summary));
}
- if (summary != null) {
- summary.flush();
- summary.close();
- }
-
- Process.writeMasterImport(folders.toArray(new String[0]));
- }
+ summary.flush();
+ summary.close();
- public static void main(String[] args) {
- run(args, 0);
+ Process.writeMasterImport(folders);
}
}