boydiscover
boydiscover
CC#
Created by boydiscover on 2/25/2023 in #help
❔ Need help adding a progress bar to an rclone downloader
Hello everybody, I have a game downloader using rclone and I need help adding a progress bar, ive tried many ways but theyve all failed and im probably doing something wrong. Here is a part of the code
public async Task DownloadGame(string game, string downloadpath)
{
Process process = new Process();
process.StartInfo.FileName = rclonepath;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.Arguments = "copy -P " + "test1:" + game + " " + downloadpath + game;
process.EnableRaisingEvents = true;



process.Start();

process.BeginOutputReadLine();

// Wait for the process to exit
await Task.Run(() => process.WaitForExit());
}
private void guna2Button1_Click(object sender, EventArgs e)
{
string game = "mygame";
string downloadpath = "C:\\temp\\";

DownloadGame(game, downloadpath);
}
}
}
public async Task DownloadGame(string game, string downloadpath)
{
Process process = new Process();
process.StartInfo.FileName = rclonepath;
process.StartInfo.UseShellExecute = false;
process.StartInfo.RedirectStandardOutput = true;
process.StartInfo.RedirectStandardError = false;
process.StartInfo.CreateNoWindow = true;
process.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
process.StartInfo.Arguments = "copy -P " + "test1:" + game + " " + downloadpath + game;
process.EnableRaisingEvents = true;



process.Start();

process.BeginOutputReadLine();

// Wait for the process to exit
await Task.Run(() => process.WaitForExit());
}
private void guna2Button1_Click(object sender, EventArgs e)
{
string game = "mygame";
string downloadpath = "C:\\temp\\";

DownloadGame(game, downloadpath);
}
}
}
As you can see, the rclone download part is a function and can be called from a button click, this is to make it easier as I am using many buttons. One way im thinking on how to do this is by getting the progress from rclone itself and sending that to the program and then using the percentage in a progress bar, but im having no luck Heres the output of a rclone copy
Transferred: 53.683M / 2.346 GBytes, 2%, 10.732 MBytes/s, ETA 3m38s
Transferred: 0 / 1, 0%
Elapsed time: 6.5s
Transferring:
Transferred: 53.683M / 2.346 GBytes, 2%, 10.732 MBytes/s, ETA 3m38s
Transferred: 0 / 1, 0%
Elapsed time: 6.5s
Transferring:
2 replies