package com.robothand.highqualitybot;

import java.io.File;
import java.io.FileNotFoundException;
import java.util.Hashtable;
import java.util.Scanner;

/**
 * Created by ethan on 7/6/17.
 */
public class Config {
    private File configFile;
    private Hashtable<String, String> properties;

    public Config(String path) throws FileNotFoundException {
        configFile = new File(path);

        Scanner s = new Scanner(configFile);

        while (s.hasNextLine()) {
            String[] split = s.nextLine().split("=");
            String key, value;

            if (split.length < 2 || split[0].trim().startsWith("#")) {
                continue;
            }

            key = split[0].trim();
            value = split[1].trim();

            // place the property, overwrite if already present
            if (properties.putIfAbsent(key, value) != null) {
                properties.replace(key, value);
            }
        }
    }
}

@@ -158,33 +158,115 @@
  * C
-reated by ethan on 7/6/17
+onfig.java%0A *%0A * Reads in properties from a specified configuration file, and provides access to the values
 .%0A *
@@ -301,16 +301,22 @@
 private 
+final 
 File con
@@ -336,16 +336,22 @@
 private 
+final 
 Hashtabl
@@ -443,16 +443,56 @@
 ption %7B%0A
+        properties = new Hashtable%3C%3E();%0A
         
@@ -1075,11 +1075,98 @@
  %7D%0A    %7D
+%0A%0A    public String getProperty(String key) %7B%0A        return properties.get(key);%0A    %7D
 %0A%7D%0A

add getProperty() to Config