Skip to content

Commit

Permalink
IT WORKS
Browse files Browse the repository at this point in the history
  • Loading branch information
CorruptComputer committed Jul 26, 2015
1 parent 7c903ca commit 4516db6
Show file tree
Hide file tree
Showing 8 changed files with 239 additions and 177 deletions.
79 changes: 0 additions & 79 deletions tools/dmm2tgm/dmm2tgm.py

This file was deleted.

Binary file modified tools/mapmerge/MapMerge.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions tools/mapmerge/Run Map Merge.bat
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
@echo off

java -jar MapMerge.jar ../../_maps/
call java -jar MapMerge.jar "../../_maps/" /wait

pause
60 changes: 60 additions & 0 deletions tools/mapmerge/Source/.settings/org.eclipse.jdt.ui.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
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
Binary file added tools/mapmerge/Source/bin/MapMerge.class
Binary file not shown.
101 changes: 101 additions & 0 deletions tools/mapmerge/Source/src/MapMerge.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,101 @@
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);
try{
Process process = new ProcessBuilder("C:\\Python27\\python.exe", "dmm2tgm.py", selected_map).start();
}catch(Exception e){
e.printStackTrace();
System.out.println("This was most likely caused by you not having python 2.7.x installed.");
System.out.println("Downloads can be found here: https://www.python.org/downloads/");
}

}
}
}
96 changes: 0 additions & 96 deletions tools/mapmerge/Source/src/MapMergerMain.java

This file was deleted.

Loading

0 comments on commit 4516db6

Please sign in to comment.