package util;

import java.io.FileInputStream;
import java.io.IOException;

import java.util.HashMap;
import java.util.Map;
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";
    public static Properties properties = new Properties();
    public static Map<PROPERTIES_KEYS, String> prop = new HashMap<>();

    public static void loadProperties(){
        try {
            properties.load(new FileInputStream(AppSettings.class.getResource("../"+PROPERTIES_FILE_NAME).getFile()));
        } catch (IOException e) {
            e.printStackTrace();
        }
        prop.put(PROPERTIES_KEYS.SINCHRONIZATION_PATH, properties.getProperty(PROPERTIES_KEYS.SINCHRONIZATION_PATH.name()));
    }
    public static void saveProperties(){
        /**
         * TODO реализовать сохранение настроек. если не вызывать метод, настройки не сохраняются
         */
    }
    public static void setProperty(PROPERTIES_KEYS key, String val){
        prop.put(key,val);
    }






}

@@ -27,100 +27,9 @@
 .io.
-FileInputStream;%0Aimport java.io.IOException;%0A%0Aimport java.util.HashMap;%0Aimport java.util.Map
+*
 ;%0Aim
@@ -262,16 +262,17 @@
 tings %7B%0A
+%0A
     publ
@@ -401,29 +401,30 @@
 .ini%22;%0A    p
-ublic
+rivate
  static Prop
@@ -464,79 +464,8 @@
 s();
-%0A    public static Map%3CPROPERTIES_KEYS, String%3E prop = new HashMap%3C%3E();
 %0A%0A  
@@ -495,32 +495,33 @@
 adProperties()%7B%0A
+%0A
         try %7B%0A  
@@ -722,125 +722,121 @@
     
+%7D%0A%0A
     p
-rop.put(PROPERTIES_KEYS.SINCHRONIZATION_PATH, properties.getProperty(PROPERTIES_KEYS.SINCHRONIZATION_PATH.name()
+ublic static String getProperty(PROPERTIES_KEYS key)%7B%0A        return properties.getProperty(key.toString(
 ));%0A
@@ -837,24 +837,25 @@
 g());%0A    %7D%0A
+%0A
     public s
@@ -883,24 +883,25 @@
 ties()%7B%0A
+%0A
         
 /**%0A    
@@ -892,19 +892,21 @@
         
-/**
+try %7B
 %0A       
@@ -911,108 +911,234 @@
     
-* TODO %D1%80%D0%B5%D0%B0%D0%BB%D0%B8%D0%B7%D0%BE%D0%B2%D0%B0%D1%82%D1%8C %D1%81%D0%BE%D1%85%D1%80%D0%B0%D0%BD%D0%B5%D0%BD%D0%B8%D0%B5 %D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B5%D0%BA. %D0%B5%D1%81%D0%BB%D0%B8 %D0%BD%D0%B5 %D0%B2%D1%8B%D0%B7%D1%8B%D0%B2%D0%B0%D1%82%D1%8C %D0%BC%D0%B5%D1%82%D0%BE%D0%B4, %D0%BD%D0%B0%D1%81%D1%82%D1%80%D0%BE%D0%B9%D0%BA%D0%B8 %D0%BD%D0%B5 %D1%81%D0%BE%D1%85%D1%80%D0%B0%D0%BD%D1%8F%D1%8E%D1%82%D1%81%D1%8F%0A         */
+   FileWriter writer = new FileWriter(AppSettings.class.getResource(%22../%22+PROPERTIES_FILE_NAME).getFile());%0A            properties.store(writer, %22%22);%0A        %7D catch (IOException e) %7B%0A            e.printStackTrace();%0A        %7D
 %0A   
@@ -1209,16 +1209,17 @@
 g val)%7B%0A
+%0A
         
@@ -1226,17 +1226,43 @@
 prop
-.put(key,
+erties.setProperty(key.toString(), 
 val)
@@ -1271,14 +1271,10 @@
     %7D%0A%0A%0A
-%0A%0A%0A%0A
 %7D%0A

Update AppSettings class