internal void DownloadProgressUpdatedEventArgs_Instantiates_With_The_Given_Data(string username, string filename, int token, int size, int bytesDownloaded)
        {
            var dl = new Download(username, filename, token);

            dl.Size = size;

            var d = new DownloadProgressUpdatedEventArgs(bytesDownloaded, dl);

            Assert.Equal(bytesDownloaded, d.PreviousBytesDownloaded);
        }
        internal void DownloadProgressUpdatedEventArgs_Instantiates_With_The_Given_Data(string username, string filename, int token, int size, int bytesDownloaded)
        {
            var dl = new Download(username, filename, token);

            dl.Size = size;

            var d = new DownloadProgressUpdatedEventArgs(dl, bytesDownloaded);

            Assert.Equal(bytesDownloaded, d.BytesDownloaded);
            Assert.Equal((bytesDownloaded / (double)size) * 100, d.PercentComplete);
        }
Example #3
0
        private static void Client_DownloadProgress(object sender, DownloadProgressUpdatedEventArgs e)
        {
            var key = $"{e.Username}:{e.Filename}:{e.Token}";

            Progress.AddOrUpdate(key, e.PercentComplete, (k, v) =>
            {
                if (Progress[k] <= e.PercentComplete)
                {
                    return(e.PercentComplete);
                }

                return(Progress[k]);
            });

            //Console.WriteLine($"[PROGRESS]: {e.Filename}: {Progress[key]}%");
        }