I'm trying to create a version checker in C#. But I have a little problem.
I have a webpage, containing only the version. (http://ircbot.aoe3capitol.nl/e107_plugins/ircbot_menu/version.php)
I want that version to a double in C# so I can compare it with the version of the program.
But the problem is, when I use Convert.ToDouble or double.Parse the dots disapear, so the version will become 35 instead of 0.3.5.
How can I fix this?
My Function:
I have a webpage, containing only the version. (http://ircbot.aoe3capitol.nl/e107_plugins/ircbot_menu/version.php)
I want that version to a double in C# so I can compare it with the version of the program.
But the problem is, when I use Convert.ToDouble or double.Parse the dots disapear, so the version will become 35 instead of 0.3.5.
How can I fix this?
My Function:
C#:
private void Checkversion()
{
System.Net.WebClient wClient = new System.Net.WebClient();
byte[] buffer = wClient.DownloadData(@"http://ircbot.aoe3capitol.nl/e107_plugins/ircbot_menu/version.php");
double latest_version = double.Parse(System.Text.Encoding.Default.GetString(buffer, 0, buffer.Length));
double current_version = double.Parse(settings.Version);
wClient.Dispose();
MessageBox.Show("Latest: " + latest_version.ToString() + "\nCurrent: " + current_version.ToString());
if(current_version < latest_version)
{
DialogResult result = MessageBox.Show("Er is een nieuwe versie van Lucky Bot beschikbaar. Wil je deze nu downloaden?", "Nieuwe versie", MessageBoxButtons.YesNo, MessageBoxIcon.Question);
if(result == DialogResult.Yes)
{
System.Diagnostics.Process.Start("http://sourceforge.net/project/showfiles.php?group_id=164639&package_id=186478");
Application.Exit();
}
}
}
Last edited: