The client can auto-start and auto-signin

This commit is contained in:
Laurent Clouet
2015-04-03 19:50:58 +01:00
parent ebe6914624
commit eb0f762625
3 changed files with 43 additions and 4 deletions

View File

@@ -21,16 +21,18 @@ public class SettingsLoader {
private String computeMethod;
private String gpu;
private String cacheDir;
private String autoSignIn;
public SettingsLoader() {
generateFilePath();
}
public SettingsLoader(String login_, String password_, ComputeType computeMethod_, GPUDevice gpu_, String cacheDir_) {
public SettingsLoader(String login_, String password_, ComputeType computeMethod_, GPUDevice gpu_, String cacheDir_, boolean autoSignIn_) {
generateFilePath();
login = login_;
password = password_;
cacheDir = cacheDir_;
autoSignIn = String.valueOf(autoSignIn_);
if (computeMethod_ != null) {
try {
@@ -79,6 +81,10 @@ public class SettingsLoader {
prop.setProperty("password", password);
}
if (autoSignIn != null) {
prop.setProperty("auto-signin", autoSignIn);
}
prop.store(output, null);
}
catch (IOException io) {
@@ -102,6 +108,7 @@ public class SettingsLoader {
this.computeMethod = null;
this.gpu = null;
this.cacheDir = null;
this.autoSignIn = null;
if (new File(path).exists() == false) {
return;
@@ -132,6 +139,10 @@ public class SettingsLoader {
if (prop.containsKey("password")) {
this.password = prop.getProperty("password");
}
if (prop.containsKey("auto-signin")) {
this.autoSignIn = prop.getProperty("auto-signin");
}
}
catch (IOException io) {
io.printStackTrace();
@@ -178,6 +189,8 @@ public class SettingsLoader {
if (config.getUserSpecifiedACacheDir() == false && cacheDir != null) {
config.setCacheDir(new File(cacheDir));
}
config.setAutoSignIn(Boolean.valueOf(autoSignIn));
}
@Override