Skip to content

Commit

Permalink
Merge pull request #3 from JeffDChapman/Mods-for-Restart
Browse files Browse the repository at this point in the history
Mods for restart
  • Loading branch information
JeffDChapman authored Oct 26, 2016
2 parents 572e9a0 + 0c3bce7 commit 9d27ed0
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion JeffSplit/FileSplitter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public partial class FileSplitter : Form
private string inputFileName;
private string outputPath;
private long maxChunk = 512 * 1024;
private long baseLineStart = 0;
private int secsElapsed = 0;
private TimeSpan timeElapsed;

Expand All @@ -43,6 +44,7 @@ private void SplitFile(string inputFile, long chunkSize, string path)
{
int index = Convert.ToInt32(this.txtSkipFirst.Text);
input.Position += index * chunkSize;
baseLineStart = input.Position / input.Length;

while (input.Position < input.Length)
{
Expand Down Expand Up @@ -129,7 +131,7 @@ 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);
TimeSpan timeLeft = TimeSpan.FromSeconds(timeElapsed.TotalSeconds * (1 - pctDone) / (pctDone - baseLineStart));
this.lblRemaining.Text = String.Format("{0:hh.mm.ss}", timeLeft.ToString());
}
catch { }
Expand Down

0 comments on commit 9d27ed0

Please sign in to comment.