public void AddRateInfo(string groupName, string deviceStringInfo, ApiData iApiData, double paying, bool isApiGetException) { var apiGetExceptionString = isApiGetException ? "**" : ""; var speedString = Helpers.FormatDualSpeedOutput(iApiData.AlgorithmID, iApiData.Speed, iApiData.SecondarySpeed) + iApiData.AlgorithmName + apiGetExceptionString; var rateBtcString = FormatPayingOutput(paying); var rateCurrencyString = ExchangeRateApi .ConvertToActiveCurrency(paying * Globals.BitcoinUsdRate * _factorTimeUnit) .ToString("F2", CultureInfo.InvariantCulture) + $" {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(); }
protected void BenchmarkThreadRoutineFinish() { BenchmarkProcessStatus status = BenchmarkProcessStatus.Finished; if (BenchmarkAlgorithm.BenchmarkSpeed > 0) { status = BenchmarkProcessStatus.Success; } using (StreamWriter sw = File.AppendText(benchmarkLogPath)) { foreach (var line in bench_lines) { sw.WriteLine(line); } } BenchmarkProcessStatus = status; Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatDualSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed, BenchmarkAlgorithm.SecondaryBenchmarkSpeed)); Helpers.ConsolePrint("BENCHMARK", "Benchmark ends"); if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled) { OnBenchmarkCompleteCalled = true; bool isOK = BenchmarkProcessStatus.Success == status; string msg = GetFinalBenchmarkString(); BenchmarkComunicator.OnBenchmarkComplete(isOK, isOK ? "" : msg); } }
protected void BenchmarkThreadRoutineFinish() { var status = BenchmarkProcessStatus.Finished; if (!BenchmarkAlgorithm.BenchmarkNeeded) { status = BenchmarkProcessStatus.Success; } try { using (StreamWriter sw = File.AppendText(_benchmarkLogPath)) { foreach (var line in BenchLines) { sw.WriteLine(line); } } } catch { } BenchmarkProcessStatus = status; if (BenchmarkAlgorithm is DualAlgorithm dualAlg) { if (!dualAlg.TuningEnabled) { // Tuning will report speed Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatDualSpeedOutput(dualAlg.BenchmarkSpeed, dualAlg.SecondaryBenchmarkSpeed, dualAlg.DualNiceHashID)); } } else { Helpers.ConsolePrint("BENCHMARK", "Final Speed: " + Helpers.FormatDualSpeedOutput(BenchmarkAlgorithm.BenchmarkSpeed, 0, BenchmarkAlgorithm.NiceHashID)); } Helpers.ConsolePrint("BENCHMARK", "Benchmark ends"); if (BenchmarkComunicator != null && !OnBenchmarkCompleteCalled) { OnBenchmarkCompleteCalled = true; var isOK = BenchmarkProcessStatus.Success == status; var msg = GetFinalBenchmarkString(); BenchmarkComunicator.OnBenchmarkComplete(isOK, isOK ? "" : msg); } }
public string BenchmarkSpeedString() { if (Enabled && IsBenchmarkPending && !string.IsNullOrEmpty(BenchmarkStatus)) { return(BenchmarkStatus); } else if (BenchmarkSpeed > 0) { return(Helpers.FormatDualSpeedOutput(BenchmarkSpeed, SecondaryBenchmarkSpeed)); } else if (!IsPendingString() && !string.IsNullOrEmpty(BenchmarkStatus)) { return(BenchmarkStatus); } return(International.GetText("BenchmarkSpeedStringNone")); }
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).ToString("F2", CultureInfo.InvariantCulture) + String.Format(" {0}/", ExchangeRateAPI.ActiveDisplayCurrency) + International.GetText("Day"); try { // flowLayoutPanelRatesIndex may be OOB, so catch ((GroupProfitControl)flowLayoutPanelRates.Controls[flowLayoutPanelRatesIndex++]) .UpdateProfitStats(groupName, deviceStringInfo, speedString, rateBTCString, rateCurrencyString); } catch { } UpdateGlobalRate(); }
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(); }