Public Class Form1
Inherits System.Windows.Forms.Form
#Region " Windows Form Designer generated code "
Public Sub New()
MyBase.New()
'This call is required by the Windows Form Designer.
InitializeComponent()
'Add any initialization after the InitializeComponent() call
End Sub
'Form overrides dispose to clean up the component list.
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Required by the Windows Form Designer
Private components As System.ComponentModel.IContainer
'NOTE: The following procedure is required by the Windows Form Designer
'It can be modified using the Windows Form Designer.
'Do not modify it using the code editor.
Friend WithEvents MainMenu1 As System.Windows.Forms.MainMenu
Friend WithEvents MenuItem1 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem2 As System.Windows.Forms.MenuItem
Friend WithEvents MenuItem3 As System.Windows.Forms.MenuItem
Friend WithEvents Button1 As System.Windows.Forms.Button
Friend WithEvents overallprogress As System.Windows.Forms.ProgressBar
Friend WithEvents curprogress As System.Windows.Forms.ProgressBar
Friend WithEvents overalltextprogress As System.Windows.Forms.Label
Friend WithEvents curtextprogress As System.Windows.Forms.Label
Public WithEvents curtextfile As System.Windows.Forms.Label
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.MainMenu1 = New System.Windows.Forms.MainMenu
Me.MenuItem1 = New System.Windows.Forms.MenuItem
Me.MenuItem2 = New System.Windows.Forms.MenuItem
Me.MenuItem3 = New System.Windows.Forms.MenuItem
Me.Button1 = New System.Windows.Forms.Button
Me.overallprogress = New System.Windows.Forms.ProgressBar
Me.curprogress = New System.Windows.Forms.ProgressBar
Me.overalltextprogress = New System.Windows.Forms.Label
Me.curtextprogress = New System.Windows.Forms.Label
Me.curtextfile = New System.Windows.Forms.Label
Me.SuspendLayout()
'
'MainMenu1
'
Me.MainMenu1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem1})
'
'MenuItem1
'
Me.MenuItem1.Index = 0
Me.MenuItem1.MenuItems.AddRange(New System.Windows.Forms.MenuItem() {Me.MenuItem2, Me.MenuItem3})
Me.MenuItem1.Text = "Config"
'
'MenuItem2
'
Me.MenuItem2.Index = 0
Me.MenuItem2.Text = "Internet"
'
'MenuItem3
'
Me.MenuItem3.Index = 1
Me.MenuItem3.Text = "Local settings"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(160, 104)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(104, 23)
Me.Button1.TabIndex = 0
Me.Button1.Text = "Check for updates"
'
'overallprogress
'
Me.overallprogress.Location = New System.Drawing.Point(8, 80)
Me.overallprogress.Name = "overallprogress"
Me.overallprogress.Size = New System.Drawing.Size(256, 16)
Me.overallprogress.TabIndex = 1
'
'curprogress
'
Me.curprogress.Location = New System.Drawing.Point(8, 32)
Me.curprogress.Name = "curprogress"
Me.curprogress.Size = New System.Drawing.Size(256, 16)
Me.curprogress.TabIndex = 2
'
'overalltextprogress
'
Me.overalltextprogress.Location = New System.Drawing.Point(8, 56)
Me.overalltextprogress.Name = "overalltextprogress"
Me.overalltextprogress.Size = New System.Drawing.Size(100, 16)
Me.overalltextprogress.TabIndex = 3
Me.overalltextprogress.Text = "Overall:"
'
'curtextprogress
'
Me.curtextprogress.Location = New System.Drawing.Point(8, 8)
Me.curtextprogress.Name = "curtextprogress"
Me.curtextprogress.Size = New System.Drawing.Size(100, 16)
Me.curtextprogress.TabIndex = 4
Me.curtextprogress.Text = "Current file:"
'
'curtextfile
'
Me.curtextfile.Location = New System.Drawing.Point(120, 8)
Me.curtextfile.Name = "curtextfile"
Me.curtextfile.Size = New System.Drawing.Size(144, 16)
Me.curtextfile.TabIndex = 5
Me.curtextfile.Text = "n/a"
'
'Form1
'
Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
Me.ClientSize = New System.Drawing.Size(272, 131)
Me.Controls.Add(Me.curtextfile)
Me.Controls.Add(Me.curtextprogress)
Me.Controls.Add(Me.overalltextprogress)
Me.Controls.Add(Me.curprogress)
Me.Controls.Add(Me.overallprogress)
Me.Controls.Add(Me.Button1)
Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle
Me.MaximizeBox = False
Me.Menu = Me.MainMenu1
Me.Name = "Form1"
Me.Text = "WoWup v0.11 [BETA]"
Me.ResumeLayout(False)
End Sub
#End Region
Public Sub Download(ByVal url As String, ByVal fnm As String, ByVal sender As Object, ByVal e As System.EventArgs)
If File.Exists(fnm) = False Then
Dim size As Integer = 0
Dim req As HttpWebRequest = CType(WebRequest.Create(url), HttpWebRequest)
Dim resp As HttpWebResponse = CType(req.GetResponse, HttpWebResponse)
Dim instm As Stream = resp.GetResponseStream
Dim outstm As Stream = New FileStream(fnm, FileMode.CreateNew, FileAccess.Write)
Dim b(1000) As Byte
Dim n As Integer
n = instm.Read(b, 0, b.Length)
Me.curtextfile.Text = fnm
While (n > 0)
outstm.Write(b, 0, n)
n = instm.Read(b, 0, b.Length)
End While
outstm.Close()
instm.Close()
resp.Close()
End If
Me.curtextfile.Text = fnm
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim files(1000) As String
Dim i As Integer = 0
files(0) = "gtasa.jpg"
files(1) = "index.html"
files(2) = "sys.wowdb"
While (files(i) > "")
Download("
http://localhost/" & files(i), files(i), sender, e)
i = i + 1
End While
End Sub
End Class