private void timer_Tick(object sender, EventArgs e) { if (Bruteforce.IsActive) { Bruteforce.Update(); if (Bruteforce.HasResult) { lbCount.Text = Bruteforce.FirstTask.Counter.ToString("0,0"); tbResult.Text = Bruteforce.Result; var duration = Bruteforce.EndTime - Bruteforce.StartTime; lbTime.Text = $"{duration.TotalHours:00}:hr {duration.Minutes:00}:min {duration.Seconds:00}:s {duration.Milliseconds:0000}:ms"; //if (e.HasResult) //{ tbResult.BackColor = Color.LightGreen; //} //else //{ // tbResult.BackColor = Color.Tomato; //} } if (Bruteforce.Speed > 0) { _speedAverage.Add(Bruteforce.Speed); if (_speedAverage.Count > 50) { _speedAverage.RemoveAt(0); } lbSpeed.Text = $"{Bruteforce.Speed:n} hashes/s"; var avg = _speedAverage.Average(); lbAvarage.Text = $"{avg:n} hashes/s"; lbCount.Text = $"{Bruteforce.Tasks.Sum(x => x.Counter):0,0}"; var time = DateTime.Now - Bruteforce.StartTime; lbTime.Text = $"{time.TotalHours:00}:hr {time.Minutes:00}:min {time.Seconds:00}:s {time.Milliseconds:0000}:ms"; TimeSpan maxTime; try { var space = (ulong)StringHelper.CalculateSpace(Bruteforce.Charset, (int)numMinCount.Value, (int)numCount.Value); maxTime = TimeSpan.FromSeconds(space / avg); lblMaxTime.Text = $"{maxTime.TotalHours:00}:hr {maxTime.Minutes:00}:min {maxTime.Seconds:00}:s {maxTime.Milliseconds:0000}:ms"; } catch (OverflowException) { maxTime = TimeSpan.MaxValue; lblMaxTime.Text = $"> {maxTime.Days:00}days: {maxTime.Hours:00}:hr {maxTime.Minutes:00}:min {maxTime.Seconds:00}:s {maxTime.Milliseconds:0000}:ms"; } } } }