Esempio n. 1
0
        public void StartMining(Data.Configuration.Engine engineConfiguration, List <Xgminer.Data.Device> devices, List <CoinInformation> coinInformation, int donationPercent)
        {
            StopMining();

            startingMining = true;
            try
            {
                this.engineConfiguration = engineConfiguration;
                this.devices             = devices;
                this.donationPercent     = donationPercent;

                if (coinInformation != null) //null if no network connection
                {
                    ApplyMiningStrategy(coinInformation);
                }

                if (!mining) //above call to ApplyMiningStrategy may have started mining due to config change
                {
                    StartMining();
                }

                mining = true;
            }
            finally
            {
                startingMining = false;
            }
        }
Esempio n. 2
0
        public void StartMining(Data.Configuration.Engine engineConfiguration, List<Xgminer.Data.Device> devices, List<CoinInformation> coinInformation, int donationPercent)
        {
            StopMining();

            startingMining = true;
            try
            {
                this.engineConfiguration = engineConfiguration;
                this.devices = devices;
                this.backendVersion = new Version(Xgminer.Installer.GetInstalledMinerVersion(MinerPath.GetPathToInstalledMiner()));
                this.donationPercent = donationPercent;

                if (coinInformation != null) //null if no network connection
                    ApplyMiningStrategy(coinInformation);

                if (!mining) //above call to ApplyMiningStrategy may have started mining due to config change
                    StartMining();

                mining = true;
            }
            finally
            {
                startingMining = false;
            }
        }
Esempio n. 3
0
        private void SetCoinConfigurationsRequested(object sender, Engine.Data.Configuration.Coin[] coinConfigurations, RemoteCommandEventArgs ea)
        {
            PerformRequestedCommand(ea.IpAddress, ea.Signature, () =>
            {
                ObjectCopier.CopyObject(coinConfigurations, this.engineConfiguration.CoinConfigurations);
                this.engineConfiguration.SaveCoinConfigurations();

                BeginInvoke((Action)(() =>
                {
                    //code to update UI
                    localViewModel.ApplyCoinConfigurationModels(engineConfiguration.CoinConfigurations);
                    localViewModel.ApplyDeviceConfigurationModels(engineConfiguration.DeviceConfigurations,
                        engineConfiguration.CoinConfigurations);
                    RefreshViewForConfigurationChanges();
                }));
            });
        }
Esempio n. 4
0
 private void SetCoinConfigurationOnAllRigs(Engine.Data.Configuration.Coin[] coinConfigurations)
 {
     //call ToList() so we can get a copy - otherwise risk:
     //System.InvalidOperationException: Collection was modified; enumeration operation may not execute.
     List<Instance> instancesCopy = instancesControl.Instances.Where(i => i != instancesControl.ThisPCInstance).ToList();
     foreach (Instance instance in instancesCopy)
     {
         PerformRemoteCommand(instance, (service) =>
         {
             service.SetCoinConfigurations(GetSendingSignature(instance), coinConfigurations);
         });
     }
 }
Esempio n. 5
0
        private static string GetPoolNameByIndex(Engine.Data.Configuration.Coin coinConfiguration, int poolIndex)
        {
            string result = String.Empty;

            if (poolIndex >= 0)
            {
                if (coinConfiguration != null)
                {
                    //the poolIndex may be greater than the Pools count if donating
                    if (poolIndex < coinConfiguration.Pools.Count)
                    {
                        result = coinConfiguration.Pools[poolIndex].Host;
                    }
                }
            }

            return result;
        }
Esempio n. 6
0
 private bool DeviceConfigurationValid(Engine.Data.Configuration.Device deviceConfiguration)
 {
     bool result = deviceConfiguration.Enabled && !string.IsNullOrEmpty(deviceConfiguration.CoinSymbol);
     if (result)
     {
         Engine.Data.Configuration.Coin coinConfiguration = engineConfiguration.CoinConfigurations.SingleOrDefault(cc => cc.CryptoCoin.Symbol.Equals(deviceConfiguration.CoinSymbol, StringComparison.OrdinalIgnoreCase));
         result = coinConfiguration == null ? false : coinConfiguration.Pools.Count > 0;
     }
     return result;
 }
 private bool DeviceConfigurationValid(Engine.Data.Configuration.Device deviceConfiguration)
 {
     bool result = deviceConfiguration.Enabled && !string.IsNullOrEmpty(deviceConfiguration.CoinSymbol);
     if (result)
     {
         Coin coinConfiguration = EngineConfiguration.CoinConfigurations.SingleOrDefault(cc => cc.PoolGroup.Id.Equals(deviceConfiguration.CoinSymbol, StringComparison.OrdinalIgnoreCase));
         result = coinConfiguration != null && coinConfiguration.Pools.Any(p => !String.IsNullOrEmpty(p.Host) && !String.IsNullOrEmpty(p.Username));
     }
     return result;
 }