/// <summary>
        /// InitMinerReservedPorts checks if there is MinerReservedPorts json file and returns MinerReservedPorts <see cref="MinerReservedPorts"/> from it
        /// If file doesn't exist or UseUserSettings equals false, the new file is generated with settings from parameter <paramref name="minerReservedPorts"/>
        /// </summary>
        /// <param name="pluginRoot">Represents root path of plugin</param>
        /// <param name="minerReservedPorts">Represents MinerReservedPorts that will be written to file if the file doesn't exist and UseUserSettings equals false</param>
        /// <returns></returns>
        public static MinerReservedPorts InitMinerReservedPorts(string pluginRoot, MinerReservedPorts minerReservedPorts)
        {
            var pluginRootIntenrals     = Path.Combine(pluginRoot, "internals");
            var minerOptionsPackagePath = Path.Combine(pluginRootIntenrals, "MinerReservedPorts.json");
            var fileMinerOptionsPackage = ReadFileSettings <MinerReservedPorts>(minerOptionsPackagePath);

            if (fileMinerOptionsPackage != null && fileMinerOptionsPackage.UseUserSettings)
            {
                return(fileMinerOptionsPackage);
            }
            else
            {
                WriteFileSettings(minerOptionsPackagePath, minerReservedPorts);
                return(null);
            }
        }
Exemple #2
0
 /// <summary>
 /// InitMinerReservedPorts checks if there is MinerReservedPorts json file and returns MinerReservedPorts <see cref="MinerReservedPorts"/> from it
 /// If file doesn't exist or UseUserSettings equals false, the new file is generated with settings from parameter <paramref name="minerReservedPorts"/>
 /// </summary>
 /// <param name="pluginRoot">Represents root path of plugin</param>
 /// <param name="minerReservedPorts">Represents MinerReservedPorts that will be written to file if the file doesn't exist and UseUserSettings equals false</param>
 /// <returns></returns>
 public static MinerReservedPorts InitMinerReservedPorts(string pluginRoot, MinerReservedPorts minerReservedPorts)
 {
     return(InitInternalSetting(pluginRoot, minerReservedPorts, "MinerReservedPorts.json"));
 }