Beispiel #1
0
 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());
     }
 }
Beispiel #2
0
        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));
        }
Beispiel #3
0
 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.CurrentSecondaryAlgorithmType = miningPairs[0].Algorithm.SecondaryNiceHashID;
         this.MinerPath                     = miningPairs[0].Algorithm.MinerBinaryPath;
         this.IsInit = MinerPaths.IsValidMinerPath(this.MinerPath);
     }
 }
Beispiel #4
0
 /// <summary>
 /// Initializes a new instance of the <see cref="MiningDevice"/> class.
 /// </summary>
 /// <param name="device">The <see cref="ComputeDevice"/></param>
 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);
         }
     }
     MostProfitableAlgorithmType = AlgorithmType.NONE;
     MostProfitableMinerBaseType = MinerBaseType.NONE;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="MiningSetup"/> class.
 /// </summary>
 /// <param name="miningPairs">The <see cref="List{MiningPair}"/></param>
 public MiningSetup(List <MiningPair> miningPairs)
 {
     IsInit = false;
     CurrentAlgorithmType = AlgorithmType.NONE;
     if (miningPairs != null && miningPairs.Count > 0)
     {
         MiningPairs = miningPairs;
         MiningPairs.Sort((a, b) => a.Device.ID - b.Device.ID);
         MinerName                     = miningPairs[0].Algorithm.MinerName;
         CurrentAlgorithmType          = miningPairs[0].Algorithm.CryptoMiner937ID;
         CurrentSecondaryAlgorithmType = miningPairs[0].Algorithm.SecondaryCryptoMiner937ID;
         MinerPath                     = miningPairs[0].Algorithm.MinerBinaryPath;
         IsInit = MinerPaths.IsValidMinerPath(MinerPath);
     }
 }