Hack Forums
[.NET] [VB.net]Application patcher using dropbox - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] [VB.net]Application patcher using dropbox (/showthread.php?tid=4662154)



[VB.net]Application patcher using dropbox - titanbullet - Jan 30, 2015

I've been asked to make an application patcher so unstead of keeping it to myself i am releasing it to the public! If you have any questions feel free to ask.

i.imgur com/WL0cc41 .png
Code
Imports System.Net
Imports System.IO
Imports System.IO.Compression

Public Class Form1

    'Dims
    Dim masterpath As String = "where is the installed program"
    Dim versioncheck As String = "yoursite .com/version.txt"
    Dim link As String = "direct link for zip file"
    Dim zipPath As String = masterpath & "downloads\update.zip"
    Dim extractPath As String = masterpath & "files"
    Dim checkerplace As String = masterpath & "downloads\checker.dat"
    '#########################################
    '#                                       #
    '#          Application Patcher          #
    '#          Made by titanbullet          #
    '#            Version 1.0.0.0            #
    '#         Don't forget to update        #
    '#           the app.manifest            #
    '#                                       #
    '#########################################

    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        'Gets if its the first time running the patcher. If it is,it opens "Installer" form.
        If IO.File.Exists(checkerplace) Then My.Settings.Installed = True
        If My.Settings.Installed = True Then
            'Gets and sets the current application number
            Dim currentversion As String
            currentversion = Application.ProductVersion
            oldversion.Text = currentversion
            'Gets version.txt from server and sets it on label
            Dim request = DirectCast(WebRequest.Create(versioncheck), HttpWebRequest)
            Dim response = DirectCast(request.GetResponse(), HttpWebResponse)
            Using sr As New StreamReader(response.GetResponseStream())
                Dim versionnew As String
                versionnew = sr.ReadLine
                NewVersion.Text = versionnew
            End Using
            'Compares the versions and informs the user if needed
            If oldversion.Text = NewVersion.Text Then
                'Insert your form connection here (mainform.Show-Me.close)
            ElseIf oldversion.Text < NewVersion.Text Then
                MsgBox("New update found!", MsgBoxStyle.Critical, "Update found!")
                'Deletes old files
                IO.Directory.Delete(extractPath, True)
                'Creates the directory again
                IO.Directory.CreateDirectory(extractPath)
                'Downloads the update package
                My.Computer.Network.DownloadFile(link, masterpath & "downloads\update.zip")
                'Extracts
                ZipFile.ExtractToDirectory(zipPath, extractPath)
                'Deletes the update zip
                IO.File.Delete(masterpath & "downloads\update.zip")
            End If
        ElseIf My.Settings.Installed = False Then
            'installer.show
        End If
    End Sub
End Class
[/quote]


* - rtsuniversal - Jan 30, 2015

Why don't you just use wyDay's WyBuild?


* - hellomen - Jan 30, 2015

Althrough it's a good snippet
I don't think it's even worth asking credits for....
Alot of people (behave newbies) know this kind of stuff already.
It's the same asking credits for making a messagebox with yes/no... {in my opinion}

Behave must have been except, sorry for the mistake.


* - titanbullet - Jan 31, 2015

(Jan 30, 2015 10:26 PM)hellomen Wrote:  Althrough it's a good snippet
I don't think it's even worth asking credits for....
Alot of people (behave newbies) know this kind of stuff already.
It's the same asking credits for making a messagebox with yes/no... {in my opinion}

I didn't ask for credits tho. And I am pretty sure this isn't begginer stuff,but even if it is I posted it to help others ;)


(Jan 30, 2015 08:19 PM)rtsuniversal Wrote:  Why don't you just use wyDay's WyBuild?

I am not familiar with what that is,sadly.


* - hellomen - Jan 31, 2015

(Jan 31, 2015 06:19 AM)titanbullet Wrote:  I didn't ask for credits tho. And I am pretty sure this isn't begginer stuff,but even if it is I posted it to help others ;)



I am not familiar with what that is,sadly.

I was talking about that made by block...
I said most already knows it, except* beginners


* - titanbullet - Jan 31, 2015

(Jan 31, 2015 07:06 AM)hellomen Wrote:  I was talking about that made by block...
I said most already knows it, except* beginners

Oh,that was just to inform everyone to change the permissions on app.manifet,and that would make it prettier.
Sorry about the begginers part,my misunderstanding.


* - hellomen - Jan 31, 2015

(Jan 31, 2015 09:52 AM)titanbullet Wrote:  Oh,that was just to inform everyone to change the permissions on app.manifet,and that would make it prettier.
Sorry about the begginers part,my misunderstanding.

No it wasn't your fault, I miswrote it...
Behave had to be except xD

Well thanks for saying nice contribution tho. Maybe using images will help, against the c+p kiddies ;)