Esempio n. 1
0
        // this checks if there are user settings and returns that if not then it saves the given defaultSettings to a file
        public static MinerSystemEnvironmentVariables InitMinerSystemEnvironmentVariablesSettings(string pluginRoot, MinerSystemEnvironmentVariables defaultSettings)
        {
            var pluginRootIntenrals = Path.Combine(pluginRoot, "internals");
            var settingsPath        = Path.Combine(pluginRootIntenrals, "MinerSystemEnvironmentVariables.json");

            if (File.Exists(settingsPath))
            {
                var fileSettings = ReadFileSettings <MinerSystemEnvironmentVariables>(settingsPath);
                if (fileSettings != null && fileSettings.UseUserSettings)
                {
                    // use file settings
                    return(fileSettings);
                }
            }

            // if we get here then create/override the settings file
            WriteFileSettings(settingsPath, defaultSettings);
            return(null);
        }
Esempio n. 2
0
 /// <summary>
 /// InitMinerSystemEnvironmentVariablesSettings checks if there is MinerSystemEnvironmentVariables json file and returns file settings from it
 /// If there is no file, the new one is generated with default settings
 /// </summary>
 /// <param name="pluginRoot">Represents root path of plugin</param>
 /// <param name="defaultSettings">Represents default settings to write if there are no custom settings available</param>
 public static MinerSystemEnvironmentVariables InitMinerSystemEnvironmentVariablesSettings(string pluginRoot, MinerSystemEnvironmentVariables defaultSettings)
 {
     return(InitInternalSetting(pluginRoot, defaultSettings, "MinerSystemEnvironmentVariables.json"));
 }