Example #1
0
        private void saveButton_Click(object sender, EventArgs e)
        {
            PoolGroup knownCoin = null;
            if (coinCombo.SelectedIndex >= 0)
                knownCoin = filteredCoins[coinCombo.SelectedIndex];
            
            if (knownCoin == null)
            {
                PoolGroup newCoin = new PoolGroup();
                newCoin.Name = coinCombo.Text;
                newCoin.Algorithm = GetSelectedAlgorithm().Name;

                using (CoinEditForm coinEditForm = new CoinEditForm(newCoin))
                {
                    if (coinEditForm.ShowDialog() == System.Windows.Forms.DialogResult.OK)
                        SelectedCoin = newCoin;
                    else
                        DialogResult = System.Windows.Forms.DialogResult.Cancel;
                }
            }
            else
            {
                SelectedCoin = knownCoin;
            }
        }
 private void saveButton_Click(object sender, EventArgs e)
 {
     PoolGroup result = new PoolGroup();
     string multipoolAlgorithm = GetSelectedAlgorithm().Name;
     string multipoolApi = multipoolCombo.Text;
     result.Algorithm = multipoolAlgorithm;
     result.Name = multipoolApi + " - " + multipoolAlgorithm.ToSpaceDelimitedWords();
     result.Id = multipoolApi + ":" + multipoolAlgorithm;
     result.Kind = PoolGroup.PoolGroupKind.MultiCoin;
     SelectedMultipool = result;
 }
Example #3
0
        private Engine.Data.Configuration.Coin AddCoinConfiguration(PoolGroup poolGroup)
        {
            //don't allow two configurations for the same coin symbol
            Engine.Data.Configuration.Coin configuration = configurations.SingleOrDefault(c => c.PoolGroup.Id.Equals(poolGroup.Id, StringComparison.OrdinalIgnoreCase));
            if (configuration == null)
                //don't allow two configurations for the same coin name
                configuration = configurations.SingleOrDefault(c => c.PoolGroup.Name.Equals(poolGroup.Name, StringComparison.OrdinalIgnoreCase));

            if (configuration != null)
            {
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }
            else
            {
                configuration = new Engine.Data.Configuration.Coin();

                configuration.PoolGroup = knownCoins.SingleOrDefault(c => c.Id.Equals(poolGroup.Id, StringComparison.OrdinalIgnoreCase));

                //user may have manually entered a coin or may be using a Multipool
                if (configuration.PoolGroup == null)
                {
                    configuration.PoolGroup = new PoolGroup();
                    ObjectCopier.CopyObject(poolGroup, configuration.PoolGroup);
                }

                //at this point, configuration.CryptoCoin.Algorithm MAY be the CoinAlgorithm.FullName
                //that is how data from Coin API is stored
                //but coin configurations are based on CoinAlgorithm.Name
                CoinAlgorithm algorithm = MinerFactory.Instance.Algorithms.SingleOrDefault(a => 
                    a.FullName.Equals(configuration.PoolGroup.Algorithm, StringComparison.OrdinalIgnoreCase));
                if (algorithm != null)
                    configuration.PoolGroup.Algorithm = algorithm.Name;

                MiningPool miningPool = new MiningPool()
                {
                    Host = UX.Data.Configuration.PoolDefaults.HostPrefix,
                    Port = UX.Data.Configuration.PoolDefaults.Port
                };
                configuration.Pools.Add(miningPool);

                configurations.Add(configuration);

                coinListBox.Items.Add(configuration.PoolGroup.Name);
                coinListBox.SelectedIndex = configurations.IndexOf(configuration);
            }

            hostEdit.Focus();
            hostEdit.SelectionStart = hostEdit.SelectionLength;

            return configuration;
        }
 public MultipoolChooseForm(PoolGroup currentMultipool)
 {
     InitializeComponent();
     this.currentMultipool = currentMultipool;
 }
        public void GetApplicationModels(
            RemotingService sender,
            string clientAddress,
            string signature,
            out Data.Transfer.Device[] devices,
            out PoolGroup[] configurations,
            out bool mining,
            out bool hasChanges,
            out bool dynamicIntensity)
        {
            ModelEventArgs ea = new ModelEventArgs();
            ea.IpAddress = clientAddress;
            ea.Signature = signature;

            if (GetModelRequested != null)
                GetModelRequested(sender, ea);

            devices = ea.Devices.ToArray();
            configurations = ea.ConfiguredCoins.ToArray();
            mining = ea.Mining;
            hasChanges = ea.HasChanges;
            dynamicIntensity = ea.DynamicIntensity;
        }
        private void SaveCoinStatsToKnownCoins()
        {
            foreach (CoinInformation item in CoinApiInformation)
            {
                //find existing known coin or create a knew one
                PoolGroup knownCoin = KnownCoins.SingleOrDefault(c => c.Id.Equals(item.Symbol));
                if (knownCoin == null)
                {
                    knownCoin = new PoolGroup();
                    KnownCoins.Add(knownCoin);
                }

                knownCoin.Id = item.Symbol;
                knownCoin.Name = item.Name;
                knownCoin.Algorithm = item.Algorithm;
                knownCoin.Kind = item.IsMultiCoin ? PoolGroup.PoolGroupKind.MultiCoin : PoolGroup.PoolGroupKind.SingleCoin;
            }
            SaveKnownCoinsToFile();
        }
