Skip to content

Commit

Permalink
Merge pull request #4 from JeffDChapman/Mods-for-Restart
Browse files Browse the repository at this point in the history
Mods for restart
  • Loading branch information
JeffDChapman authored Nov 11, 2016
2 parents 9d27ed0 + 51a7629 commit 2616021
Showing 1 changed file with 18 additions and 2 deletions.
20 changes: 18 additions & 2 deletions JeffSplit/FileSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ public partial class FileSplitter : Form
private long baseLineStart = 0;
private int secsElapsed = 0;
private TimeSpan timeElapsed;
private double lastpctDone = 0;
private TimeSpan lasttimeLeft;

public FileSplitter()
{
Expand Down Expand Up @@ -131,8 +133,22 @@ private void tmrSeconds_Tick(object sender, EventArgs e)
try
{
double pctDone = this.pbarSplitPct.Value / 99.9;
TimeSpan timeLeft = TimeSpan.FromSeconds(timeElapsed.TotalSeconds * (1 - pctDone) / (pctDone - baseLineStart));
this.lblRemaining.Text = String.Format("{0:hh.mm.ss}", timeLeft.ToString());
if (lastpctDone == pctDone)
{
lasttimeLeft -= TimeSpan.FromSeconds(1);
if (lasttimeLeft < TimeSpan.FromSeconds(0))
{ lasttimeLeft = TimeSpan.FromSeconds(0); }
this.lblRemaining.Text = String.Format("{0:hh.mm.ss}", lasttimeLeft.ToString());
}
else
{
lastpctDone = pctDone;
TimeSpan timeLeft = TimeSpan.FromSeconds(timeElapsed.TotalSeconds * (1 - pctDone) / (pctDone - baseLineStart));
if (timeLeft < TimeSpan.FromSeconds(0))
{ timeLeft = TimeSpan.FromSeconds(0); }
lasttimeLeft = timeLeft;
this.lblRemaining.Text = String.Format("{0:hh.mm.ss}", timeLeft.ToString());
}
}
catch { }

Expand Down

0 comments on commit 2616021

Please sign in to comment.