Merge pull request #1202 from Citadel-Station-13/upstream-merge-27665

[MIRROR] Deletes the old java mapmerge
This commit is contained in:
LetterJay
2017-05-26 23:21:19 -05:00
committed by GitHub
16 changed files with 0 additions and 929 deletions
Binary file not shown.
@@ -1,4 +0,0 @@
@echo off
call java -jar MapMerge.jar "../../_maps/" /wait
pause
@@ -1,7 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="src/MapPatcher.jar"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -1,17 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>MapMerger</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
@@ -1,11 +0,0 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
@@ -1,60 +0,0 @@
cleanup.add_default_serial_version_id=false
cleanup.add_generated_serial_version_id=true
cleanup.add_missing_annotations=true
cleanup.add_missing_deprecated_annotations=true
cleanup.add_missing_methods=false
cleanup.add_missing_nls_tags=false
cleanup.add_missing_override_annotations=true
cleanup.add_missing_override_annotations_interface_methods=true
cleanup.add_serial_version_id=false
cleanup.always_use_blocks=true
cleanup.always_use_parentheses_in_expressions=true
cleanup.always_use_this_for_non_static_field_access=false
cleanup.always_use_this_for_non_static_method_access=false
cleanup.convert_functional_interfaces=false
cleanup.convert_to_enhanced_for_loop=false
cleanup.correct_indentation=true
cleanup.format_source_code=true
cleanup.format_source_code_changes_only=false
cleanup.insert_inferred_type_arguments=false
cleanup.make_local_variable_final=true
cleanup.make_parameters_final=false
cleanup.make_private_fields_final=true
cleanup.make_type_abstract_if_missing_method=false
cleanup.make_variable_declarations_final=false
cleanup.never_use_blocks=false
cleanup.never_use_parentheses_in_expressions=false
cleanup.organize_imports=true
cleanup.qualify_static_field_accesses_with_declaring_class=false
cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
cleanup.qualify_static_member_accesses_with_declaring_class=true
cleanup.qualify_static_method_accesses_with_declaring_class=true
cleanup.remove_private_constructors=true
cleanup.remove_redundant_type_arguments=true
cleanup.remove_trailing_whitespaces=false
cleanup.remove_trailing_whitespaces_all=true
cleanup.remove_trailing_whitespaces_ignore_empty=false
cleanup.remove_unnecessary_casts=true
cleanup.remove_unnecessary_nls_tags=true
cleanup.remove_unused_imports=true
cleanup.remove_unused_local_variables=true
cleanup.remove_unused_private_fields=true
cleanup.remove_unused_private_members=true
cleanup.remove_unused_private_methods=true
cleanup.remove_unused_private_types=true
cleanup.sort_members=false
cleanup.sort_members_all=false
cleanup.use_anonymous_class_creation=false
cleanup.use_blocks=true
cleanup.use_blocks_only_for_return_and_throw=false
cleanup.use_lambda=true
cleanup.use_parentheses_in_expressions=true
cleanup.use_this_for_non_static_field_access=true
cleanup.use_this_for_non_static_field_access_only_if_necessary=true
cleanup.use_this_for_non_static_method_access=true
cleanup.use_this_for_non_static_method_access_only_if_necessary=true
cleanup.use_type_arguments=false
cleanup_profile=_Default
cleanup_settings_version=2
eclipse.preferences.version=1
@@ -1,25 +0,0 @@
import java.io.IOException;
import java.nio.file.FileSystems;
import java.nio.file.FileVisitResult;
import java.nio.file.Path;
import java.nio.file.PathMatcher;
import java.nio.file.SimpleFileVisitor;
import java.nio.file.attribute.BasicFileAttributes;
import java.util.ArrayList;
public class FileFinder extends SimpleFileVisitor<Path> {
private PathMatcher matcher;
public ArrayList<Path> foundPaths = new ArrayList<>();
public FileFinder(String pattern) {
matcher = FileSystems.getDefault().getPathMatcher("glob:" + pattern);
}
@Override
public FileVisitResult visitFile(Path file, BasicFileAttributes attrs) throws IOException {
Path name = file.getFileName();
if (matcher.matches(name)) {
foundPaths.add(file);
}
return FileVisitResult.CONTINUE;
}
}
@@ -1,108 +0,0 @@
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Scanner;
public class MapMerge {
private static Scanner input = new Scanner(System.in);
private static Path pathToMaps;
public static void main(String[] mapPath) throws IOException {
pathToMaps = Paths.get(mapPath[0]);
FileFinder dmmFinder = new FileFinder("*.dmm");
Files.walkFileTree(pathToMaps, dmmFinder);
ArrayList<Path> foundFiles = dmmFinder.foundPaths;
if (foundFiles.size() > 0) {
try {
MapMerge.merge(foundFiles);
} catch (Exception e) {
System.out.println("Something went wrong.");
e.printStackTrace();
}
} else {
System.out.println("No files were found in provided directory!");
System.out.print("Path to maps folder: ");
pathToMaps = Paths.get(input.nextLine());
dmmFinder = new FileFinder("*.dmm");
Files.walkFileTree(pathToMaps, dmmFinder);
foundFiles = dmmFinder.foundPaths;
try {
MapMerge.merge(foundFiles);
} catch (Exception e) {
System.out.println("Something went wrong.");
e.printStackTrace();
}
}
}
public static void merge(ArrayList<Path> foundFiles) throws IOException {
System.out.println("How many files do you want to merge?");
int selection1;
inputCheck: while (true) {
while (!input.hasNextInt()) {
String temp = input.next();
System.out.println(temp + " is not a valid int.");
}
selection1 = input.nextInt();
if (selection1 < 0) {
System.out.println("Use a number greater than 0!");
continue inputCheck;
} else {
break inputCheck;
}
}
for (int numOfFiles = selection1; numOfFiles != 0; numOfFiles--) {
for (int num = 0; num < foundFiles.size(); num++) {
System.out.println(num + ": " + foundFiles.get(num));
}
System.out.print("File to use: ");
int selection2;
inputCheck: while (true) {
while (!input.hasNextInt()) {
String temp = input.next();
System.out.println(temp + " is not a valid int.");
}
selection2 = input.nextInt();
if ((selection2 < 0) || (selection2 >= foundFiles.size())) {
if (selection2 < 0) {
System.out.println("Use a number greater than 0!");
} else {
System.out.println("Use a number less than " + foundFiles.size() + "!");
}
continue inputCheck;
} else {
break inputCheck;
}
}
String selected_map = foundFiles.get(selection2) + "";
String backup_map = selected_map + ".backup";
String edited_map = selected_map;
String to_save = selected_map;
String[] passInto = { "-clean", backup_map, edited_map, to_save };
MapPatcher.main(passInto);
// Will try to fix when I have time ~CorruptComputer
/*try{
Process process = new ProcessBuilder("dmm2tgm\\dmm2tgm.exe", selected_map).start();
}catch(Exception e1){
System.out.println("You are not on a windows machine, trying the .py");
try{
Process process = new ProcessBuilder("dmm2tgm\\Source\\dmm2tgm.py", selected_map).start();
}catch(Exception e2){
System.out.println("You do not have python 2.7.x installed.");
System.out.println("Downloads can be found here: https://www.python.org/downloads/");
}
}
*/
}
}
}
@@ -1,42 +0,0 @@
class Location
{
int x;
int y;
int z;
public Location()
{
}
public Location(int paramInt1, int paramInt2, int paramInt3)
{
this.x = paramInt1;
this.y = paramInt2;
this.z = paramInt3;
}
public void set(int paramInt1, int paramInt2, int paramInt3)
{
this.x = paramInt1;
this.y = paramInt2;
this.z = paramInt3;
}
public boolean equals(Object paramObject)
{
if (!(paramObject instanceof Location)) return false;
Location localLocation = (Location)paramObject;
if ((this.x != localLocation.x) || (this.y != localLocation.y) || (this.z != localLocation.z)) return false;
return true;
}
public int hashCode()
{
return (this.z * 256 + this.y) * 256 + this.x;
}
public String toString()
{
return "(" + this.x + "," + this.y + "," + this.z + ")";
}
}
@@ -1,314 +0,0 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Set;
import java.util.Vector;
public class Map
{
boolean sizeunknown;
int minx;
int miny;
int minz;
int maxx;
int maxy;
int maxz;
HashMap<String, String> tile_types;
HashMap<String, String> codes_by_value;
HashMap<Location, String> tiles;
public Map()
{
this.sizeunknown = true;
this.tile_types = new HashMap();
this.codes_by_value = new HashMap();
this.tiles = new HashMap();
}
public Map(File paramFile)
{
this(paramFile, false);
}
public Map(File paramFile, boolean paramBoolean)
{
this.sizeunknown = true;
try {
BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(paramFile)));
this.tile_types = new HashMap();
this.codes_by_value = new HashMap();
this.tiles = new HashMap();
MapPatcher.Systemoutprintln(new StringBuilder().append("Loading map ").append(paramFile.getName()).toString());
MapPatcher.Systemoutprint("Loading tiles");
String str1 = "";
int i = 0;
while ((str1 = localBufferedReader.readLine()) != null)
{
if (str1.equals("")) break;
if (str1.startsWith("\""))
{
if (i < 1)
{
int j = str1.indexOf("\"", 1);
i = j - 1;
}
String str2 = str1.substring(1, 1 + i);
String str3 = str1.substring(str1.indexOf("("));
this.tile_types.put(str2, str3);
this.codes_by_value.put(str3, str2);
}
}
MapPatcher.Systemoutprintln(new StringBuilder().append(" ").append(this.tile_types.size()).toString());
if (!paramBoolean)
{
MapPatcher.Systemoutprintln("Loading levels");
while (true)
{
if ((str1 = localBufferedReader.readLine()) != null) { if (str1.startsWith("(")) break label270; } else {
label270: if (str1 == null)
{
break;
}
int k = str1.indexOf(",", 1);
int m = Integer.parseInt(str1.substring(1, k));
str1 = str1.substring(k);
k = str1.indexOf(",", 1);
int n = Integer.parseInt(str1.substring(1, k));
str1 = str1.substring(k);
k = str1.indexOf(")", 1);
int i1 = Integer.parseInt(str1.substring(1, k));
MapPatcher.Systemoutprintln(new StringBuilder().append("New map part from (").append(m).append(",").append(n).append(",").append(i1).append(")").toString());
int i3 = n;
if (this.sizeunknown)
{
this.minx = m; this.maxx = this.minx;
this.miny = n; this.maxy = this.miny;
this.minz = i1; this.maxz = this.minz;
this.sizeunknown = false;
}
if (this.minz > i1) this.minz = i1;
if (this.maxz < i1) this.maxz = i1;
while (!(str1 = localBufferedReader.readLine()).startsWith("\"}"))
{
int i2 = m;
if (this.miny > i3) this.miny = i3;
if (this.maxy < i3) this.maxy = i3;
while (str1.length() > 0)
{
String str4 = str1.substring(0, i);
Location localLocation = new Location(i2, i3, i1);
if (this.minx > i2) this.minx = i2;
if (this.maxx < i2) this.maxx = i2;
this.tiles.put(localLocation, this.tile_types.get(str4));
str1 = str1.substring(i);
i2++;
}
i3++;
}
}
}
}
localBufferedReader.close();
}
catch (Exception localException)
{
localException.printStackTrace();
}
}
public void mirrorY()
{
for (int i = this.minz; i <= this.maxz; i++)
for (int j = this.minx; j <= this.maxx; j++)
for (int k = this.miny; k < (this.miny + this.maxy) / 2; k++)
{
int m = this.maxy - (k - this.miny);
String str = contentAt2(j, k, i);
setAt(j, k, i, contentAt2(j, m, i));
setAt(j, m, i, str);
}
}
public String contentAt(int paramInt1, int paramInt2, int paramInt3)
{
Location localLocation = new Location(paramInt1, paramInt2, paramInt3);
String str = (String)this.tiles.get(localLocation);
if (str == null) System.err.println(new StringBuilder().append("Null at ").append(paramInt1).append(",").append(paramInt2).append(",").append(paramInt3).append(" Possible loading error").toString());
return str == null ? "null" : str;
}
public String contentAt2(int paramInt1, int paramInt2, int paramInt3)
{
Location localLocation = new Location(paramInt1, paramInt2, paramInt3);
return (String)this.tiles.get(localLocation);
}
public void setAt(int paramInt1, int paramInt2, int paramInt3, String paramString)
{
if (this.sizeunknown)
{
this.minx = (this.maxx = paramInt1);
this.miny = (this.maxy = paramInt2);
this.minz = (this.maxz = paramInt3);
this.sizeunknown = false;
}
else
{
this.minx = Math.min(this.minx, paramInt1);
this.miny = Math.min(this.miny, paramInt2);
this.minz = Math.min(this.minz, paramInt3);
this.maxx = Math.max(this.maxx, paramInt1);
this.maxy = Math.max(this.maxy, paramInt2);
this.maxz = Math.max(this.maxz, paramInt3);
}
Location localLocation = new Location(paramInt1, paramInt2, paramInt3);
localLocation.set(paramInt1, paramInt2, paramInt3);
this.tiles.put(localLocation, paramString);
}
public void save(File paramFile) throws Exception
{
saveReferencing(paramFile, null);
}
public void saveReferencing(File paramFile, Map paramMap) throws Exception
{
FileWriter localFileWriter = new FileWriter(paramFile);
this.tile_types.clear();
this.codes_by_value.clear();
Vector localVector1 = new Vector();
for (Object localObject1 = this.tiles.keySet().iterator(); ((Iterator)localObject1).hasNext(); ) { Location localLocation = (Location)((Iterator)localObject1).next();
String str1 = (String)this.tiles.get(localLocation);
if (!localVector1.contains(str1))
localVector1.add(str1);
}
MapPatcher.Systemoutprintln(new StringBuilder().append("We have ").append(localVector1.size()).append(" different tiles").toString());
localObject1 = new String[] { "a", "b", "c", "d", "e", "f", "g", "h", "i", "j", "k", "l", "m", "n", "o", "p", "q", "r", "s", "t", "u", "v", "w", "x", "y", "z", "A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M", "N", "O", "P", "Q", "R", "S", "T", "U", "V", "W", "X", "Y", "Z" };
int i = 1;
int j = localObject1.length;
while (j < localVector1.size())
{
j *= localObject1.length;
i++;
}
Vector localVector2;
if (paramMap == null) {
localVector2 = localVector1;
}
else {
localVector2 = new Vector();
for (Iterator localIterator = localVector1.iterator(); localIterator.hasNext(); ) { localObject2 = (String)localIterator.next();
if (paramMap.codes_by_value.containsKey(localObject2))
{
localObject3 = paramMap.getIdFor((String)localObject2);
this.tile_types.put(localObject3, localObject2);
this.codes_by_value.put(localObject2, localObject3);
}
else {
localVector2.add(localObject2);
} }
localVector1.clear();
}
int k = 0;
for (Object localObject2 = localVector2.iterator(); ((Iterator)localObject2).hasNext(); ) { localObject3 = (String)((Iterator)localObject2).next();
do
{
str2 = int2code((String[])localObject1, k, i);
k++;
}while (this.tile_types.containsKey(str2));
this.tile_types.put(str2, localObject3);
this.codes_by_value.put(localObject3, str2);
}
String str2;
localVector2.clear();
k = 0;
for (int m = 0; m < this.tile_types.size(); m++)
{
do
{
localObject3 = int2code((String[])localObject1, k, i);
k++;
}while (!this.tile_types.containsKey(localObject3));
str2 = (String)this.tile_types.get(localObject3);
localFileWriter.write(new StringBuilder().append("\"").append((String)localObject3).append("\" = ").append(str2).append("\r\n").toString());
}
localVector2.clear();
localFileWriter.write("\n");
m = 1 + this.maxz - this.minz;
Object localObject3 = new SavingThread[m];
int n = (this.maxy - this.miny) * ((this.maxx - this.minx) * i + 2) + 32;
for (k = 0; k < m; k++)
{
localObject3[k] = new SavingThread(this.minz + k, this, n);
localObject3[k].start();
}
int i1 = 0;
String str3 = "";
while (i1 == 0) {
try {
Thread.sleep(100L); } catch (Exception localException) {
}
i1 = 1;
str3 = "";
for (k = 0; k < m; k++)
{
if (!localObject3[k].done)
i1 = 0;
if (str3.length() != 0) str3 = new StringBuilder().append(str3).append(" ").toString();
str3 = new StringBuilder().append(str3).append(localObject3[k].done ? "Done" : new StringBuilder().append(localObject3[k].progress).append("%").toString()).toString();
}
MapPatcher.Systemoutprint(new StringBuilder().append(str3).append("\r").toString());
}
for (k = 0; k < m; k++) {
localFileWriter.write(localObject3[k].result.toString());
}
localFileWriter.flush();
localFileWriter.close();
}
public String getIdFor(String paramString)
{
if (this.codes_by_value.containsKey(paramString))
{
return (String)this.codes_by_value.get(paramString);
}
return "???";
}
public String int2code(String[] paramArrayOfString, int paramInt1, int paramInt2)
{
String str = "";
while (paramInt1 >= paramArrayOfString.length)
{
int i = paramInt1 % paramArrayOfString.length;
str = new StringBuilder().append(paramArrayOfString[i]).append(str).toString();
paramInt1 -= i;
paramInt1 /= paramArrayOfString.length;
}
str = new StringBuilder().append(paramArrayOfString[paramInt1]).append(str).toString();
while (str.length() < paramInt2) str = new StringBuilder().append(paramArrayOfString[0]).append(str).toString();
return str;
}
}
@@ -1,304 +0,0 @@
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileWriter;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.util.Arrays;
public class MapPatcher
{
static boolean silent = false;
public static void main(String[] paramArrayOfString)
{
String str1 = "usage: [me] -diff [old_map] [new_map] [diff_file]";
String str2 = "usage: [me] -patch [old_map] [diff_file] [new_map]";
String str3 = "usage: [me] -pack [unpacked] [packed.dmm]";
String str4 = "usage: [me] -unpack [packed.dmm] [unpacked]";
String str5 = "usage: [me] -clean [oldmap.dmm] [newmap.dmm] [cleaned.dmm]";
String str6 = "usage: [me] -merge [original] [local] [remote] [output]";
for (int i = 0; i < paramArrayOfString.length; i++)
if (paramArrayOfString[i].equalsIgnoreCase("-silent"))
{
silent = true;
for (; i < paramArrayOfString.length - 1; i++)
paramArrayOfString[i] = paramArrayOfString[(i + 1)];
paramArrayOfString = (String[])Arrays.copyOf(paramArrayOfString, paramArrayOfString.length - 1);
break;
}
Object localObject;
int i2;
int i3;
int i5;
if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-merge")))
{
if (paramArrayOfString.length < 5)
{
System.out.println(str6);
try { System.in.read(); } catch (Exception localException1) {
}return;
}
Map localMap1 = new Map(new File(paramArrayOfString[1]));
localObject = new Map(new File(paramArrayOfString[2]));
Map localMap8 = new Map(new File(paramArrayOfString[3]));
Map localMap9 = new Map();
if ((localMap1.minx != ((Map)localObject).minx) || (localMap1.minx != localMap8.minx) || (localMap1.maxx != ((Map)localObject).maxx) || (localMap1.maxx != localMap8.maxx) || (localMap1.miny != ((Map)localObject).miny) || (localMap1.miny != localMap8.miny) || (localMap1.maxy != ((Map)localObject).maxy) || (localMap1.maxy != localMap8.maxy) || (localMap1.minz != ((Map)localObject).minz) || (localMap1.minz != localMap8.minz) || (localMap1.maxz != ((Map)localObject).maxz) || (localMap1.maxz != localMap8.maxz))
{
Systemoutprintln("Map sizes differ");
System.exit(1);
}
try
{
for (int n = localMap1.minz; n <= localMap1.maxz; n++)
for (i2 = localMap1.miny; i2 <= localMap1.maxy; i2++)
for (i3 = localMap1.minx; i3 <= localMap1.maxx; i3++)
{
boolean bool1 = localMap1.contentAt(i3, i2, n).equals(((Map)localObject).contentAt(i3, i2, n));
boolean bool2 = localMap1.contentAt(i3, i2, n).equals(localMap8.contentAt(i3, i2, n));
i5 = ((Map)localObject).contentAt(i3, i2, n).equals(localMap8.contentAt(i3, i2, n));
if ((!bool1) && (!bool2))
{
if (i5 == 0)
{
Systemoutprintln(i3 + "," + i2 + "," + n + " local and remote don't match original and differ");
System.exit(1);
}
else {
localMap9.setAt(i3, i2, n, ((Map)localObject).contentAt(i3, i2, n));
}
} else if (!bool1)
localMap9.setAt(i3, i2, n, ((Map)localObject).contentAt(i3, i2, n));
else if (!bool2)
localMap9.setAt(i3, i2, n, localMap8.contentAt(i3, i2, n));
else
localMap9.setAt(i3, i2, n, localMap1.contentAt(i3, i2, n));
}
Systemoutprintln("Saving");
localMap9.saveReferencing(new File(paramArrayOfString[4]), localMap1);
Systemoutprintln("Done");
}
catch (Exception localException12)
{
localException12.printStackTrace();
}
}
else
{
int m;
int i1;
if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-diff")))
{
if (paramArrayOfString.length < 4)
{
System.out.println(str1);
try { System.in.read(); } catch (Exception localException2) {
}return;
}
Map localMap2 = new Map(new File(paramArrayOfString[1]));
localObject = new Map(new File(paramArrayOfString[2]));
int j = Math.max(localMap2.minx, ((Map)localObject).minx);
m = Math.min(localMap2.maxx, ((Map)localObject).maxx);
i1 = Math.max(localMap2.miny, ((Map)localObject).miny);
i2 = Math.min(localMap2.maxy, ((Map)localObject).maxy);
i3 = Math.max(localMap2.minz, ((Map)localObject).minz);
int i4 = Math.min(localMap2.maxz, ((Map)localObject).maxz);
Systemoutprintln("Comparing: x(" + j + "-" + m + ") y(" + i1 + "-" + i2 + ") z(" + i3 + "-" + i4 + ")");
try
{
FileWriter localFileWriter2 = new FileWriter(paramArrayOfString[3]);
i5 = 0;
for (int i6 = i3; i6 <= i4; i6++)
{
Systemoutprintln("Z-level " + i6);
for (int i7 = i1; i7 <= i2; i7++)
for (int i8 = j; i8 <= m; i8++)
if (!localMap2.contentAt(i8, i7, i6).equals(((Map)localObject).contentAt(i8, i7, i6)))
{
localFileWriter2.write("(" + i8 + "," + (1 + ((Map)localObject).maxy - i7) + "," + i6 + ")=" + ((Map)localObject).contentAt(i8, i7, i6) + "\n");
i5++;
}
}
localFileWriter2.flush();
localFileWriter2.close();
if (i5 == 0)
Systemoutprintln("Files do match");
else
Systemoutprintln("Writed out " + i5 + " differences");
}
catch (Exception localException13)
{
localException13.printStackTrace();
}
Systemoutprintln("Done");
}
else
{
String str7;
String str8;
if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-patch")))
{
if (paramArrayOfString.length < 4)
{
System.out.println(str2);
try { System.in.read(); } catch (Exception localException3) {
}return;
}
Map localMap3 = new Map(new File(paramArrayOfString[1]));
try
{
localObject = new BufferedReader(new InputStreamReader(new FileInputStream(paramArrayOfString[2])));
while ((str7 = ((BufferedReader)localObject).readLine()) != null)
{
str7 = str7.trim();
if (str7.length() != 0)
{
m = str7.indexOf(",", 1);
i1 = Integer.parseInt(str7.substring(1, m));
str7 = str7.substring(m);
m = str7.indexOf(",", 1);
i2 = Integer.parseInt(str7.substring(1, m));
str7 = str7.substring(m);
m = str7.indexOf(")", 1);
i3 = Integer.parseInt(str7.substring(1, m));
str8 = str7.substring(str7.indexOf("=") + 1);
localMap3.setAt(i1, 1 + localMap3.maxy - i2, i3, str8);
}
}
localMap3.save(new File(paramArrayOfString[3]));
}
catch (Exception localException8)
{
localException8.printStackTrace();
}
Systemoutprintln("Done");
}
else if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-pack")))
{
if (paramArrayOfString.length < 3)
{
System.out.println(str3);
try { System.in.read(); } catch (Exception localException4) {
}return;
}
Map localMap4 = new Map();
try {
BufferedReader localBufferedReader = new BufferedReader(new InputStreamReader(new FileInputStream(paramArrayOfString[1])));
Systemoutprintln("Loading");
while ((str7 = localBufferedReader.readLine()) != null)
{
str7 = str7.trim();
if (str7.length() != 0)
{
m = str7.indexOf(",", 1);
i1 = Integer.parseInt(str7.substring(1, m));
str7 = str7.substring(m);
m = str7.indexOf(",", 1);
i2 = Integer.parseInt(str7.substring(1, m));
str7 = str7.substring(m);
m = str7.indexOf(")", 1);
i3 = Integer.parseInt(str7.substring(1, m));
str8 = str7.substring(str7.indexOf("=") + 1);
localMap4.setAt(i1, i2, i3, str8);
}
}
Systemoutprintln("Flipping");
localMap4.mirrorY();
Systemoutprintln("Saving, bounds: x{" + localMap4.minx + " - " + localMap4.maxx + "}, y{" + localMap4.miny + " - " + localMap4.maxy + "}, z{" + localMap4.minz + " - " + localMap4.maxz + "}");
localMap4.save(new File(paramArrayOfString[2]));
Systemoutprintln("Done");
}
catch (Exception localException9)
{
localException9.printStackTrace();
}
}
else if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-unpack")))
{
if (paramArrayOfString.length < 3)
{
System.out.println(str4);
try { System.in.read(); } catch (Exception localException5) {
}return;
}
Systemoutprintln("Loading");
Map localMap5 = new Map(new File(paramArrayOfString[1]));
try {
FileWriter localFileWriter1 = new FileWriter(paramArrayOfString[2]);
Systemoutprintln("Saving");
for (int k = localMap5.minz; k <= localMap5.maxz; k++)
{
Systemoutprintln("Z-level " + k);
for (m = localMap5.miny; m <= localMap5.maxy; m++)
for (i1 = localMap5.minx; i1 <= localMap5.maxx; i1++)
localFileWriter1.write("(" + i1 + "," + (1 + localMap5.maxy - m) + "," + k + ")=" + localMap5.contentAt(i1, m, k) + "\n");
localFileWriter1.write("\n");
}
localFileWriter1.flush();
localFileWriter1.close();
Systemoutprintln("Done");
}
catch (Exception localException10)
{
localException10.printStackTrace();
}
}
else if ((paramArrayOfString.length > 0) && (paramArrayOfString[0].equalsIgnoreCase("-clean")))
{
if (paramArrayOfString.length < 4)
{
System.out.println(str5);
try { System.in.read(); } catch (Exception localException6) {
}return;
}
Map localMap6 = new Map(new File(paramArrayOfString[1]), true);
Map localMap7 = new Map(new File(paramArrayOfString[2]));
try
{
localMap7.saveReferencing(new File(paramArrayOfString[3]), localMap6);
Systemoutprintln("Done");
}
catch (Exception localException11)
{
localException11.printStackTrace();
}
}
else
{
System.out.println(str1);
System.out.println(str2);
System.out.println(str3);
System.out.println(str4);
System.out.println(str5);
System.out.println(str6);
try {
System.in.read(); } catch (Exception localException7) { }
}
}
}
}
public static void Systemoutprintln(String paramString) { if (!silent)
System.out.println(paramString); }
public static void Systemoutprint(String paramString)
{
if (!silent)
System.out.print(paramString);
}
}
@@ -1,37 +0,0 @@
class SavingThread extends Thread
{
int z;
Map mymap;
boolean done;
int progress;
StringBuilder result;
public SavingThread(int paramInt1, Map paramMap, int paramInt2)
{
this.z = paramInt1;
this.mymap = paramMap;
this.progress = 0;
this.done = false;
this.result = new StringBuilder(paramInt2);
}
public void run()
{
this.result.append("(" + this.mymap.minx + "," + this.mymap.miny + "," + this.z + ") = {\"\r\n");
int i = (this.mymap.maxx - this.mymap.minx) * (this.mymap.maxy - this.mymap.miny) / 100;
int j = 0;
for (int k = this.mymap.miny; k <= this.mymap.maxy; k++)
{
for (int m = this.mymap.minx; m <= this.mymap.maxx; m++)
{
this.result.append(this.mymap.getIdFor(this.mymap.contentAt(m, k, this.z)));
j++; if (j >= i) { j = 0; this.progress += 1; }
}
this.result.append("\r\n");
}
this.result.append("\"}\r\n");
this.result.append("\r\n");
this.done = true;
}
}