Automatic update check

Discussion in 'Mixed Languages' started by QuantumBug, Jul 20, 2012.

  1. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,488
    1,329
    60
    #1 QuantumBug, Jul 20, 2012
    Last edited: Jul 25, 2012
    [SOLVED] - Automatic update check

    Can anyone recommend a good free place to host my version.txt?

    My application receives an incorrect reponse from Mediafire =/
     
  2. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,886
    20,248
    180
    Use your own thread with the current version :eek::D
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  3. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,488
    1,329
    60
    As in use my streamreader to create a request on my forum post =/??
     
  4. Alphawaves

    Alphawaves Super Moderator/Developer
    Staff Member

    Aug 11, 2008
    5,886
    20,248
    180
    #4 Alphawaves, Jul 20, 2012
    Last edited by a moderator: Apr 20, 2017
    Or maybe this, add your current version to your thread and look for it:

    Code:
    Public Shared version As String = Assembly.GetExecutingAssembly.GetName.Version.ToString
    
     Dim Request As HttpWebRequest = DirectCast(WebRequest.Create("http://forums.mydigitallife.net/threads/32680-WinTK-The-Windows-multi-tool?p=559102&viewfull=1#post559102"), HttpWebRequest)
            Request.Method = "GET"
            Dim rs As WebResponse = Request.GetResponse()
            Dim sr As New StreamReader(rs.GetResponseStream(), Encoding.UTF8)
            Dim check As String = sr.ReadToEnd()
            sr.Close()
            rs.Close()
            If Not check.Contains(version) Then
                'Update available
            End If
    :eek:
     
    Stop hovering to collapse... Click to collapse... Hover to expand... Click to expand...
  5. QuantumBug

    QuantumBug MDL Developer

    Mar 7, 2012
    1,488
    1,329
    60
    #5 QuantumBug, Jul 20, 2012
    Last edited by a moderator: Apr 20, 2017
    (OP)
    Sorted it, it was mediafire causing the issue.

    I used a free text host, the file never expires, link alays stays the same and you have an admin password to edit when an update is available. I run the below on a new handled thread (New System.Threading.Thread) so the about section doesn't stop responding.

    Code:
        Public Sub CheckUpdate()
    
            Dim req As System.Net.HttpWebRequest = System.Net.HttpWebRequest.Create("http://myversion.com")
    
            Dim res As System.Net.HttpWebResponse = req.GetResponse()
            Dim stre As System.IO.StreamReader = New System.IO.StreamReader(res.GetResponseStream())
            Dim nv As String = stre.ReadToEnd()
            res.Close()
            stre.Close()
            Dim cv As String = Application.ProductVersion
            If nv.Contains(cv) Then
                'Continue code
            Else
                'My update code
                End If
        End Sub
    


    Thanks, Alpha.