Mais... on est pas en c#
This commit is contained in:
parent
01f9aef845
commit
6a0e320ff6
1 changed files with 9 additions and 9 deletions
|
@ -30,17 +30,17 @@ public class Configuration {
|
||||||
private int groupJoinMinutes;
|
private int groupJoinMinutes;
|
||||||
private String groupQuitMinutes;
|
private String groupQuitMinutes;
|
||||||
|
|
||||||
private File _file;
|
private File file;
|
||||||
|
|
||||||
public Configuration(String path) {
|
public Configuration(String path) {
|
||||||
this._file = new File(path);
|
this.file = new File(path);
|
||||||
System.out.println("Config on " + _file.getAbsolutePath());
|
System.out.println("Config on " + file.getAbsolutePath());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void load() throws Exception {
|
public void load() throws Exception {
|
||||||
if (!this._file.exists())
|
if (!this.file.exists())
|
||||||
return;
|
return;
|
||||||
BufferedReader reader = new BufferedReader(new FileReader(this._file));
|
BufferedReader reader = new BufferedReader(new FileReader(this.file));
|
||||||
String line;
|
String line;
|
||||||
while ((line = reader.readLine()) != null) {
|
while ((line = reader.readLine()) != null) {
|
||||||
String[] split = line.split("=");
|
String[] split = line.split("=");
|
||||||
|
@ -93,14 +93,14 @@ public class Configuration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void save() throws Exception {
|
public void save() throws Exception {
|
||||||
if (!_file.exists()) {
|
if (!file.exists()) {
|
||||||
File parent = _file.getParentFile();
|
File parent = file.getParentFile();
|
||||||
if (!parent.exists())
|
if (!parent.exists())
|
||||||
parent.mkdirs();
|
parent.mkdirs();
|
||||||
_file.createNewFile();
|
file.createNewFile();
|
||||||
}
|
}
|
||||||
Field[] fields = getClass().getDeclaredFields();
|
Field[] fields = getClass().getDeclaredFields();
|
||||||
BufferedWriter writer = new BufferedWriter(new FileWriter(_file));
|
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||||
for (Field field : fields) {
|
for (Field field : fields) {
|
||||||
field.setAccessible(true);
|
field.setAccessible(true);
|
||||||
if (field.getName().startsWith("_"))
|
if (field.getName().startsWith("_"))
|
||||||
|
|
Loading…
Add table
Reference in a new issue