Extensive netcode changes, bugfixes

This commit is contained in:
Anuken
2018-06-29 14:13:31 -04:00
parent 3898602f0e
commit b4151a256b
20 changed files with 411 additions and 187 deletions

View File

@@ -1,8 +1,10 @@
package io.anuke.mindustry.desktop;
import io.anuke.mindustry.net.Net;
import io.anuke.ucore.core.Settings;
import io.anuke.ucore.util.Strings;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
@@ -14,8 +16,6 @@ public class CrashHandler {
//TODO send full error report to server via HTTP
e.printStackTrace();
//attempt to close connections, if applicable
try{
Net.dispose();
@@ -26,8 +26,20 @@ public class CrashHandler {
//don't create crash logs for me (anuke), as it's expected
if(System.getProperty("user.name").equals("anuke")) return;
String header = "";
try{
header += "--GAME INFO-- \n";
header += "Multithreading: " + Settings.getBool("multithread")+ "\n";
header += "Net Active: " + Net.active()+ "\n";
header += "Net Server: " + Net.server()+ "\n";
header += "OS: " + System.getProperty("os.name")+ "\n----\n";
}catch (Throwable e4){
e4.printStackTrace();
}
//parse exception
String result = Strings.parseException(e, true);
String result = header + Strings.parseFullException(e);
boolean failed = false;
String filename = "";
@@ -42,9 +54,9 @@ public class CrashHandler {
}
try{
//JOptionPane.showMessageDialog(null, "An error has occured: \n" + result + "\n\n" +
// (!failed ? "A crash report has been written to " + new File(filename).getAbsolutePath() + ".\nPlease send this file to the developer!"
// : "Failed to generate crash report.\nPlease send an image of this crash log to the developer!"));
javax.swing.JOptionPane.showMessageDialog(null, "An error has occured: \n" + result + "\n\n" +
(!failed ? "A crash report has been written to " + new File(filename).getAbsolutePath() + ".\nPlease send this file to the developer!"
: "Failed to generate crash report.\nPlease send an image of this crash log to the developer!"));
}catch (Throwable i){
i.printStackTrace();
//what now?