Public Class Form1
Private Property AktuelleZeitString As String
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick
Dim Chatroom As String = Me.TextBox1.Text
Try
My.Computer.Network.DownloadFile("
ftp://192.168.1.50/" & Chatroom & ".txt", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\chat-ordner\" & Chatroom & ".txt", "test", "fuckyou36", False, 60000, True)
Dim ChatProtokoll As String = My.Computer.FileSystem.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\chat-ordner\" & Chatroom & ".txt")
Me.TextBoxProtokoll.Text = ChatProtokoll
Catch
End Try
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim Chatroom As String = Me.TextBox1.Text
Try
Dim Nachricht As String = AktuelleZeit() & " _ " & Me.TextBoxName.Text & ": " & Me.TextBoxNachricht.Text
Dim ChatProtokoll As String
Try
ChatProtokoll = My.Computer.FileSystem.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\chat-ordner\" & Chatroom & ".txt")
Catch
ChatProtokoll = ""
End Try
Dim UploadString As String = ChatProtokoll & vbNewLine & Nachricht
My.Computer.FileSystem.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\chat-ordner\" & Chatroom & "_upload.txt", UploadString, False)
My.Computer.Network.UploadFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "\chat-ordner\" & Chatroom & "_upload.txt", "
ftp://192.168.1.50/", "test", "fuckyou36")
Catch
End Try
End Sub
Private Function AktuelleZeit()
Dim AktuelleZeitString As String
AktuelleZeitString = Now.Day & "." & Now.Month & "." & Now.Year & "." & Now.Hour & "." & Now.Second
Return AktuelleZeitString
End Function
Private Sub PictureBox1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles PictureBox1.Click
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
If Me.Button2.Text = "Beitreten" Then
Me.Button2.Text = "Verlassen"
Me.Button1.Enabled = True
Me.Timer1.Enabled = True
Me.TextBox1.Enabled = False
Me.Timer2.Enabled = True
'BETRETEN
Else
Me.Button2.Text = "Betreten"
Me.Button1.Enabled = False
Me.Timer1.Enabled = False
Me.TextBox1.Enabled = True
Me.Timer2.Enabled = False
'VERLASSEN
End If
End Sub
Private Sub TextBox2_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs)
PrivateNachricht.Show()
End Sub
Private Sub Timer2_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer2.Tick
Dim Name As String = Me.TextBoxName.Text
My.Computer.Network.DownloadFile("
ftp://192.168.1.50/" & Name & ".txt", Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "user_message/" & Name & ".txt", "test", "fuckyou36", False, 60000, True)
Dim Message As String = My.Computer.FileSystem.ReadAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "user_message/" & Name & ".txt")
Dim TMP() As String = Split(Message, " _ ")
Dim AktuelleZeit As String = TMP(0)
Dim TMP2() As String = Split(TMP(1), ": ")
Dim AbsenderName As String = TMP2(0)
Message = Message.Replace(AktuelleZeit & " - " & Name & ": ", "")
My.Computer.FileSystem.WriteAllText(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "user_message/" & Name & ".txt", "", False)
My.Computer.Network.UploadFile(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData) & "user_message/" & Name & ".txt", "
ftp://192.168.1.50/user_message/" & Name & ".txt", "test", "fuckyou36", False, 60000)
MsgBox("Sie Haben um " & AktuelleZeit & " eine neue Nachricht von " & Name & " erhalten:" & vbNewLine & Message, vbInformation, "Sie haben eine Nachricht erhalten")
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
PrivateNachricht.Show()
End Sub
End Class