コード例 #1
0
        public async Task DevicesCrossReference(IEnumerable <BaseDevice> devices)
        {
#if DISABLE_IDevicesCrossReference
            await Task.CompletedTask;
#else
#warning Blocks exit. Check if this is fixed with newer versions
            //return;
            try
            {
                if (_mappedIDs.Count == 0)
                {
                    return;
                }
                // TODO will break
                var minerBinPath = GetBinAndCwdPaths().Item1;
                var output       = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--device-info-json --no-watchdog"); // AMD + NVIDIA

                var mappedDevs = DevicesListParser.ParseNBMinerOutput(output, devices.ToList());

                foreach (var kvp in mappedDevs)
                {
                    var uuid    = kvp.Key;
                    var indexID = kvp.Value;
                    _mappedIDs[uuid] = indexID;
                }
            } catch (Exception ex)
            {
                Logger.Error("NBMiner", $"Error during DevicesCrossReference: {ex.Message}");
            }
#endif
        }
コード例 #2
0
        public async Task DevicesCrossReference(IEnumerable <BaseDevice> devices)
        {
            if (_mappedIDs.Count == 0)
            {
                return;
            }
            // TODO will break
            var miner = CreateMiner() as IBinAndCwdPathsGettter;

            if (miner == null)
            {
                return;
            }
            var minerBinPath = miner.GetBinAndCwdPaths().Item1;
            var output       = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--device-info-json -RUN");

            var mappedDevs = DevicesListParser.ParseNBMinerOutput(output, devices.ToList());

            foreach (var kvp in mappedDevs)
            {
                var uuid    = kvp.Key;
                var indexID = kvp.Value;
                _mappedIDs[uuid] = indexID;
            }
        }
コード例 #3
0
        public async Task DevicesCrossReference(IEnumerable <BaseDevice> devices)
        {
            try
            {
                if (_mappedIDs.Count == 0)
                {
                    return;
                }
                // TODO will break
                var minerBinPath = GetBinAndCwdPaths().Item1;
                var output       = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--device-info-json --no-watchdog"); // AMD + NVIDIA

                var mappedDevs = DevicesListParser.ParseNBMinerOutput(output, devices.ToList());

                foreach (var kvp in mappedDevs)
                {
                    var uuid    = kvp.Key;
                    var indexID = kvp.Value;
                    _mappedIDs[uuid] = indexID;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("NBMiner", $"Error during DevicesCrossReference: {ex.Message}");
            }
        }
コード例 #4
0
        public async Task DevicesCrossReference(IEnumerable <BaseDevice> devices)
        {
            try
            {
                if (_mappedIDs.Count == 0)
                {
                    return;
                }
                var(minerBinPath, minerCwdPath) = GetBinAndCwdPaths();
                var output = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--device-info-json --no-watchdog"); // AMD + NVIDIA

                var dumpFile = $"d{DateTime.UtcNow.Ticks}.txt";
                try
                {
                    File.WriteAllText(Path.Combine(minerCwdPath, dumpFile), output);
                }
                catch (Exception e)
                {
                    Logger.Error("NBMiner", $"DevicesCrossReference error creating dump file ({dumpFile}): {e.Message}");
                }
                var mappedDevs = DevicesListParser.ParseNBMinerOutput(output, devices);

                foreach (var(uuid, indexID) in mappedDevs.Select(kvp => (kvp.Key, kvp.Value)))
                {
                    _mappedIDs[uuid] = indexID;
                }
            }
            catch (Exception ex)
            {
                Logger.Error("NBMiner", $"Error during DevicesCrossReference: {ex.Message}");
            }
        }
コード例 #5
0
        public async Task DevicesCrossReference(IEnumerable <BaseDevice> devices)
        {
#if DISABLE_IDevicesCrossReference
            await Task.CompletedTask;
#else
#warning Blocks exit. Check if this is fixed with newer versions
            return;

            if (_mappedIDs.Count == 0)
            {
                return;
            }
            // TODO will break
            var minerBinPath = GetBinAndCwdPaths().Item1;
            var output       = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--device-info-json --no-watchdog --platform 1"); // NVIDIA only

            var mappedDevs = DevicesListParser.ParseNBMinerOutput(output, devices.ToList());

            foreach (var kvp in mappedDevs)
            {
                var uuid    = kvp.Key;
                var indexID = kvp.Value;
                _mappedIDs[uuid] = indexID;
            }
#endif
        }
コード例 #6
0
        public async Task DevicesCrossReference(IEnumerable <BaseDevice> devices)
        {
#warning Blocks exit
            return;

            if (_mappedIDs.Count == 0)
            {
                return;
            }
            // TODO will break
            var minerBinPath = GetBinAndCwdPaths().Item1;
            var output       = await DevicesCrossReferenceHelpers.MinerOutput(minerBinPath, "--device-info-json --no-watchdog");

            var mappedDevs = DevicesListParser.ParseNBMinerOutput(output, devices.ToList());

            foreach (var kvp in mappedDevs)
            {
                var uuid    = kvp.Key;
                var indexID = kvp.Value;
                _mappedIDs[uuid] = indexID;
            }
        }