mirror of
https://github.com/hyperion-project/hyperion.ng.git
synced 2023-10-10 13:36:59 +02:00
Fixed empty transform vector if failed to load settings
Former-commit-id: 52079c03c3c4e87160ea4e077edbadc9900e6e20
This commit is contained in:
parent
30c75263c0
commit
f2253f185f
@ -1 +1 @@
|
|||||||
f952d16d70fad0d6063d719588a5cf7c05d9c257
|
bfe21c488f982bc107e7acaa4c90be41a6782f9e
|
@ -12,6 +12,8 @@ import java.lang.reflect.Modifier;
|
|||||||
import java.lang.reflect.ParameterizedType;
|
import java.lang.reflect.ParameterizedType;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
import java.util.Vector;
|
import java.util.Vector;
|
||||||
|
import java.util.zip.GZIPInputStream;
|
||||||
|
import java.util.zip.GZIPOutputStream;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class for supporting the serialisation and deserialisation of HyperCon settings.
|
* Class for supporting the serialisation and deserialisation of HyperCon settings.
|
||||||
@ -29,8 +31,8 @@ public class ConfigurationFile {
|
|||||||
public void load(String pFilename) {
|
public void load(String pFilename) {
|
||||||
mProps.clear();
|
mProps.clear();
|
||||||
// try (InputStream in = new InflaterInputStream(new FileInputStream(pFilename))){
|
// try (InputStream in = new InflaterInputStream(new FileInputStream(pFilename))){
|
||||||
// try (InputStream in = new GZIPInputStream(new FileInputStream(pFilename))){
|
try (InputStream in = new GZIPInputStream(new FileInputStream(pFilename))){
|
||||||
try (InputStream in = new FileInputStream(pFilename)) {
|
// try (InputStream in = new FileInputStream(pFilename)) {
|
||||||
mProps.load(in);
|
mProps.load(in);
|
||||||
} catch (Throwable t) {
|
} catch (Throwable t) {
|
||||||
// TODO Auto-generated catch block
|
// TODO Auto-generated catch block
|
||||||
@ -45,8 +47,8 @@ public class ConfigurationFile {
|
|||||||
*/
|
*/
|
||||||
public void save(String pFilename) {
|
public void save(String pFilename) {
|
||||||
// try (OutputStream out = new DeflaterOutputStream(new FileOutputStream(pFilename))) {
|
// try (OutputStream out = new DeflaterOutputStream(new FileOutputStream(pFilename))) {
|
||||||
// try (OutputStream out = new GZIPOutputStream(new FileOutputStream(pFilename))) {
|
try (OutputStream out = new GZIPOutputStream(new FileOutputStream(pFilename))) {
|
||||||
try (OutputStream out = (new FileOutputStream(pFilename))) {
|
// try (OutputStream out = (new FileOutputStream(pFilename))) {
|
||||||
mProps.store(out, "Pesistent settings file for HyperCon");
|
mProps.store(out, "Pesistent settings file for HyperCon");
|
||||||
} catch (IOException e) {
|
} catch (IOException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -9,6 +9,7 @@ import javax.swing.JFrame;
|
|||||||
import javax.swing.UIManager;
|
import javax.swing.UIManager;
|
||||||
|
|
||||||
import org.hyperion.hypercon.gui.ConfigPanel;
|
import org.hyperion.hypercon.gui.ConfigPanel;
|
||||||
|
import org.hyperion.hypercon.spec.TransformConfig;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* (static) Main-class for starting HyperCon (the Hyperion configuration file builder) as a standard
|
* (static) Main-class for starting HyperCon (the Hyperion configuration file builder) as a standard
|
||||||
@ -44,26 +45,37 @@ public class Main {
|
|||||||
frame.addWindowListener(new WindowAdapter() {
|
frame.addWindowListener(new WindowAdapter() {
|
||||||
@Override
|
@Override
|
||||||
public void windowClosing(WindowEvent e) {
|
public void windowClosing(WindowEvent e) {
|
||||||
ConfigurationFile configFile = new ConfigurationFile();
|
try {
|
||||||
configFile.store(Main.HyperConConfig);
|
ConfigurationFile configFile = new ConfigurationFile();
|
||||||
configFile.store(ledString.mDeviceConfig);
|
configFile.store(Main.HyperConConfig);
|
||||||
configFile.store(ledString.mLedFrameConfig);
|
configFile.store(ledString.mDeviceConfig);
|
||||||
configFile.store(ledString.mProcessConfig);
|
configFile.store(ledString.mLedFrameConfig);
|
||||||
configFile.store(ledString.mColorConfig);
|
configFile.store(ledString.mProcessConfig);
|
||||||
configFile.store(ledString.mMiscConfig);
|
configFile.store(ledString.mColorConfig);
|
||||||
configFile.save(configFilename);
|
configFile.store(ledString.mMiscConfig);
|
||||||
|
configFile.save(configFilename);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
System.err.println("Failed to save " + configFilename);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
if (new File(configFilename).exists()) {
|
if (new File(configFilename).exists()) {
|
||||||
ConfigurationFile configFile = new ConfigurationFile();
|
try {
|
||||||
configFile.load(configFilename);
|
ConfigurationFile configFile = new ConfigurationFile();
|
||||||
configFile.restore(Main.HyperConConfig);
|
configFile.load(configFilename);
|
||||||
configFile.restore(ledString.mDeviceConfig);
|
configFile.restore(Main.HyperConConfig);
|
||||||
configFile.restore(ledString.mLedFrameConfig);
|
configFile.restore(ledString.mDeviceConfig);
|
||||||
configFile.restore(ledString.mProcessConfig);
|
configFile.restore(ledString.mLedFrameConfig);
|
||||||
configFile.restore(ledString.mColorConfig);
|
configFile.restore(ledString.mProcessConfig);
|
||||||
configFile.restore(ledString.mMiscConfig);
|
configFile.restore(ledString.mColorConfig);
|
||||||
|
configFile.restore(ledString.mMiscConfig);
|
||||||
|
} catch (Throwable t) {
|
||||||
|
System.err.println("Failed to load " + configFilename);
|
||||||
|
}
|
||||||
|
if (ledString.mColorConfig.mTransforms.isEmpty()) {
|
||||||
|
ledString.mColorConfig.mTransforms.add(new TransformConfig());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add the HyperCon configuration panel
|
// Add the HyperCon configuration panel
|
||||||
|
Loading…
x
Reference in New Issue
Block a user