C
C#3y ago
Nikolaaa

Can not download file on dropbox

I am trying to make a self updater but I can not download files from dropbox
7 Replies
Nikolaaa
NikolaaaOP3y ago
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e)
{
WebClient webClient = new WebClient();
var client = new WebClient();
try
{
System.Threading.Thread.Sleep(5000);
File.Delete(@".\UniverseClient.exe");
client.DownloadFile("https://www.dropbox.com/s/8jlvmbg68hr7ie1/UniverseClient.zip?dl=1", @"UniverseClient.zip");
string zipPath = @".\UniverseClient.zip";
string extractPath = @".\";
ZipFile.ExtractToDirectory(zipPath, extractPath);
File.Delete(@".\UniverseClient.zip");
Process.Start(@".\UniverseClient.exe");
this.Close();
}
catch
{
MessageBox.Show("Could not update the launcher, please download new version from the site or try again.", "Update Interrupted!", MessageBoxButtons.OK, MessageBoxIcon.Error);
Process.Start("UniverseClient.exe");
this.Close();
}
for (int i = 0; i < 100; i++)
{
Thread.Sleep(1000);
UpdateWorker.ReportProgress(i);
}
}
private void UpdateWorker_DoWork(object sender, DoWorkEventArgs e)
{
WebClient webClient = new WebClient();
var client = new WebClient();
try
{
System.Threading.Thread.Sleep(5000);
File.Delete(@".\UniverseClient.exe");
client.DownloadFile("https://www.dropbox.com/s/8jlvmbg68hr7ie1/UniverseClient.zip?dl=1", @"UniverseClient.zip");
string zipPath = @".\UniverseClient.zip";
string extractPath = @".\";
ZipFile.ExtractToDirectory(zipPath, extractPath);
File.Delete(@".\UniverseClient.zip");
Process.Start(@".\UniverseClient.exe");
this.Close();
}
catch
{
MessageBox.Show("Could not update the launcher, please download new version from the site or try again.", "Update Interrupted!", MessageBoxButtons.OK, MessageBoxIcon.Error);
Process.Start("UniverseClient.exe");
this.Close();
}
for (int i = 0; i < 100; i++)
{
Thread.Sleep(1000);
UpdateWorker.ReportProgress(i);
}
}
It always just catches exception
Angius
Angius3y ago
Check what the exception is That might give you a lead
jcotton42
jcotton423y ago
@Nikolaaa Dropbox is not a suitable CDN for application files Use something actually meant for this If your application is open source, GitHub releases are an option
Nikolaaa
NikolaaaOP3y ago
is there anything easier to use than github?
jcotton42
jcotton423y ago
Is your project already on GitHub? That is, open source and the code is there Releases are pretty easy imo
Nikolaaa
NikolaaaOP3y ago
it isnt but I will install github extension in visual studio and push the repository yea with version control and stuff i will try that
Want results from more Discord servers?
Add your server