Example #7
0
 public CoinEditForm(PoolGroup cryptoCoin)
 {
     InitializeComponent();
     this.cryptoCoin = cryptoCoin;
 }
Example #8
0
 public Device()
 {
     Workers = new List<Device>();
     Coin = new PoolGroup();
 }
Example #9
0
        private void EditCurrentCoin(Coin currentConfiguration)
        {
            PoolGroup workingCoin = new PoolGroup();
            ObjectCopier.CopyObject(currentConfiguration.PoolGroup, workingCoin);

            using (CoinEditForm coinEditForm = new CoinEditForm(workingCoin))
            {
                DialogResult dialogResult = coinEditForm.ShowDialog();

                if (dialogResult == DialogResult.OK)
                {
                    Coin existingConfiguration =
                        configurations.SingleOrDefault(c => (c != currentConfiguration)
                            && c.PoolGroup.Id.Equals(workingCoin.Id, StringComparison.OrdinalIgnoreCase));

                    if (existingConfiguration == null)
                    {
                        ObjectCopier.CopyObject(workingCoin, currentConfiguration.PoolGroup);
                        coinListBox.Items[coinListBox.SelectedIndex] = workingCoin.Name;
                    }
                    else
                    {
                        //don't create a dupe
                        MessageBox.Show(String.Format("A configuration for {0} already exists.", workingCoin.Id),
                            "Duplicate Configuration", MessageBoxButtons.OK, MessageBoxIcon.Warning);
                    }
                }
            }
        }
Example #10
0
        private Engine.Data.Configuration.Engine CreateEngineConfiguration()
        {
            Engine.Data.Configuration.Engine engineConfiguration = new Engine.Data.Configuration.Engine();

            Engine.Data.Configuration.Coin coinConfiguration = new Engine.Data.Configuration.Coin();

            PoolGroup coin = null;

            //no Internet connection - only BTC and LTC were available
            if (coins.Count == 0)
            {
                coin = new PoolGroup();
                coin.Name = coinComboBox.Text;

                if (coin.Name.Equals(KnownCoins.LitecoinName, StringComparison.OrdinalIgnoreCase))
                {
                    coin.Algorithm = AlgorithmNames.Scrypt;
                    coin.Id = KnownCoins.LitecoinSymbol;
                }
                else
                {
                    coin.Algorithm = AlgorithmNames.SHA256;
                    coin.Id = KnownCoins.BitcoinSymbol;
                }
            }
            else
            {
                coin = coins.Single(c => c.Name.Equals(coinComboBox.Text));
            }

            coinConfiguration.PoolGroup = coin;
            coinConfiguration.Enabled = true;

            MiningPool miningPool = new MiningPool();

            miningPool.Host = hostEdit.Text;
            miningPool.Port = Int32.Parse(portEdit.Text);
            miningPool.Username = usernameEdit.Text;
            miningPool.Password = passwordEdit.Text;

            coinConfiguration.Pools.Add(miningPool);

            engineConfiguration.CoinConfigurations.Add(coinConfiguration);
            return engineConfiguration;
        }