Esempio n. 1
0
        public virtual void InitInternals()
        {
            var pluginRoot = Path.Combine(Paths.MinerPluginsPath(), PluginUUID);

            var readFromFileEnvSysVars = InternalConfigs.InitInternalSetting(pluginRoot, MinerSystemEnvironmentVariables, "MinerSystemEnvironmentVariables.json");

            if (readFromFileEnvSysVars != null)
            {
                MinerSystemEnvironmentVariables = readFromFileEnvSysVars;
            }

            var fileMinerOptionsPackage = InternalConfigs.InitInternalSetting(pluginRoot, MinerOptionsPackage, "MinerOptionsPackage.json");

            if (fileMinerOptionsPackage != null)
            {
                MinerOptionsPackage = fileMinerOptionsPackage;
            }

            var fileMinerReservedPorts = InternalConfigs.InitInternalSetting(pluginRoot, MinerReservedApiPorts, "MinerReservedPorts.json");

            if (fileMinerReservedPorts != null)
            {
                MinerReservedApiPorts = fileMinerReservedPorts;
            }

            var fileMinerApiMaxTimeoutSetting = InternalConfigs.InitInternalSetting(pluginRoot, GetApiMaxTimeoutConfig, "MinerApiMaxTimeoutSetting.json");

            if (fileMinerApiMaxTimeoutSetting != null)
            {
                GetApiMaxTimeoutConfig = fileMinerApiMaxTimeoutSetting;
            }

            var fileMinerBenchmarkTimeSettings = InternalConfigs.InitInternalSetting(pluginRoot, MinerBenchmarkTimeSettings, "MinerBenchmarkTimeSettings.json");

            if (fileMinerBenchmarkTimeSettings != null)
            {
                MinerBenchmarkTimeSettings = fileMinerBenchmarkTimeSettings;
            }

            var fileMinersBinsUrlsSettings = InternalConfigs.InitInternalSetting(pluginRoot, MinersBinsUrlsSettings, "MinersBinsUrlsSettings.json");

            if (fileMinersBinsUrlsSettings != null)
            {
                MinersBinsUrlsSettings = fileMinersBinsUrlsSettings;
            }

            var filePluginSupportedAlgorithmsSettings = InternalConfigs.InitInternalSetting(pluginRoot, PluginSupportedAlgorithmsSettings, "PluginSupportedAlgorithmsSettings.json");

            if (filePluginSupportedAlgorithmsSettings != null)
            {
                PluginSupportedAlgorithmsSettings = filePluginSupportedAlgorithmsSettings;
            }

            var fileMinerCustomActionSettings = InternalConfigs.InitInternalSetting(pluginRoot, MinerCustomActionSettings, "MinerCustomActionSettings.json");

            if (fileMinerCustomActionSettings != null)
            {
                MinerCustomActionSettings = fileMinerCustomActionSettings;
            }
        }
Esempio n. 2
0
        static SupportedAlgorithmsFilter()
        {
            var fileSettings = InternalConfigs.InitInternalSetting(Paths.Root, _settings, "SupportedAlgorithmsFilter.json");

            if (fileSettings != null)
            {
                _settings = fileSettings;
            }
        }
        static BenchmarkProcessSettings()
        {
            var fileSettings = InternalConfigs.InitInternalSetting(Paths.Root, _settingsGlobal, "GlobalBenchmarkExceptions.json");

            if (fileSettings != null)
            {
                _settingsGlobal = fileSettings;
            }
        }
        static MinerPluginsUpdaterSettings()
        {
            var fileSettings = InternalConfigs.InitInternalSetting(Paths.Root, _settings, "MinerPluginsUpdaterSettings.json");

            if (fileSettings != null)
            {
                _settings = fileSettings;
            }
        }
