Esempio n. 1
0
    public static bool Load(string filepath = "")
    {
        if (!String.IsNullOrEmpty(filepath))
        {
            FilePath = filepath;
        }

        // build defaults
        if (!File.Exists(Defines.ConfigFile))
        {
            CreateConfigFile();
        }

        configTable = Toml.ReadFile(Defines.ConfigFile).ToDictionary();

        if (File.Exists(Defines.LanguageConfig))
        {
            localizationTable = Toml.ReadFile(Defines.LanguageConfig).ToDictionary();
        }

        // Set the localized language for the rest of the run, unless changed in options
        if (configTable.ContainsKey(Defines.GameConfig))
        {
            Dictionary <string, object> gameOpts = (Dictionary <string, object>)configTable["GameConfig"];
            if (gameOpts.ContainsKey("Language"))
            {
                SetLocalizedLanguage(Convert.ToInt32(gameOpts["Language"]));
            }
        }

        if (configTable.ContainsKey(Defines.TouchConfig))
        {
            TouchSettings.SetConfig((Dictionary <string, object>)configTable[Defines.TouchConfig]);
        }

        IsLoaded = true;
        return(true);
    }
Esempio n. 2
0
    public static bool Load(string filepath = "")
    {
        if (!String.IsNullOrEmpty(filepath))
        {
            FilePath = filepath;
        }

        // build defaults
        if (!File.Exists(Defines.ConfigFile))
        {
            CreateConfigFile();
        }

        configTable = Toml.ReadFile(Defines.ConfigFile).ToDictionary();

        if (configTable.ContainsKey(Defines.TouchConfig))
        {
            TouchSettings.SetConfig((Dictionary <string, object>)configTable[Defines.TouchConfig]);
        }

        IsLoaded = true;
        return(true);
    }