1
Well, I’m creating an upgrade system, and it’s giving error in one part
WebClient web = new WebClient();
string DownloadVersion = web.DownloadString("https://drive.google.com/uc?authuser=0&id=1bpVdsyUj3oOn1gLbcVRE7uZjIczI5Yc_&export=download");
string UltimaVersao = DownloadVersion.Split('\n')[0];
string VersaoDessePrograma = Application.ProductVersion;
if (Convert.ToDecimal(VersaoDessePrograma) < Convert.ToDecimal(UltimaVersao))
{
if (MessageBox.Show("Um novo update está disponivel!" + Environment.NewLine + "Você quer atualizar?", "Atualização", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
web.DownloadFile(DownloadVersion.Split('\n')[1], "Algoritmos 1.0.1.exe");
MessageBox.Show("O programa foi baixado!" + Environment.NewLine + "O aplicativo será fechado.", "Atualização", MessageBoxButtons.OK, MessageBoxIcon.Information);
System.Diagnostics.Process.Start(Application.StartupPath + @"\Algoritmos 1.0.1.exe");
Close();
}
}
else
{
MessageBox.Show("O programa já está atualizado!", "Verificador", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
That mistake is as follows, when I put in line web.DownloadFile
in the filename part the following code: Algoritmos 1.0.1.exe
usually works. But when I use the last version variable: Algoritmos " + UltimaVersao + ".exe
, throws an error.
Go to image using code Algoritmos 1.0.1.exe
:
Go to image using code Algoritmos " + UltimaVersao + ".exe
:
Why does this mistake happen? How to fix it? Can you help me? Thank you!
Where Ultimaversion = "1.0.1"
– Lucas Bittencourt
Lucas sure Ultimaversao hasn’t been changed? Try using one
MessageBox.Show(UltimaVersao);
orConsole.Write(UltimaVersao)
to make sure that the value of this variable does not have characters like line breaks, tabulations, nulls or other signs like:
and?
– Guilherme Nascimento