Хочу сделать полноценный работающий Чат через Ftp
- Хочу сделать чтобы можно было использовать смайлики
- Как можно сделать цветной текст в Edit чтобы выделить имя
Код:
#include <FTPEX.au3>
#include "SendMessage.au3"
Global $file, $FtpRead
$server = "Ftp.***.**"
$username = "Login"
$pass = "Password"
$Open = _FTP_Open('cornell')
$Conn = _FTP_Connect($Open, $server, $username, $pass, 1)
#region ### START Koda GUI section ### Form=
$Form1 = GUICreate("Simple Ftp Cheat", 285, 244, -1, -1)
$Input1 = GUICtrlCreateInput("", 6, 186, 181, 21)
$Edit1 = GUICtrlCreateEdit("", 6, 6, 271, 175, BitOR(64, 2048, 4096, 0x00200000, 0x00800000), 0)
$FILEOPEN = _FTP_FileOpen($Conn, 'H@CKER/MyCheat')
$FILEREAD = _FTP_FileRead($FILEOPEN, 100000)
_FTP_FileClose($FILEOPEN)
If @error Then $FILEREAD = ''
GUICtrlSetData($Edit1, BinaryToString($FILEREAD))
$FtpRead = $FILEREAD
_Scroll($Edit1)
$Send = GUICtrlCreateButton("Отправить", 192, 185, 86, 23)
$DeleteAllMesage = GUICtrlCreateButton("Удалить все сообщения", 6, 213, 273, 25)
If $FILEREAD = '' Then
GUICtrlSetState($DeleteAllMesage, 128)
Else
GUICtrlSetState($DeleteAllMesage, 64)
EndIf
GUISetState(@SW_SHOW)
$CheatUser = 'Cornel1'
#endregion ### END Koda GUI section ###
AdlibRegister("_CheatMessage", 2000)
While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case -3
FileDelete(@ScriptDir & '\MyCheat.ini')
$Ftpc = _FTP_Close($Open)
FileClose($file)
Exit
Case $DeleteAllMesage
GUICtrlSetState($DeleteAllMesage, 128)
_FTP_FileDelete($Conn, 'H@CKER/MyCheat')
$FILEOPEN = _FTP_FileOpen($Conn, 'H@CKER/MyCheat')
$FILEREAD = _FTP_FileRead($FILEOPEN, 100000)
_FTP_FileClose($FILEOPEN)
If @error Then $FILEREAD = ''
If $FtpRead <> $FILEREAD Then
GUICtrlSetData($Edit1, BinaryToString($FILEREAD))
_Scroll($Edit1)
$FtpRead = $FILEREAD
EndIf
GUICtrlSetState($DeleteAllMesage, 64)
If $FILEREAD = '' Then
GUICtrlSetState($DeleteAllMesage, 128)
Else
GUICtrlSetState($DeleteAllMesage, 64)
EndIf
Case $Send
GUICtrlSetState($Send, 128)
$FILEOPEN = _FTP_FileOpen($Conn, 'H@CKER/MyCheat')
$FILEREAD = _FTP_FileRead($FILEOPEN, 100000)
_FTP_FileClose($FILEOPEN)
If @error Then $FILEREAD = ''
$FtpRead = $FILEREAD
$file = FileOpen('MyCheat.ini', 18)
If $FILEREAD = '' Then
FileWrite($file, $CheatUser & ': ' & GUICtrlRead($Input1))
Else
FileWrite($file, BinaryToString($FILEREAD) & @CRLF & $CheatUser & ': ' & GUICtrlRead($Input1))
EndIf
FileClose($file)
_FTP_FilePut($Conn, 'MyCheat.ini', 'H@CKER/MyCheat')
$FILEOPEN = _FTP_FileOpen($Conn, 'H@CKER/MyCheat')
$FILEREAD = _FTP_FileRead($FILEOPEN, 100000)
_FTP_FileClose($FILEOPEN)
If @error Then $FILEREAD = ''
If $FtpRead <> $FILEREAD Then
GUICtrlSetData($Edit1, BinaryToString($FILEREAD))
_Scroll($Edit1)
$FtpRead = $FILEREAD
EndIf
GUICtrlSetData($Input1, '')
GUICtrlSetState($Send, 64)
EndSwitch
WEnd
Func _CheatMessage()
$FILEOPEN = _FTP_FileOpen($Conn, 'H@CKER/MyCheat')
$FILEREAD = _FTP_FileRead($FILEOPEN, 100000)
_FTP_FileClose($FILEOPEN)
If @error Then $FILEREAD = ''
If $FtpRead <> $FILEREAD Then
GUICtrlSetData($Edit1, BinaryToString($FILEREAD))
_Scroll($Edit1)
$FtpRead = $FILEREAD
EndIf
If $FILEREAD = '' Then
GUICtrlSetState($DeleteAllMesage, 128)
Else
GUICtrlSetState($DeleteAllMesage, 64)
EndIf
EndFunc ;==>_CheatMessage
Func _Scroll($hWnd)
If Not IsHWnd($hWnd) Then $hWnd = GUICtrlGetHandle($hWnd)
_SendMessage($hWnd, 182, 0, _SendMessage($hWnd, 186))
EndFunc ;==>_Scroll