Hallo Community,
ich habe ein kleines Problem
Ich habe einen Patcher geschrieben, der sich eine Liste holt mit den Daten und dann diese Überprüft nach Größe und wenn diese nicht mit der lokalen Datein übereinstimmt, wird die Datei gedownloadet.
Allerdings hängt sich das programm immer nach der 4ten Datei auf
Spoiler anzeigen
hier ist ma die source
ich habe ein kleines Problem
Ich habe einen Patcher geschrieben, der sich eine Liste holt mit den Daten und dann diese Überprüft nach Größe und wenn diese nicht mit der lokalen Datein übereinstimmt, wird die Datei gedownloadet.
Allerdings hängt sich das programm immer nach der 4ten Datei auf
VB.NET-Quellcode
- Imports System.IO, System.Net, System.Text
- Public Class Form1
- Declare Sub Sleep Lib "kernel32" (ByVal dwMilliseconds As Long)
- Dim WithEvents client As New WebClient
- Private Sub Form1_FormClosing(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosingEventArgs) Handles Me.FormClosing
- Try
- System.IO.File.Delete("patch.txt")
- Catch : End Try
- Try
- System.IO.File.Delete("browserpic1.jpg")
- Catch : End Try
- End Sub
- Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
- Try
- client.DownloadFile("http://*******.de/patch.txt", "patch.txt")
- Catch ex As Exception
- MsgBox("Fehler beim Übertragen der Patchlist!", MsgBoxStyle.Exclamation, "Patchlist")
- Me.Close()
- End Try
- TextBox1.ReadOnly = True
- client.DownloadFile("http://********.de/browserpic1.jpg", "browserpic1.jpg")
- PictureBox1.ImageLocation = "browserpic1.jpg"
- If Not Directory.Exists("pack") Then
- Directory.CreateDirectory("pack")
- End If
- If Not Directory.Exists("lib") Then
- Directory.CreateDirectory("lib")
- End If
- If Not Directory.Exists("mark") Then
- Directory.CreateDirectory("mark")
- End If
- If Not Directory.Exists("miles") Then
- Directory.CreateDirectory("miles")
- End If
- Dim i As Integer = 0
- For Each file In System.IO.File.ReadAllLines("patch.txt")
- i += 1
- Next
- ProgressBar1.Maximum = i
- End Sub
- Private Sub Form1_Shown(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Shown
- TextBox1.AppendText(">>Patcher by Nixodas<<" & vbNewLine)
- ProgressBar1.Value = 0
- Application.DoEvents()
- patch()
- End Sub
- Private Sub patch()
- For Each l In System.IO.File.ReadAllLines("patch.txt")
- Try
- TextBox1.AppendText("Überprüfung von: " & l & vbNewLine)
- Try
- Dim inetsize
- Dim request As FileWebRequest = CType(WebRequest.Create("http://*******.de/" & l), FileWebRequest)
- Dim response As FileWebResponse = CType(request.GetResponse(), FileWebResponse)
- inetsize = response.ContentLength
- If System.IO.File.Exists(l) Then
- Dim inf As New FileInfo(l)
- Dim locasize As Long
- locasize = inf.Length
- If locasize <> inetsize Then
- Try
- client.DownloadFileAsync(New Uri("http://********.de/" & l), l)
- TextBox1.AppendText("Download von: " & l & vbNewLine)
- TextBox1.ScrollToCaret()
- Catch ex2 As Exception
- TextBox1.AppendText("Fehler bei: " & l & vbNewLine)
- TextBox1.ScrollToCaret()
- End Try
- End If
- Else
- client.DownloadFileAsync(New Uri("http://*******.de/" & l), l)
- TextBox1.AppendText("Download von: " & l & vbNewLine)
- TextBox1.ScrollToCaret()
- End If
- Catch : End Try
- Catch
- TextBox1.AppendText("Fehler bei: " & l & vbNewLine)
- TextBox1.ScrollToCaret()
- End Try
- ProgressBar1.Value = ProgressBar1.Value + 1
- Application.DoEvents()
- Next
- Panel3.Visible = True
- End Sub
- Private Sub client_DownloadProgressChanged(ByVal sender As Object, ByVal e As System.Net.DownloadProgressChangedEventArgs) Handles client.DownloadProgressChanged
- ProgressBar2.Value = e.ProgressPercentage
- End Sub
- Private Sub Panel1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel1.Click
- Try
- System.IO.File.Delete("patch.txt")
- Catch : End Try
- Try
- System.IO.File.Delete("browserpic1.jpg")
- Catch : End Try
- End
- End Sub
- Private Sub Panel2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel2.Click
- Process.Start("http://www.******.de/index.php")
- End Sub
- Private Sub Panel3_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Panel3.Click
- Try
- Process.Start("programm.exe")
- Catch
- MsgBox("Die Datei programm.exe wurde nicht gefunden", MsgBoxStyle.Critical, "FatalError")
- End Try
- Try
- System.IO.File.Delete("patch.txt")
- Catch : End Try
- Try
- System.IO.File.Delete("browserpic1.jpg")
- Catch : End Try
- End Sub
- End Class
hier ist ma die source