'm having some problems, can't findout what is problem with my Update system. I'm using XML file for it. What I'm trying is to get application to read xml file for updates(like some news system) and to get updating application if there is new version. I added already on top of project ReadOnly _reader As XmlReader = XmlReader.Create("C:\launchernews.xml")
Still update system doesnt work, but news system does.
Here is code of it:
Public Sub AutoUpdate()
Dim CurrentVersion As String = My.Application.Info.Version.ToString
Dim ProgramName As String
Dim GetVer, GetVerLink As String
Dim GetUpd As Integer
Using _reader
While _reader.Read()
' Check for start elements.
If _reader.IsStartElement() Then
If _reader.Name = "application" Then
Dim attribute As String = _reader("name")
If attribute IsNot Nothing Then
ProgramName = attribute
End If
' Text data.
If _reader.Name = "version" Then
Dim version As String = _reader("name")
If version IsNot Nothing Then
GetVer = version
If _reader.Read() Then
GetVerLink = _reader.Value.Trim()
End If
End If
End If
End If
End If
If GetVer > CurrentVersion Then
GetUpd = MsgBox(ProgramName & " is an old version." & vbCrLf & "New Update is available" & _
vbCrLf & "Current version: " & CurrentVersion & vbCrLf & "Version Avalible: " & _
GetVer & vbCrLf & vbCrLf & "Update Now?", vbYesNo, "Update")
If GetUpd = vbYes Then
Dim sfd As New SaveFileDialog
sfd.FileName = IO.Path.GetFileName(GetVerLink)
If sfd.ShowDialog = True Then
My.Computer.Network.DownloadFile(GetVerLink, sfd.FileName)
End If
End If
Else
MsgBox(ProgramName & " is upto date." & vbCrLf & "Current version: " & CurrentVersion, 0, "Update")
End If
End While
End Using
End Sub
Here is XML file:
<?xml version="1.0" encoding="UTF-8"?>
<Launcher>
<news name="Latest Updates">
We thank you for your patience throughout this update.
</news>
<application name="Launcher">
<version name="1.0.0.0">
</version>
</application>
</Launcher>