Please Help with this code Auto Update

11/13/2019 07:57 Stayll1#1
Please Help with this code Auto Update APP
HTML Code:
Private Sub AutoPatcher1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles AutoPatcher1.DoWork
        On Error Resume Next
        'AutoPatcher
        Dim base As String = "https://stayll.xyz/APP/patch/"
        Dim startup As String = Application.StartupPath
        Kill(startup + "\Stayll\version.txt")
        My.Computer.Network.DownloadFile(base + "version.txt", startup + "\Stayll\version.txt")
        Dim newversion As Double = Convert.ToDouble(My.Computer.FileSystem.ReadAllText(startup + "\Stayll\version.txt"))
        If newversion > Application.ProductVersion Then
            Translation.msg("AutoPatcher", "NEW_VERSION", MsgBoxStyle.Information)
            Cancel_File()
        Else
            Cancel_File()
        End If
    End Sub
File version.txt
1.0.0.0
__________________________________________________ ________
After open give me new version
11/13/2019 13:24 florian0#2
Quote:
Originally Posted by Stayll1 View Post
HTML Code:
Private Sub AutoPatcher1_DoWork(sender As Object, e As System.ComponentModel.DoWorkEventArgs) Handles AutoPatcher1.DoWork
...
        Dim newversion As Double = Convert.ToDouble(My.Computer.FileSystem.ReadAllText(startup + "\Stayll\version.txt"))
...
End Sub
File version.txt
1.0.0.0
There's an error when converting the version to double. A double usually has only one dot. Like 1.0, 2.5, 3.14. Your version has three dots. That's not going to work.
11/13/2019 14:51 Ludder231#3
you should use the Version-Class.

Code:
Version v1 = new Version(2, 0);
Version v2 = new Version("2.1");
Console.Write("Version {0} is ", v1);
switch(v1.CompareTo(v2))
{
   case 0:
      Console.Write("the same as");
      break;
   case 1:
      Console.Write("later than");
      break;
   case -1:
      Console.Write("earlier than");
      break;
}
Console.WriteLine(" Version {0}.", v2);