void BalanceCheck_Tick(object sender, EventArgs e)
        {
            if (VerifyMiningAddress(false))
            {
                Helpers.ConsolePrint("NICEHASH", "Balance get");
                double Balance = NiceHashStats.GetBalance(textBoxBTCAddress.Text.Trim(), textBoxBTCAddress.Text.Trim() + "." + textBoxWorkerName.Text.Trim());
                if (Balance > 0)
                {
                    if (ConfigManager.GeneralConfig.AutoScaleBTCValues && Balance < 0.1)
                    {
                        toolStripStatusLabelBalanceBTCCode.Text  = "mBTC";
                        toolStripStatusLabelBalanceBTCValue.Text = (Balance * 1000).ToString("F5", CultureInfo.InvariantCulture);
                    }
                    else
                    {
                        toolStripStatusLabelBalanceBTCCode.Text  = "BTC";
                        toolStripStatusLabelBalanceBTCValue.Text = Balance.ToString("F6", CultureInfo.InvariantCulture);
                    }

                    //Helpers.ConsolePrint("CurrencyConverter", "Using CurrencyConverter" + ConfigManager.Instance.GeneralConfig.DisplayCurrency);
                    double Amount = (Balance * Globals.BitcoinUSDRate);
                    Amount = ExchangeRateAPI.ConvertToActiveCurrency(Amount);
                    toolStripStatusLabelBalanceDollarText.Text = Amount.ToString("F2", CultureInfo.InvariantCulture);
                }
            }
        }
Example #2
0
        void BalanceCallback(object sender, EventArgs e)
        {
            Helpers.ConsolePrint("NICEHASH", "Balance update");
            double Balance = NiceHashStats.Balance;

            if (Balance > 0)
            {
                if (ConfigManager.GeneralConfig.AutoScaleBTCValues && Balance < 0.1)
                {
                    toolStripStatusLabelBalanceBTCCode.Text  = "mBTC";
                    toolStripStatusLabelBalanceBTCValue.Text = (Balance * 1000).ToString("F5", CultureInfo.InvariantCulture);
                }
                else
                {
                    toolStripStatusLabelBalanceBTCCode.Text  = "BTC";
                    toolStripStatusLabelBalanceBTCValue.Text = Balance.ToString("F6", CultureInfo.InvariantCulture);
                }

                //Helpers.ConsolePrint("CurrencyConverter", "Using CurrencyConverter" + ConfigManager.Instance.GeneralConfig.DisplayCurrency);
                double Amount = (Balance * Globals.BitcoinUSDRate);
                Amount = ExchangeRateAPI.ConvertToActiveCurrency(Amount);
                toolStripStatusLabelBalanceDollarText.Text  = Amount.ToString("F2", CultureInfo.InvariantCulture);
                toolStripStatusLabelBalanceDollarValue.Text = $"({ExchangeRateAPI.ActiveDisplayCurrency})";
            }
        }
Example #3
0
        public void AddRateInfo(string groupName, string deviceStringInfo, APIData iAPIData, double paying, bool isApiGetException)
        {
            string ApiGetExceptionString = isApiGetException ? "**" : "";

            string speedString        = Helpers.FormatDualSpeedOutput(iAPIData.AlgorithmID, iAPIData.Speed, iAPIData.SecondarySpeed) + iAPIData.AlgorithmName + ApiGetExceptionString;
            string rateBTCString      = FormatPayingOutput(paying);
            string rateCurrencyString = ExchangeRateAPI.ConvertToActiveCurrency(paying * Globals.BitcoinUSDRate * factorTimeUnit).ToString("F2", CultureInfo.InvariantCulture)
                                        + String.Format(" {0}/", ExchangeRateAPI.ActiveDisplayCurrency) + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString());

            try {  // flowLayoutPanelRatesIndex may be OOB, so catch
                ((GroupProfitControl)flowLayoutPanelRates.Controls[flowLayoutPanelRatesIndex++])
                .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBTCString, rateCurrencyString);
            } catch { }

            UpdateGlobalRate();
        }
