package net.cobem.grizzly.utils.client;

public class VariableParser {
    /*private THashMap<String, String> Variables  = new THashMap<>();

    private THashMap<String, String> ExternalVariables = new THashMap<>();
    private THashMap<String, String> ExternalTexts = new THashMap<>();

    public VariableParser()
    {
        String Domain = Grizzly.getConfig().get("module.grizzly.link");

        if (Domain == null)
        {
            return;
        }

        String Source;

        try
        {
            Source = Jsoup.connect(Domain + "/Public/Themes/Grizzly/JS/client.variables.js").get().html(); //Let's get our client var links.
        } catch (IOException e) { return;}

        for(String Line : Source.split("\n")) //Parse line-by-line
        {
             if (Line.contains(" : ") && Line.contains(","))
             {
                String[] KeySplit = Line.split(":");

                ParameterString Debug = new ParameterString("${key} => ${value}");

                Debug.append("key", KeySplit[0].replace('"', ' '));
                Debug.append("value", KeySplit[1].replace('"', ' ').replace(",", ""));

                Grizzly.write(Debug.toString());
                //"site.url" : "http://localhost", = site.url => http://localhost
                Variables.put(KeySplit[0].replace('"', ' '), KeySplit[1].replace('"', ' ').replace(",", ""));
             }
        }

        initTexts();
        initVariables();
    }

    private boolean initTexts()
    {
        String Domain = Variables.get("external.texts.txt");

        String Source;

        try
        {
            Source = Jsoup.connect(Domain).get().html();
        } catch (IOException e) {return false;}

        for(String Line : Source.split("\n")) //Parse line-by-line
        {
            if (Line.contains("="))
            {
                String[] KeySplit = Line.split("=");

                ExternalTexts.put(KeySplit[0], KeySplit[1]);
            }
        }

        return true;
    }

    private boolean initVariables()
    {
        String Domain = Variables.get("external.variables.txt");

        String Source;

        try
        {
            Source = Jsoup.connect(Domain).get().html();
        } catch (IOException e) {return false;}

        for(String Line : Source.split("\n")) //Parse line-by-line
        {
            if (Line.contains("="))
            {
                String[] KeySplit = Line.split("=");

                ExternalVariables.put(KeySplit[0], KeySplit[1]);
            }
        }

        return true;
    }

    public String getVar(String Key)
    {
        return ExternalVariables.get(Key);
    }

    public String getText(String Key)
    {
        return ExternalTexts.get(Key);
    } */
}
