package util;

import java.io.*;
import java.util.Properties;

/**Класс для работы с настройками приложения
 * включает настройки:
 * -папка синхронизации SINCHRONIZATION_PATH
 * -..
 * @author Cloudraid Dev Team (cloudraid.stnetix.com)
 */

public class AppSettings {

    public enum PROPERTIES_KEYS {
        SINCHRONIZATION_PATH
    }

    private static final String PROPERTIES_FILE_NAME = "main.ini";
    private static Properties properties = new Properties();

    public static void loadProperties(){

        try {
            properties.load(new FileInputStream(AppSettings.class.getResource("../"+PROPERTIES_FILE_NAME).getFile()));
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static String getProperty(PROPERTIES_KEYS key){
        return properties.getProperty(key.toString());
    }

    public static void saveProperties(){

        try {
            FileWriter writer = new FileWriter(AppSettings.class.getResource("../"+PROPERTIES_FILE_NAME).getFile());
            properties.store(writer, "");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
    public static void setProperty(PROPERTIES_KEYS key, String val){

        properties.setProperty(key.toString(), val);
    }


}

@@ -345,23 +345,16 @@
 private 
-static 
 final St
@@ -405,23 +405,16 @@
 private 
-static 
 Properti
@@ -447,17 +447,16 @@
 ties();%0A
-%0A
     publ
@@ -462,39 +462,65 @@
 lic 
-static void loadPropertie
+AppSettings instance = null;%0A%0A    private AppSetting
 s()%7B%0A
-%0A
     
@@ -744,19 +744,179 @@
 public s
-tat
+ynchronized AppSettings getInstance()%7B%0A        if (instance == null)%7B%0A            instance = new AppSettings();%0A        %7D%0A        return instance;%0A    %7D%0A%0A%0A    publ
 ic Strin
@@ -1020,31 +1020,24 @@
 %0A    public 
-static 
 void savePro
@@ -1319,15 +1319,8 @@
 lic 
-static 
 void

update AppSettings class to singleton