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 String groupQuitMinutes;
|
||||
|
||||
private File _file;
|
||||
private File file;
|
||||
|
||||
public Configuration(String path) {
|
||||
this._file = new File(path);
|
||||
System.out.println("Config on " + _file.getAbsolutePath());
|
||||
this.file = new File(path);
|
||||
System.out.println("Config on " + file.getAbsolutePath());
|
||||
}
|
||||
|
||||
public void load() throws Exception {
|
||||
if (!this._file.exists())
|
||||
if (!this.file.exists())
|
||||
return;
|
||||
BufferedReader reader = new BufferedReader(new FileReader(this._file));
|
||||
BufferedReader reader = new BufferedReader(new FileReader(this.file));
|
||||
String line;
|
||||
while ((line = reader.readLine()) != null) {
|
||||
String[] split = line.split("=");
|
||||
|
@ -93,14 +93,14 @@ public class Configuration {
|
|||
}
|
||||
|
||||
public void save() throws Exception {
|
||||
if (!_file.exists()) {
|
||||
File parent = _file.getParentFile();
|
||||
if (!file.exists()) {
|
||||
File parent = file.getParentFile();
|
||||
if (!parent.exists())
|
||||
parent.mkdirs();
|
||||
_file.createNewFile();
|
||||
file.createNewFile();
|
||||
}
|
||||
Field[] fields = getClass().getDeclaredFields();
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(_file));
|
||||
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||
for (Field field : fields) {
|
||||
field.setAccessible(true);
|
||||
if (field.getName().startsWith("_"))
|
||||
|
|
Loading…
Add table
Reference in a new issue