Could someone tell me or suggest how I can make the progressbar work with my current codes? I'm decrypting files from directory. I want to show the progress. I tried reporting the inputFiles count but I can't make it work.
Here's my code:
private async Task Start()
{
int bufferSize = Convert.ToInt32(cbBufferSize.Text);
int count = 0;
foreach (ListViewItem lvi in LV.Items)
{
string inputhPaths = lvi.SubItems[0].Text;
string keyPaths = lvi.SubItems[1].Text;
outputPaths = Path.Combine(lvi.SubItems[2].Text, lvi.SubItems[3].Text + ".ts");
using (var fsOutput = new FileStream(outputPaths, FileMode.Create, FileAccess.Write))
{
foreach (string inputFiles in Directory.GetFiles(inputhPaths, "*.ts"))
{
using (var fsInput = new FileStream(inputFiles, FileMode.Open, FileAccess.Read))
{
count++;
progressBar1.Value = (int)count / inputFiles.Count() * 100;
await Task.Run(() => Decrypter.BufferMethod(fsInput, keyPaths, fsOutput, bufferSize));
}
}
}
}
}