Exemple #1
0
 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);
 }
Exemple #2
0
        //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;
                    }
                }
            }
        }
Exemple #3
0
 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));
 }
Exemple #6
0
 public static bool IsValidMinerPath(ComputeDevice device, Algorithm algo)
 {
     return(MinerPaths.NONE != MinerPaths.GetOptimizedMinerPath(device, algo));
 }