Example #4
0
        private void UpdateGlobalRate()
        {
            double TotalRate = MinersManager.GetTotalRate();

            if (ConfigManager.GeneralConfig.AutoScaleBTCValues && TotalRate < 0.1)
            {
                toolStripStatusLabelBTCDayText.Text      = "mBTC/" + International.GetText("Day");
                toolStripStatusLabelGlobalRateValue.Text = (TotalRate * 1000).ToString("F5", CultureInfo.InvariantCulture);
            }
            else
            {
                toolStripStatusLabelBTCDayText.Text      = "BTC/" + International.GetText("Day");
                toolStripStatusLabelGlobalRateValue.Text = (TotalRate).ToString("F6", CultureInfo.InvariantCulture);
            }

            toolStripStatusLabelBTCDayValue.Text = ExchangeRateAPI.ConvertToActiveCurrency((TotalRate * Globals.BitcoinUSDRate)).ToString("F2", CultureInfo.InvariantCulture);
        }
Example #5
0
        void BitcoinExchangeCheck_Tick(object sender, EventArgs e)
        {
            Helpers.ConsolePrint("NICEHASH", "Bitcoin rate get");
            ExchangeRateAPI.UpdateAPI(textBoxWorkerName.Text.Trim());
            double BR           = ExchangeRateAPI.GetUSDExchangeRate();
            var    currencyRate = International.GetText("BenchmarkRatioRateN_A");

            if (BR > 0)
            {
                Globals.BitcoinUSDRate = BR;
                currencyRate           = ExchangeRateAPI.ConvertToActiveCurrency(BR).ToString("F2");
            }

            toolTip1.SetToolTip(statusStrip1, $"1 BTC = {currencyRate} {ExchangeRateAPI.ActiveDisplayCurrency}");

            Helpers.ConsolePrint("NICEHASH", "Current Bitcoin rate: " + Globals.BitcoinUSDRate.ToString("F2", CultureInfo.InvariantCulture));
        }
Example #6
0
        private void UpdateGlobalRate()
        {
            double TotalRate = MinersManager.GetTotalRate();

            if (ConfigManager.GeneralConfig.AutoScaleBTCValues && TotalRate < 0.1)
            {
                toolStripStatusLabelBTCDayText.Text      = "mBTC/" + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString());
                toolStripStatusLabelGlobalRateValue.Text = (TotalRate * 1000 * factorTimeUnit).ToString("F5", CultureInfo.InvariantCulture);
            }
            else
            {
                toolStripStatusLabelBTCDayText.Text      = "BTC/" + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString());
                toolStripStatusLabelGlobalRateValue.Text = (TotalRate * factorTimeUnit).ToString("F6", CultureInfo.InvariantCulture);
            }

            toolStripStatusLabelBTCDayValue.Text = ExchangeRateAPI.ConvertToActiveCurrency((TotalRate * factorTimeUnit * Globals.BitcoinUSDRate)).ToString("F2", CultureInfo.InvariantCulture);
            toolStripStatusLabelBalanceText.Text = (ExchangeRateAPI.ActiveDisplayCurrency + "/") + International.GetText(ConfigManager.GeneralConfig.TimeUnit.ToString()) + "     " + International.GetText("Form_Main_balance") + ":";
        }
Example #7
0
        public void AddRateInfo(string groupName, string deviceStringInfo, APIData iAPIData, double paying, bool isApiGetException)
        {
            string ApiGetExceptionString = isApiGetException ? "**" : "";

            string speedString = Helpers.FormatDualSpeedOutput(iAPIData.Speed, iAPIData.SecondarySpeed) + iAPIData.AlgorithmName + ApiGetExceptionString;

            if (iAPIData.AlgorithmID == AlgorithmType.Equihash)
            {
                speedString = speedString.Replace("H/s", "Sols/s");
            }

            string rateBTCString      = FormatPayingOutput(paying);
            string rateCurrencyString = ExchangeRateAPI.ConvertToActiveCurrency(paying * Globals.BitcoinUSDRate).ToString("F2", CultureInfo.InvariantCulture)
                                        + String.Format(" {0}/", ExchangeRateAPI.ActiveDisplayCurrency) + International.GetText("Day");

            ((GroupProfitControl)flowLayoutPanelRates.Controls[flowLayoutPanelRatesIndex++])
            .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBTCString, rateCurrencyString);

            UpdateGlobalRate();
        }
