public static Tuple <ComputeDevice, DeviceMiningStatus> getDeviceMiningStatus(ComputeDevice device) { DeviceMiningStatus status = DeviceMiningStatus.CanMine; if (device == null) // C# is null happy { status = DeviceMiningStatus.DeviceNull; } else if (device.Enabled == false) { status = DeviceMiningStatus.Disabled; } else { bool hasEnabledAlgo = false; foreach (Algorithm algo in device.GetAlgorithmSettings()) { hasEnabledAlgo |= IsAlgoMiningCapable(algo) && MinerPaths.IsValidMinerPath(algo.MinerBinaryPath); } if (hasEnabledAlgo == false) { status = DeviceMiningStatus.NoEnabledAlgorithms; } } return(new Tuple <ComputeDevice, DeviceMiningStatus>(device, status)); }
private static void LogMiningNonMiningStatuses(List <MiningDevice> enabledDevices, List <Tuple <ComputeDevice, DeviceMiningStatus> > disabledDevicesStatuses) { // print statuses if (disabledDevicesStatuses.Count > 0) { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(""); stringBuilder.AppendLine("Disabled Devices:"); foreach (var deviceStatus in disabledDevicesStatuses) { stringBuilder.AppendLine("\t" + GetDisabledDeviceStatusString(deviceStatus)); } Helpers.ConsolePrint(TAG, stringBuilder.ToString()); } if (enabledDevices.Count > 0) { // print enabled StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine(""); stringBuilder.AppendLine("Enabled Devices for Mining session:"); foreach (var miningDevice in enabledDevices) { var device = miningDevice.Device; stringBuilder.AppendLine(String.Format("\tENABLED ({0})", device.GetFullName())); foreach (var algo in device.GetAlgorithmSettings()) { var isEnabled = IsAlgoMiningCapable(algo) && MinerPaths.IsValidMinerPath(algo.MinerBinaryPath); stringBuilder.AppendLine(String.Format("\t\tALGORITHM {0} ({1})", isEnabled ? "ENABLED " : "DISABLED", // ENABLED/DISABLED algo.AlgorithmStringID)); } } Helpers.ConsolePrint(TAG, stringBuilder.ToString()); } }
public MiningAlgorithm(ComputeDevice dev, Algorithm algo) { this.AlgoRef = algo; // init speed that will be avaraged later this.AvaragedSpeed = algo.BenchmarkSpeed; this.MinerPath = MinerPaths.GetOptimizedMinerPath(dev, algo); }
//private string _miningLocation = ""; //private string _btcAdress = ""; //private string _worker = ""; // , string miningLocation, string btcAdress, string worker public GroupMiner(List <MiningPair> miningPairs, string key) { AlgorithmType = AlgorithmType.NONE; DevicesInfoString = "N/A"; CurrentRate = 0; Key = key; if (miningPairs.Count > 0) { // sort pairs by device id miningPairs.Sort((a, b) => a.Device.ID - b.Device.ID); // init name scope { List <string> deviceNames = new List <string>(); foreach (var pair in miningPairs) { deviceNames.Add(pair.Device.NameCount); } DevicesInfoString = "{ " + string.Join(", ", deviceNames) + " }"; } // init miner { var mPair = miningPairs[0]; DeviceType = mPair.Device.DeviceType; Miner = MinersManager.CreateMiner(mPair.Device.DeviceType, MinerPaths.GetOptimizedMinerPath(mPair)); if (Miner != null) { Miner.InitMiningSetup(new MiningSetup(miningPairs)); AlgorithmType = mPair.Algorithm.NiceHashID; } } } }
public MiningDevice(ComputeDevice device) { Device = device; foreach (var algo in Device.GetAlgorithmSettings()) { bool isAlgoMiningCapable = GroupSetupUtils.IsAlgoMiningCapable(algo); bool isValidMinerPath = MinerPaths.IsValidMinerPath(algo.MinerBinaryPath); if (isAlgoMiningCapable && isValidMinerPath) { Algorithms.Add(algo); } } }
public MiningSetup(List <MiningPair> miningPairs) { this.IsInit = false; this.CurrentAlgorithmType = AlgorithmType.NONE; if (miningPairs != null && miningPairs.Count > 0) { this.MiningPairs = miningPairs; this.MiningPairs.Sort((a, b) => a.Device.ID - b.Device.ID); this.MinerName = miningPairs[0].Algorithm.MinerName; this.CurrentAlgorithmType = miningPairs[0].Algorithm.NiceHashID; this.MinerPath = miningPairs[0].Algorithm.MinerBinaryPath; this.IsInit = MinerPaths.IsValidMinerPath(this.MinerPath); } }
public MiningDevice(ComputeDevice device) { Device = device; foreach (var algo in Device.GetAlgorithmSettings()) { var isAlgoMiningCapable = GroupSetupUtils.IsAlgoMiningCapable(algo); var isValidMinerPath = MinerPaths.IsValidMinerPath(algo.MinerBinaryPath); if (isAlgoMiningCapable && isValidMinerPath) { Algorithms.Add(algo); } } MostProfitableAlgorithmType = AlgorithmType.NONE; MostProfitableMinerBaseType = MinerBaseType.NONE; }
public MiningSetup(List <MiningPair> miningPairs) { IsInit = false; CurrentAlgorithmType = AlgorithmType.NONE; if (miningPairs == null || miningPairs.Count <= 0) { return; } MiningPairs = miningPairs; MiningPairs.Sort((a, b) => a.Device.ID - b.Device.ID); MinerName = miningPairs[0].Algorithm.MinerName; CurrentAlgorithmType = miningPairs[0].Algorithm.NiceHashID; CurrentSecondaryAlgorithmType = miningPairs[0].Algorithm.SecondaryNiceHashID; MinerPath = miningPairs[0].Algorithm.MinerBinaryPath; IsInit = MinerPaths.IsValidMinerPath(MinerPath); }
public MiningSetup(List <MiningPair> miningPairs) { this.IsInit = false; this.CurrentAlgorithmType = AlgorithmType.NONE; if (miningPairs != null && miningPairs.Count > 0) { this.MinerPath = MinerPaths.GetOptimizedMinerPath(miningPairs[0]); if (this.MinerPath != MinerPaths.NONE) { this.MiningPairs = miningPairs; this.MiningPairs.Sort((a, b) => a.Device.ID - b.Device.ID); this.MinerName = miningPairs[0].Algorithm.MinerName; this.CurrentAlgorithmType = miningPairs[0].Algorithm.NiceHashID; this.IsInit = true; } } }
public static bool ShouldGroup(MiningPair a, MiningPair b) { // group if same bin path and same algo type if (IsSameBinPath(a, b) && IsSameAlgorithmType(a, b)) { AlgorithmType algorithmType = a.Algorithm.NiceHashID; // AlgorithmType.Equihash is special case if (AlgorithmType.Equihash == algorithmType) { string minerPath = MinerPaths.GetOptimizedMinerPath(a); return(EquihashGroup.IsEquihashGroupLogic(minerPath, a, b)); } // all other algorithms are grouped if DeviceType is same and is not CPU else if (IsNotCpuGroups(a, b) && IsSameDeviceType(a, b)) { return(true); } } return(false); }
private static bool IsSameBinPath(MiningPair a, MiningPair b) { return(MinerPaths.GetOptimizedMinerPath(a) == MinerPaths.GetOptimizedMinerPath(b)); }
public static Tuple <ComputeDevice, DeviceMiningStatus> GetDeviceMiningStatus(ComputeDevice device) { var status = DeviceMiningStatus.CanMine; if (device == null) { // C# is null happy status = DeviceMiningStatus.DeviceNull; } else if (device.Enabled == false) { status = DeviceMiningStatus.Disabled; } else { var hasEnabledAlgo = device.GetAlgorithmSettings().Aggregate(false, (current, algo) => current | (IsAlgoMiningCapable(algo) && MinerPaths.IsValidMinerPath(algo.MinerBinaryPath))); if (hasEnabledAlgo == false) { status = DeviceMiningStatus.NoEnabledAlgorithms; } } return(new Tuple <ComputeDevice, DeviceMiningStatus>(device, status)); }
public static bool IsValidMinerPath(ComputeDevice device, Algorithm algo) { return(MinerPaths.NONE != MinerPaths.GetOptimizedMinerPath(device, algo)); }