Ah OK I see now what you mean, thanks for the clarification!
kiasta
Posts
-
Progress Bar makes copying painfully slow, a little help please? -
Progress Bar makes copying painfully slow, a little help please?The main objective is to compress the files into a container, but I want to at least be able to copy files with some type of progress notification at the very least first before I start making an algorithm for compression. Thanks for the source I'll study it and try to make something work.
-
Progress Bar makes copying painfully slow, a little help please?Hmm OK that makes some sense, but why would copying it inside the UI make any difference? Without the progress bar the files copy very fast, almost instantly. I don't really understand, I guess. Is the progress bar really that resource intensive?
-
Progress Bar makes copying painfully slow, a little help please?Thanks for the reply! I will definitely look into that.
-
Progress Bar makes copying painfully slow, a little help please?I've implemented a progress bar to my application but it makes the file copy process painfully slow whereas without the progress bar the copy is very fast. I know without the progress bar it only takes a few seconds to copy a 10 megabyte file but with the progress bar it takes more than a minute. What am I doing wrong?
namespace Compression_Util
{
class DropBox
{
private object sender;
private EventArgs e;
private DragEventArgs de;
private Design zip;
private string hover;
private string[] files;
private string filetype;public DropBox(object sender, DragEventArgs de, Design zip, string hover) { this.sender = sender; this.de = de; this.zip = zip; this.hover = hover; this.Hover(); } public DropBox(object sender, EventArgs e, Design zip, string hover) { this.sender = sender; this.e = e; this.zip = zip; this.hover = hover; this.Hover(); } private void InitializeProgressBar(int fileSize) { zip.DropProgress.Visible = true; zip.DropProgress.Minimum = sizeof(Byte); zip.DropProgress.Step = sizeof(Byte); zip.DropProgress.Maximum = fileSize; } private void DeInitializeProgressBar() { zip.DropProgress.Invalidate(); zip.DropProgress.Visible = false; } private void IncrementProgressBar() { zip.DropProgress.PerformStep(); } private void CreateFile(string read, string write) { try { FileStream fileStreamReader = new FileStream(read, FileMode.Open, FileAccess.Read); FileStream fileStreamWriter = new FileStream(write, FileMode.Create, FileAccess.ReadWrite); BinaryReader binaryReader = new BinaryReader(fileStreamReader); BinaryWriter binaryWriter = new BinaryWriter(fileStreamWriter); int position = 0; int length = (int)binaryReader.BaseStream.Length; InitializeProgressBar(length); while (position < length) { Byte line = binaryReader.ReadByte(); binaryWriter.Write(line); position += sizeof(Byte); Increm