private void AddCoinConfiguration(CryptoCoin cryptoCoin) { CoinConfiguration configuration = configurations.SingleOrDefault(c => c.Coin.Symbol.Equals(cryptoCoin.Symbol)); if (configuration != null) { coinListBox.SelectedIndex = configurations.IndexOf(configuration); } else { configuration = new CoinConfiguration(); configuration.Coin = knownCoins.SingleOrDefault(c => c.Symbol.Equals(cryptoCoin.Symbol, StringComparison.OrdinalIgnoreCase)); //user may have manually entered a coin if (configuration.Coin == null) { configuration.Coin = new CryptoCoin(); configuration.Coin.Name = cryptoCoin.Name; configuration.Coin.Symbol = cryptoCoin.Symbol; configuration.Coin.Algorithm = cryptoCoin.Algorithm; } configuration.Pools.Add(new MiningPool()); configurations.Add(configuration); coinListBox.Items.Add(configuration.Coin.Name); coinListBox.SelectedIndex = configurations.IndexOf(configuration); } hostEdit.Focus(); }
private void saveButton_Click(object sender, EventArgs e) { string coinName = coinCombo.Text; CryptoCoin knownCoin = sortedCoins.SingleOrDefault(c => c.Name.Equals(coinName, StringComparison.OrdinalIgnoreCase)); if (knownCoin == null) { CryptoCoin newCoin = new CryptoCoin(); newCoin.Name = coinName; newCoin.Algorithm = Xgminer.CoinAlgorithm.SHA256; 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) { CryptoCoin knownCoin = null; if (coinCombo.SelectedIndex >= 0) knownCoin = sortedCoins[coinCombo.SelectedIndex]; if (knownCoin == null) { CryptoCoin newCoin = new CryptoCoin(); newCoin.Name = coinCombo.Text; newCoin.Algorithm = Xgminer.CoinAlgorithm.SHA256; 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; } }
public CoinEditForm(CryptoCoin cryptoCoin) { InitializeComponent(); this.cryptoCoin = cryptoCoin; }
private void LoadKnownCoinsFromCoinStats() { foreach (Coin.Api.CoinInformation item in coinInformation) { //find existing known coin or create a knew one CryptoCoin knownCoin = knownCoins.SingleOrDefault(c => c.Symbol.Equals(item.Symbol)); if (knownCoin == null) { knownCoin = new CryptoCoin(); this.knownCoins.Add(knownCoin); } knownCoin.Symbol = item.Symbol; knownCoin.Name = item.Name; //needs to be a case insensitive check to work with both CoinChoose and CoinWarz if (item.Algorithm.ToLower().Contains("scrypt")) knownCoin.Algorithm = CoinAlgorithm.Scrypt; else knownCoin.Algorithm = CoinAlgorithm.SHA256; } SaveKnownCoinsToFile(); }
private void LoadKnownCoinsFromCoinStats() { foreach (Coinchoose.Api.CoinInformation item in coinInformation) { //find existing known coin or create a knew one CryptoCoin knownCoin = knownCoins.SingleOrDefault(c => c.Symbol.Equals(item.Symbol)); if (knownCoin == null) { knownCoin = new CryptoCoin(); this.knownCoins.Add(knownCoin); } knownCoin.Symbol = item.Symbol; knownCoin.Name = item.Name; if (item.Algorithm.Contains("scrypt")) knownCoin.Algorithm = CoinAlgorithm.Scrypt; else knownCoin.Algorithm = CoinAlgorithm.SHA256; } SaveKnownCoinsToFile(); }