Exemplo n.º 1
0
 private void RemoveDeletedCoinsFromDeviceConfigurations()
 {
     foreach (Device deviceConfiguration in DeviceConfigurations)
     {
         if (CoinConfigurations.Count(c => c.PoolGroup.Id.Equals(deviceConfiguration.CoinSymbol)) == 0)
         {
             deviceConfiguration.CoinSymbol = string.Empty;
         }
     }
 }
Exemplo n.º 2
0
 private void RemoveDisabledCoinsFromDeviceConfigurations()
 {
     foreach (Coin coinConfiguration in CoinConfigurations.Where(c => !c.Enabled))
     {
         IEnumerable <Device> coinDeviceConfigurations = DeviceConfigurations.Where(c => !String.IsNullOrEmpty(c.CoinSymbol) && c.CoinSymbol.Equals(coinConfiguration.PoolGroup.Id));
         foreach (Device coinDeviceConfiguration in coinDeviceConfigurations)
         {
             coinDeviceConfiguration.CoinSymbol = string.Empty;
         }
     }
 }
Exemplo n.º 3
0
 private void RemoveDisabledCoinsFromDeviceConfigurations()
 {
     foreach (CoinConfiguration coinConfiguration in CoinConfigurations.Where(c => !c.Enabled))
     {
         IEnumerable <DeviceConfiguration> coinDeviceConfigurations = DeviceConfigurations.Where(c => c.CoinSymbol.Equals(coinConfiguration.Coin.Symbol));
         foreach (DeviceConfiguration coinDeviceConfiguration in coinDeviceConfigurations)
         {
             coinDeviceConfiguration.CoinSymbol = string.Empty;
         }
     }
 }
Exemplo n.º 4
0
        //configurations save with algorithm FullName instead of Name
        private void FixWrongAlgorithmsFromCoinWarz()
        {
            List <CoinAlgorithm> algorithms = MinerFactory.Instance.Algorithms;
            IEnumerable <Coin>   issues     = CoinConfigurations.Where(
                cc => algorithms.Any(a => a.FullName.Equals(cc.PoolGroup.Algorithm, StringComparison.OrdinalIgnoreCase) &&
                                     !a.Name.Equals(cc.PoolGroup.Algorithm, StringComparison.OrdinalIgnoreCase)));

            foreach (Coin issue in issues)
            {
                CoinAlgorithm algorithm = algorithms.Single(a => a.FullName.Equals(issue.PoolGroup.Algorithm, StringComparison.OrdinalIgnoreCase));
                issue.PoolGroup.Algorithm = algorithm.Name;
            }
        }
Exemplo n.º 5
0
        //configurations saved with algorithm Name with spaces
        private void FixWrongAlgorithmsFromCoinChoose()
        {
            IEnumerable <Coin> potentialIssues = CoinConfigurations.Where(cc => !cc.PoolGroup.Algorithm.Replace(" ", String.Empty).Equals(cc.PoolGroup.Algorithm));

            foreach (Coin potentialIssue in potentialIssues)
            {
                string        algorithmName = potentialIssue.PoolGroup.Algorithm.Replace(" ", String.Empty);
                CoinAlgorithm algorithm     = MinerFactory.Instance.GetAlgorithm(algorithmName);
                if (algorithm != null)
                {
                    //only make the change if there is an algorithm found
                    //a user may add an algorithm with a space in the name - we don't want to change that
                    potentialIssue.PoolGroup.Algorithm = algorithm.Name;
                }
            }
        }
Exemplo n.º 6
0
        private void FixCoinConfigurationSymbolDiscrepencies()
        {
            Coin badConfiguration = CoinConfigurations.SingleOrDefault(c => c.PoolGroup.Id.Equals(KnownCoins.BadDogecoinSymbol, StringComparison.OrdinalIgnoreCase));

            if (badConfiguration != null)
            {
                Coin goodConfiguration = CoinConfigurations.SingleOrDefault(c => c.PoolGroup.Id.Equals(KnownCoins.DogecoinSymbol, StringComparison.OrdinalIgnoreCase));

                if (goodConfiguration == null)
                {
                    badConfiguration.PoolGroup.Id = KnownCoins.DogecoinSymbol;
                }
                else
                {
                    CoinConfigurations.Remove(badConfiguration);
                }

                SaveCoinConfigurations();
            }
        }