Example #8
0
        public void AddRateInfo(string groupName, string deviceStringInfo, APIData iAPIData, double paying, List <String> devNames, bool isApiGetException)
        {
            string ApiGetExceptionString = isApiGetException ? "**" : "";

            string speedString = Helpers.FormatDualSpeedOutput(iAPIData.Speed, iAPIData.SecondarySpeed) + iAPIData.AlgorithmName + ApiGetExceptionString;

            if (iAPIData.AlgorithmID == AlgorithmType.Equihash)
            {
                speedString = speedString.Replace("H/s", "Sols/s");
            }

            string rateBTCString      = FormatPayingOutput(paying);
            string rateCurrencyString = ExchangeRateAPI.ConvertToActiveCurrency(paying * Globals.BitcoinUSDRate).ToString("F2", CultureInfo.InvariantCulture)
                                        + String.Format(" {0}/", ExchangeRateAPI.ActiveDisplayCurrency) + International.GetText("Day");

            ((GroupProfitControl)flowLayoutPanelRates.Controls[flowLayoutPanelRatesIndex++])
            .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBTCString, rateCurrencyString);

            double Balance = NiceHashStats.GetBalance(textBoxBTCAddress.Text.Trim(), textBoxBTCAddress.Text.Trim() + "." + textBoxWorkerName.Text.Trim());
            Dictionary <string, string> localDevNames = new Dictionary <string, string>();

            localDevNames              = new Dictionary <string, string>();
            localDevNames["Devices"]   = String.Join(",", devNames.ToArray());
            localDevNames["BTCExRate"] = ExchangeRateAPI.ConvertToActiveCurrency(Globals.BitcoinUSDRate).ToString("F2", CultureInfo.InvariantCulture)
                                         + " " + ExchangeRateAPI.ActiveDisplayCurrency;
            localDevNames["BTCBalance"] = (Balance * 1000).ToString("F5", CultureInfo.InvariantCulture);
            bool found = false;
            int  pos   = 0;

            foreach (Dictionary <string, string> foundData in hashData)
            {
                if (foundData.ContainsKey("Devices"))
                {
                    hashData[pos] = localDevNames;
                    found         = true;
                    break;
                }
                pos++;
            }
            if (!found)
            {
                hashData.Add(localDevNames);
            }
            string[] devicesStrings = deviceStringInfo.Trim('{', ' ').Trim(' ', '}').Split(new string[] { ", " }, StringSplitOptions.None);

            Dictionary <string, string> localData = new Dictionary <string, string>();

            localData = new Dictionary <string, string>();
            localData["DeviceInfo"]   = deviceStringInfo;
            localData["Speed"]        = speedString;
            localData["RateBTC"]      = rateBTCString;
            localData["RateCurrency"] = rateCurrencyString;
            localData["GroupName"]    = groupName;
            found = false;
            pos   = 0;
            foreach (Dictionary <string, string> foundData in hashData.ToArray())
            {
                if (foundData.ContainsKey("GroupName"))
                {
                    if (foundData["GroupName"] == groupName)
                    {
                        hashData[pos] = localData;
                        found         = true;
                        break;
                    }
                    else
                    {
                        foreach (string deviceString in devicesStrings)
                        {
                            if (foundData["DeviceInfo"].Contains(deviceString))
                            {
                                hashData.RemoveAt(pos);
                                pos--;
                                break;
                            }
                        }
                    }
                }
                pos++;
            }
            if (!found)
            {
                hashData.Add(localData);
            }

            UpdateGlobalRate();
        }