Skip to content

Commit

Permalink
Attempt to approximate time remaining
Browse files Browse the repository at this point in the history
  • Loading branch information
jacks authored and jacks committed Mar 30, 2024
1 parent f36204a commit 0812753
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions whisperer/Form1.cs
Original file line number Diff line number Diff line change
Expand Up @@ -648,15 +648,14 @@ void whisper_Exited(object sender, EventArgs e, string errorOutput)
var proc = sender as Process;
try
{
if (proc.ExitCode != 0)
ShowError($"main.exe has finished with error. Exit code: {proc.ExitCode}\n\n{errorOutput}");
durationrec dr = durations[proc.StartInfo.Domain];
dr.exectime = DateTime.Now - dr.starttime;
}
catch { }

try
{
durationrec dr = durations[proc.StartInfo.Domain];
dr.exectime = DateTime.Now - dr.starttime;
if (proc.ExitCode != 0)
ShowError($"main.exe has finished with error. Exit code: {proc.ExitCode}\n\n{errorOutput}");
}
catch { }

Expand Down Expand Up @@ -852,7 +851,11 @@ TimeSpan getduration(string filename)
}
catch (Exception ex)
{
ShowError(ex.ToString());
if (!cancel)
{
cancel = true;
ShowError(ex.ToString());
}
}
return TimeSpan.Zero;
}
Expand Down Expand Up @@ -991,7 +994,7 @@ void button3_Click(object sender, EventArgs e)
cq.IsBackground = true;
cq.Start();

timeremaining.Text = "00:00:00";
timeremaining.Text = "--:--:--";
sw.Restart();
timer1.Enabled = true;
}
Expand Down Expand Up @@ -1056,6 +1059,8 @@ void timer1_Tick(object sender, EventArgs e)
{
label10.Text = sw.Elapsed.Hours.ToString("00") + ":" + sw.Elapsed.Minutes.ToString("00") + ":" +
sw.Elapsed.Seconds.ToString("00");
if (timeremaining.Text[0] == '-')
return;
string[] rems = timeremaining.Text.Split(':');
TimeSpan t = new TimeSpan(Convert.ToInt32(rems[0]), Convert.ToInt32(rems[1]), Convert.ToInt32(rems[2]));
t -= new TimeSpan(0, 0, 1);
Expand Down

0 comments on commit 0812753

Please sign in to comment.