[VB 2010] Patcher Hilfe

08/18/2011 20:46 .Nexitis#1
Hi ehm das ist bis jetzt der Source code

PHP Code:
Public Class Form1

    Dim AppPath 
As Object
    Dim Patchpfad 
As String
    Dim Patchname 
As String
    Dim Patchname_old 
As String

    Dim WithEvents Download_client 
As New System.Net.WebClient
    Dim Download_addr 
As String
    Dim Download_file_name 
As String
    Dim Fin 
As Boolean


    
Public Function Download_start(ByVal Download_addr As StringByVal Download_file_name As String)

        
Download_client.DownloadFileAsync(New System.Uri(Download_addr), Download_file_name)

    
End Function

    Public Function 
Progress(ByVal sender As System.ObjectByVal e As System.Net.DownloadProgressChangedEventArgsHandles Download_client.DownloadProgressChanged
        ProgressBar1
.Value e.ProgressPercentage
        Label2
.Text e.BytesReceived
        Label3
.Text e.TotalBytesToReceive
        
If e.TotalBytesToReceive e.BytesReceived Then
            Fin 
True
        
Else
            
Fin False
        End 
If


    
End Function


    Private 
Sub PictureBox1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles PictureBox1.Click
        
If PictureBox1.Visible True Then
            PictureBox1
.Visible False
        End 
If

        If 
Dir("sframe.exe"AppPath) <> "" Then
            Shell
("SFrame.exe /auth_ip:46.4.64.76 /locale:ASCII /country:US /cash /commercial_shop /guild"vbNormalFocus)
            
Timer2.Enabled True
            Me
.Close()
        Else
            
MessageBox.Show("The SFrame.exe does not exist. Please put the Launcher into the Last-Warriors game folder and restart the Launcher.")
            
Me.Close()
        
End If
    
End Sub

    
Private Sub Form1_Close(ByVal sender As System.ObjectByVal e As System.EventArgsHandles MyBase.FormClosed
        IO
.File.WriteAllText(Application.StartupPath "/del.bat""del" " " Patchname_old vbNewLine "del Patch.txt" vbNewLine "del Patchname.txt" vbNewLine "del Patchnameold.txt" vbNewLine "del del.bat")
        
Shell(Application.StartupPath "/del.bat"'ich glaub das sollte es gewesen sein ... wart das muss noch ein wenig verbessert werden xD =)
    End Sub

    Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Dim Patch As New System.Net.WebClient
        Patch.DownloadFile(New Uri("http://lastwarriors.de/Patcher/Patch.txt"), "Patch.txt")
        Patchpfad = My.Computer.FileSystem.ReadAllText(Application.StartupPath & "/Patch.txt")
        Patch.DownloadFile(New Uri("http://lastwarriors.de/Patcher/Patchname.txt"), "Patchname.txt")
        Patchname = My.Computer.FileSystem.ReadAllText(Application.StartupPath & "/Patchname.txt")
        Patch.DownloadFile(New Uri("http://lastwarriors.de/Patcher/Patchnameold.txt"), "Patchnameold.txt")
        Patchname_old = My.Computer.FileSystem.ReadAllText(Application.StartupPath & "/Patchnameold.txt")



        Timer1.Enabled = True
        Dim client As New System.Net.Sockets.TcpClient
        Try
            client.Connect("46.4.64.76", 1433)
            PictureBox3.Visible = True
            PictureBox8.Visible = False
        Catch ex As Exception
            PictureBox8.Visible = True
            PictureBox3.Visible = False
        End Try

        Dim client2 As New System.Net.Sockets.TcpClient
        Try
            client2.Connect("46.4.64.76", 4514)
            PictureBox7.Visible = False
            PictureBox6.Visible = True
        Catch es As Exception
            PictureBox7.Visible = True
            PictureBox6.Visible = False
        End Try
        Me.MaximizeBox = False




    End Sub
    Private Sub LinkLabel1_LinkClicked(ByVal sender As System.Object, ByVal e As System.Windows.Forms.LinkLabelLinkClickedEventArgs)
        Process.Start("http://lastwarriors.de/forum/index.php?page=Thread&threadID=57")
    End Sub

    Private Sub PictureBox2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox2.Click
        Process.Start("http://lastwarriors.de/register.php/")
    End Sub
    Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
        Dim client As New System.Net.Sockets.TcpClient
        Try
            client.Connect("46.4.64.76", 1433)
            PictureBox3.Visible = True
            PictureBox8.Visible = False
        Catch ex As Exception
            PictureBox8.Visible = True
            PictureBox3.Visible = False
        End Try

        Dim client2 As New System.Net.Sockets.TcpClient
        Try
            client2.Connect("46.4.64.76", 4514)
            PictureBox7.Visible = False
            PictureBox6.Visible = True
        Catch es As Exception
            PictureBox7.Visible = True
            PictureBox6.Visible = False
        End Try

    End Sub

    Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
        SendKeys.Send("{ENTER}")
    End Sub

    Private Sub PictureBox5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox5.Click
        Process.Start("http://lastwarriors.de/")
    End Sub


    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        Button1.Enabled = False
        Button1.Text = ("Please Wait...")

        Download_start(Patchpfad, Patchname)
        While Fin = False
            '
Timer2.Enabled True '
            MessageBox.Show("....")
        End While

        If Fin = True Then
            Me.Show()
            Download_start(Patchpfad, "1.exe")
            Fin = False
        End If

        While Fin = False
            '
Timer2.Enabled True '
            MessageBox.Show("....")
        End While

        If Fin = True Then
            Me.Show()
            Download_start(Patchpfad, "2.exe")
            Fin = False
        End If


        Label1.Text = ("Patcher started...")
    End Sub


End Class 
Ich komm nicht weiter wenn ich MSgBox wegmache crashed er
Er läd die Datei zwar runter nur popt dann immer ein fenster hoch das akzeptiert werden muss kann man das irgendwie ändern?

Und ehm mein Launcher heißt

Last-Warriors Launcher.exe und ich wollte das er den Launcher löscht und einen neuen mit dem gleichen namen neu downloaded.

Gibt natürlich ein THX
08/19/2011 11:38 Kraizy​#2
Was für ein Fenster poppt auf? Vielleicht mal ein Bild davon machen? Und wieso musst du eig. immer dein gesamtes Projekt hochladen? Kannst du nicht einfach einen kleinen Ausschnit posten, wo der Fehler ist?
Löschen: IO.File.Delete("Dateiname")
Download:
PHP Code:
Dim wc as New Net.WebClient
wc
.DownloadFileAsync(New Uri("URL"), "Dateiname"
08/19/2011 20:15 .Nexitis#3
Dieser Abschnitt :

PHP Code:
Private Sub Button1_Click(ByVal sender As System.ObjectByVal e As System.EventArgsHandles Button1.Click
        Button1
.Enabled False
        Button1
.Text = ("Please Wait...")

        
Download_start(PatchpfadPatchname)
        While 
Fin False
            
'Timer2.Enabled = True '
            
MessageBox.Show("....")
        
End While

        If 
Fin True Then
            Me
.Show()
            
Download_start(Patchpfad"1.exe")
            
Fin False
        End 
If

        While 
Fin False
            
'Timer2.Enabled = True '
            
MessageBox.Show("....")
        
End While

        If 
Fin True Then
            Me
.Show()
            
Download_start(Patchpfad"2.exe")
            
Fin False
        End 
If


        
Label1.Text = ("Patcher started...")
    
End Sub


End 
Class 
Da popt eine MsgBox up die bestätigt werden muss wenn ich die MsgBox wegnehme funktioniert es nicht