C
C#3y ago
Nikolaaa

Why isnt webclient reading pastebin?

I made a post 2 days ago but the guy didnt help me so I am trying again. Why is not this working?
14 Replies
Nikolaaa
NikolaaaOP3y ago
private void UniverseClientLogin_Load(object sender, EventArgs e)
{
WebClient webClient = new WebClient();

if (!webClient.DownloadString("https://pastebin.com/uGwUAHQV").Contains("0.0.2"))
{
MessageBox.Show("There is an update that is required to download for the launcher to work. Note: Delaying this update by turning off the computer/process may corrupt the launcher.", "New Update!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
Process.Start("UClientUpdater.exe");
this.Close();

}
else
{

if (!webClient.DownloadString("https://pastebin.com/uGwUAHQV").Contains("manualupd"))
{
MessageBox.Show("There is an update that requires you to manually download the launcher again, go to the site and download it.", "Manual update required!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
MessageBox.Show("You have the latest version of Universe Client.", "No new updates found!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
}
private void UniverseClientLogin_Load(object sender, EventArgs e)
{
WebClient webClient = new WebClient();

if (!webClient.DownloadString("https://pastebin.com/uGwUAHQV").Contains("0.0.2"))
{
MessageBox.Show("There is an update that is required to download for the launcher to work. Note: Delaying this update by turning off the computer/process may corrupt the launcher.", "New Update!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
Process.Start("UClientUpdater.exe");
this.Close();

}
else
{

if (!webClient.DownloadString("https://pastebin.com/uGwUAHQV").Contains("manualupd"))
{
MessageBox.Show("There is an update that requires you to manually download the launcher again, go to the site and download it.", "Manual update required!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
else
{
MessageBox.Show("You have the latest version of Universe Client.", "No new updates found!", MessageBoxButtons.OK, MessageBoxIcon.Asterisk);
}
}
}
it always says there is an update when there is not
Angius
Angius3y ago
1. WebClient is deprecated, use HttpClient 2. See if using the link to the raw paste works, instead of the link to the whole-ass page
Nikolaaa
NikolaaaOP3y ago
I have no knowledge on how to use httpClient sooooooo idk about that
Angius
Angius3y ago
Knowledge is a thing that can be gained It's cool like that
Nikolaaa
NikolaaaOP3y ago
yea no shit and there isnt any good tutorials anyway
Angius
Angius3y ago
HttpClient Class (System.Net.Http)
Provides a class for sending HTTP requests and receiving HTTP responses from a resource identified by a URI.
Nikolaaa
NikolaaaOP3y ago
whats the difference between the two?
Angius
Angius3y ago
HttpClient is properly asynchronous, for one
Nikolaaa
NikolaaaOP3y ago
raw didnt solve the issue either, will using http client solve the issue? or I need to do something different
Angius
Angius3y ago
Not sure, it might Also, forgot to ask: what do you mean by "doesn't work" in the first place?
Nikolaaa
NikolaaaOP3y ago
always says it has an update but the raw on pastebin is 0.0.1
Angius
Angius3y ago
Ah, right Well You have ! there And the file does not contain 0.0.2 So... it's true
Nikolaaa
NikolaaaOP3y ago
oh I forgot to delete ! because I tried making it when it detects that the version is not the current one then it updates also Is there a way to make everything update for example if I would add dlls it would not update it only updates the exe
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("yourhostinglink", @"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("yourhostinglink", @"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);
}
}
Angius
Angius3y ago
Not sure, never had to build any sort of an updater
Want results from more Discord servers?
Add your server