Exemple #1
0
 public void AddCpuMiner(cpuminer miner, int deviceID, string deviceName)
 {
     _cpuMiners.Add(miner.MinerDeviceName, miner);
 }
Exemple #2
0
        public bool StartInitialize(IMainFormRatesComunication mainFormRatesComunication,
                                    string miningLocation, string worker, string btcAdress)
        {
            _mainFormRatesComunication = mainFormRatesComunication;
            _miningLocation            = miningLocation;
            _worker    = worker;
            _btcAdress = btcAdress;

            if (_worker.Length > 0)
            {
                _workerBtcStringWorker = _btcAdress + "." + _worker;
            }
            else
            {
                _workerBtcStringWorker = _btcAdress;
            }

            _perDeviceSpeedDictionary = GetEnabledDeviceTypeSpeeds();
            //_groupedDevicesMiners = new Dictionary<GroupedDevices, GroupMiners>();
            _groupedDevicesMiners     = new Dictionary <string, GroupMiners>();
            _enabledDevices           = new List <ComputeDevice>();
            _currentAllGroupedDevices = new AllGroupedDevices();

            // assume profitable
            IsProfitable = true;


            // this checks if there are enabled devices and enabled algorithms
            bool isMiningEnabled = false;

            foreach (var cdev in ComputeDevice.AllAvaliableDevices)
            {
                if (cdev.Enabled)
                {
                    _enabledDevices.Add(cdev);
                    // check if in CPU group and add the saved CPU miners
                    if (cdev.DeviceGroupType == DeviceGroupType.CPU)
                    {
                        GroupedDevices gdevs = new GroupedDevices();
                        gdevs.Add(cdev.UUID);
                        cpuminer      miner         = _cpuMiners[cdev.Group];
                        CpuGroupMiner cpuGroupMiner = new CpuGroupMiner(gdevs, miner);
                        _groupedDevicesMiners.Add(CalcGroupedDevicesKey(gdevs), cpuGroupMiner);
                    }
                    // check if any algorithm enabled
                    if (!isMiningEnabled)
                    {
                        foreach (var algorithm in cdev.DeviceBenchmarkConfig.AlgorithmSettings)
                        {
                            if (!algorithm.Value.Skip)
                            {
                                isMiningEnabled = true;
                                break;
                            }
                        }
                    }
                }
            }

            if (isMiningEnabled)
            {
                _preventSleepTimer.Start();
            }

            IsCurrentlyIdle = !isMiningEnabled;

            return(isMiningEnabled);
        }
 public CpuGroupMiner(GroupedDevices deviceUUIDSet, cpuminer miner)
     : base(deviceUUIDSet)
 {
     _miners.Add(miner);
 }