Fixed a problem that caused netbeans design view to fail.

This commit is contained in:
LevelX2 2018-10-10 16:10:54 +02:00
parent 189984d3d6
commit 2367ff5940

View file

@ -1,4 +1,3 @@
package mage.client.util;
import java.io.File;
@ -33,11 +32,13 @@ public final class Config {
static {
Properties p = new Properties();
try(FileInputStream fis =new FileInputStream(new File("config/config.properties"))) {
boolean fileFound = true;
try (FileInputStream fis = new FileInputStream(new File("config/config.properties"))) {
p.load(fis);
} catch (IOException ex) {
logger.fatal("Config error ", ex);
fileFound = false;
}
if (fileFound) {
serverName = p.getProperty("server-name");
port = Integer.parseInt(p.getProperty("port"));
remoteServer = p.getProperty("remote-server");
@ -51,20 +52,21 @@ public final class Config {
dimensions = new CardDimensions(cardScalingFactor);
dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
// activate instead this part, to run the UI editor for some panels without error
// serverName = "localhost";
// port = 17171;
// remoteServer = "mage-server";
// cardScalingFactor = 0.4;
// cardScalingFactorEnlarged = 0.5;
// handScalingFactor = 1.3;
// defaultGameType = p.getProperty("default-game-type", "Human");
// defaultDeckPath = "";
// defaultOtherPlayerIndex = "1";
// defaultComputerName = "Computer";
//
// dimensions = new CardDimensions(cardScalingFactor);
// dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
} else { // Take some default valies for netbeans design view
serverName = "localhost";
port = 17171;
remoteServer = "mage-server";
cardScalingFactor = 0.4;
cardScalingFactorEnlarged = 0.5;
handScalingFactor = 1.3;
defaultGameType = p.getProperty("default-game-type", "Human");
defaultDeckPath = "";
defaultOtherPlayerIndex = "1";
defaultComputerName = "AI Computer";
dimensions = new CardDimensions(cardScalingFactor);
dimensionsEnlarged = new CardDimensions(cardScalingFactorEnlarged);
}
}