File size: 1,315 Bytes
b1b3bae |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
Imports System.Net
Public Class UpdateCheck
Public Shared Function CheckForUpdates() As Boolean
Try
Dim webClient = New WebClient()
Dim url = New Uri("https://dwsim.org/update/desktop.txt")
Dim latestversion As String = ""
latestversion = webClient.DownloadString(url)
If latestversion = "" Then Return False
latestversion = latestversion.TrimEnd(vbCrLf).TrimEnd(Environment.NewLine).TrimEnd()
Dim currver = New Version(GlobalSettings.Settings.CurrentRunningVersion)
Dim latver = New Version(latestversion)
If latver > currver Then
Return True
Else
Return False
End If
Catch ex As Exception
Console.WriteLine("Error checking latest version: " & ex.ToString)
Return False
End Try
End Function
Public Shared Function GetWhatsNew() As String
Try
Dim webClient = New WebClient()
Dim url = New Uri("https://dwsim.org/update/whatsnew_d.txt")
Dim whatsnew As String = ""
whatsnew = webClient.DownloadString(url)
Return whatsnew
Catch ex As Exception
Return ""
End Try
End Function
End Class
|