Skip to content

Commit

Permalink
- small progress bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
bietiekay committed Apr 8, 2012
1 parent f47e49e commit be7456a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions Main.cs
Expand Up @@ -73,9 +73,12 @@ public static void Main (string[] args2)
else
{
Console.Write("\t\tDownloading: " + ShortenString.LimitCharacters(video.Title, 40) + "...");
var videoDownloader = new VideoDownloader(video, filename);
var videoDownloader = new VideoDownloader(video, filename);

Int32 left = Console.CursorLeft;
Int32 top = Console.CursorTop;

videoDownloader.ProgressChanged += (sender, args) => DisplayProgress(args.ProgressPercentage);
videoDownloader.ProgressChanged += (sender, args) => DisplayProgress(left,top,args.ProgressPercentage);

videoDownloader.Execute();
Console.WriteLine("done ");
Expand All @@ -90,13 +93,10 @@ public static void Main (string[] args2)
}
}

public static void DisplayProgress(double percentage)
{
Int32 left = Console.CursorLeft;
Int32 top = Console.CursorTop;

Console.Write (percentage+"%");
Console.SetCursorPosition(left,top);
public static void DisplayProgress(Int32 left, Int32 top, double percentage)
{
Console.SetCursorPosition(left, top);
Console.Write (Convert.ToInt32(percentage)+"%");
}
}
}

0 comments on commit be7456a

Please sign in to comment.