Esempio n. 5
0
        protected void InitInsideConstuctorPluginSupportedAlgorithmsSettings()
        {
            PluginSupportedAlgorithmsSettings = DefaultPluginSupportedAlgorithmsSettings;
            if (IS_CALLED_FROM_PACKER)
            {
                return;
            }
            var pluginRoot = Path.Combine(Paths.MinerPluginsPath(), PluginUUID);
            var filePluginSupportedAlgorithmsSettings = InternalConfigs.InitInternalSetting(pluginRoot, PluginSupportedAlgorithmsSettings, "PluginSupportedAlgorithmsSettings.json");

            if (filePluginSupportedAlgorithmsSettings != null)
            {
                PluginSupportedAlgorithmsSettings = filePluginSupportedAlgorithmsSettings;
            }
        }
        public virtual void InitInternals()
        {
            if (_init)
            {
                return;
            }
            // set ethlargement path
            _ethlargementBinPath = EthlargementBinPath();
            _ethlargementCwdPath = EthlargementCwdPath();

            var pluginRoot = Path.Combine(Paths.MinerPluginsPath(), PluginUUID);

            var fileMinersBinsUrlsSettings = InternalConfigs.InitInternalSetting(pluginRoot, MinersBinsUrlsSettings, "MinersBinsUrlsSettings.json");

            if (fileMinersBinsUrlsSettings != null)
            {
                MinersBinsUrlsSettings = fileMinersBinsUrlsSettings;
            }

            var readFromFileEnvSysVars = InternalConfigs.InitInternalSetting(pluginRoot, _ethlargementSettings, "EthlargementSettings.json");

            if (readFromFileEnvSysVars != null && readFromFileEnvSysVars.UseUserSettings)
            {
                _ethlargementSettings = readFromFileEnvSysVars;
            }

            // Filter out supported ones
            var supportedDevicesNames = _ethlargementSettings.SupportedDeviceNames;

            if (supportedDevicesNames != null)
            {
                Func <string, bool> isSupportedName = (string name) => supportedDevicesNames.Any(supportedPart => name.Contains(supportedPart));

                var unsupportedDevicesUUIDs = _registeredSupportedDevices.Where(kvp => !isSupportedName(kvp.Value)).Select(kvp => kvp.Key).ToArray();
                foreach (var removeKey in unsupportedDevicesUUIDs)
                {
                    _registeredSupportedDevices.Remove(removeKey);
                }
            }
            if (_ethlargementSettings.SupportedAlgorithms != null)
            {
                _supportedAlgorithms = _ethlargementSettings.SupportedAlgorithms;
            }
            OnPropertyChanged(nameof(SystemContainsSupportedDevices));
            OnPropertyChanged(nameof(SystemContainsSupportedDevicesNotSystemElevated));
        }
        }                                     // STUB

        public void InitAndCheckSupportedDevices(IEnumerable <BaseDevice> devices)
        {
            // set ethlargement path
            _ethlargementBinPath = EthlargementBinPath();
            _ethlargementCwdPath = EthlargementCwdPath();

            // copy EthLargement binary
            try
            {
                var oldPath = EthlargementOldBinPath();
                if (File.Exists(oldPath) && !File.Exists(_ethlargementBinPath))
                {
                    if (!Directory.Exists(_ethlargementCwdPath))
                    {
                        Directory.CreateDirectory(_ethlargementCwdPath);
                    }
                    File.Copy(oldPath, _ethlargementBinPath);
                }
            }
            catch
            {}


            var pluginRoot = Path.Combine(Paths.MinerPluginsPath(), PluginUUID);

            var fileMinersBinsUrlsSettings = InternalConfigs.InitInternalSetting(pluginRoot, MinersBinsUrlsSettings, "MinersBinsUrlsSettings.json");

            if (fileMinersBinsUrlsSettings != null)
            {
                MinersBinsUrlsSettings = fileMinersBinsUrlsSettings;
            }

            var readFromFileEnvSysVars = InternalConfigs.InitInternalSetting(pluginRoot, _ethlargementSettings, "EthlargementSettings.json");

            if (readFromFileEnvSysVars != null && readFromFileEnvSysVars.UseUserSettings)
            {
                _ethlargementSettings = readFromFileEnvSysVars;
            }

            // Filter out supported ones
            _registeredSupportedDevices = new Dictionary <string, string>();
            devices.Where(dev => IsSupportedDeviceName(dev.Name)).ToList().ForEach(dev => _registeredSupportedDevices[dev.UUID] = dev.Name);
            OnPropertyChanged(nameof(SystemContainsSupportedDevices));
            OnPropertyChanged(nameof(SystemContainsSupportedDevicesNotSystemElevated));
        }