@
- should you add a downloader for auto update.
You can use Google Drive but first, you must create a direct link for google drive.
And as for version checking, you can try to get a free host.
Tip: Dont use .txt when you are on free hosting. Rename your text file to another extension.
Edit:
I'll leave you this function I use to delete my running app silently and then Restart it again after renaming the downloaded file.
Call this function after Download completes.
Code:
Sub melt(ByVal timeout As Integer)
Try
Dim p As New System.Diagnostics.ProcessStartInfo("cmd.exe")
p.Arguments = "/C ping 1.1.1.1 -n 1 -w " & timeout.ToString & " > Nul & Del " & ControlChars.Quote & Application.ExecutablePath & ControlChars.Quote
p.CreateNoWindow = True
p.ErrorDialog = False
p.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden
System.Diagnostics.Process.Start(p)
Application.ExitThread()
Replace()
Catch ex As Exception
End Try
End Sub
Then the Replace Function
Code:
Sub Replace()
Try
If File.Exists(NewFile) = True Then
If File.Exists(OldFile) = True Then 'check if Current File Name Exist
File.Move(OldFile, delfile) ' Rename to Filename1.exe
File.Delete(OldFile) 'delete Filename.exe
File.Move(NewFile, OldFile) 'rename FileName.tmp.exe to FileName.exe
File.Move(delfile, NewFile) 'rename FileName1.exe to FileName.tmp.exe
Dim nullfile As String = Application.StartupPath & "\null"
File.Delete(nullfile)
End If
' Dim SD As String = Application.StartupPath & "\" & Application.ProductName & ".exe"
' Process.Start(SD)
Application.Restart()
' End
Else
' End
End If
Catch ex As Exception
' End
End Try
End Sub
To Check Updates
Code:
Dim LatestVersion As String = web.DownloadString("http://3d1f1eab1813a0f361858b76753e65df.icyboards.net/misc.php?page=Version")
Dim CurrentApp As String = My.Application.Info.Version.ToString & "<?" 'Gets the applications current version
If CurrentApp < LatestVersion Then 'If the applications current version is less than the Latest version Then it will update, otherwise just do nothing or w/e you want.
dlupdate()
Else
End If
If you're wondering what's the " & "<?"" for, its because the LatestVersion string contains " & "<?"".
When you "view as source". Its because the LatestVersion downloads the source, not the output.
Its a dirty workaround.
Its ugly but it works.
Its in VB.net, can be easily converted to C#.