Xeno-rat
Loading...
Searching...
No Matches
xeno_rat_server.Forms.Chat Class Reference
Inheritance diagram for xeno_rat_server.Forms.Chat:
Collaboration diagram for xeno_rat_server.Forms.Chat:

Public Member Functions

 Chat (Node _client)
 
async Task HeartBeat ()
 Sends a heartbeat signal to the connected client at regular intervals.
 
async Task RecvThread ()
 Asynchronously receives data from the client and updates the UI with the received message.
 

Protected Member Functions

override void Dispose (bool disposing)
 Releases the unmanaged resources used by the component and optionally releases the managed resources.
 

Private Member Functions

async Task InitializeAsync ()
 Initializes the asynchronous tasks for heart beat and receiving messages.
 
async void button1_Click (object sender, EventArgs e)
 Handles the button click event and sends the input message to the client.
 
void textBox2_KeyDown (object sender, KeyEventArgs e)
 Handles the KeyDown event for textBox2 and performs a click on button1 if the Enter key is pressed.
 
void textBox1_TextChanged (object sender, EventArgs e)
 Event handler for the TextChanged event of textBox1.
 
void textBox2_TextChanged (object sender, EventArgs e)
 Event handler for the TextChanged event of textBox2.
 
void Chat_Load (object sender, EventArgs e)
 Called when the Chat form is loaded.
 
void InitializeComponent ()
 Initializes the components of the chat window.
 

Private Attributes

Node client
 
System.ComponentModel.IContainer components = null
 Required designer variable.
 
System.Windows.Forms.TextBox textBox1
 
System.Windows.Forms.TextBox textBox2
 
System.Windows.Forms.Button button1
 

Constructor & Destructor Documentation

◆ Chat()

xeno_rat_server.Forms.Chat.Chat ( Node _client)
inline
Here is the call graph for this function:

Member Function Documentation

◆ button1_Click()

async void xeno_rat_server.Forms.Chat.button1_Click ( object sender,
EventArgs e )
inlineprivate

Handles the button click event and sends the input message to the client.

Parameters
senderThe object that raised the event.
eThe event data.
Returns
Void

This method retrieves the input message from the textBox2 control, clears the textBox2 control, and sends the message to the client using the SendAsync method of the client object. If the SendAsync method returns false, the form is closed. The input message is then appended to the textBox1 control with the prefix "You:", and the control is scrolled to the end to display the new message.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ Chat_Load()

void xeno_rat_server.Forms.Chat.Chat_Load ( object sender,
EventArgs e )
inlineprivate

Called when the Chat form is loaded.

Here is the caller graph for this function:

◆ Dispose()

override void xeno_rat_server.Forms.Chat.Dispose ( bool disposing)
inlineprotected

Releases the unmanaged resources used by the component and optionally releases the managed resources.

Parameters
disposingtrue to release both managed and unmanaged resources; false to release only unmanaged resources.

This method releases the unmanaged resources used by the component and optionally releases the managed resources. If disposing is true, this method disposes of the managed resources.

◆ HeartBeat()

async Task xeno_rat_server.Forms.Chat.HeartBeat ( )
inline

Sends a heartbeat signal to the connected client at regular intervals.

This method continuously sends a heartbeat signal to the connected client every 2 seconds to maintain the connection. If the client is no longer connected, the method will terminate.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeAsync()

async Task xeno_rat_server.Forms.Chat.InitializeAsync ( )
inlineprivate

Initializes the asynchronous tasks for heart beat and receiving messages.

This method initializes the asynchronous tasks for heart beat and receiving messages. The HeartBeat method is called to start the heart beat process, and the RecvThread method is awaited to receive messages asynchronously.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ InitializeComponent()

void xeno_rat_server.Forms.Chat.InitializeComponent ( )
inlineprivate

Initializes the components of the chat window.

This method initializes the text boxes, button, and other components of the chat window, setting their properties and event handlers.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ RecvThread()

async Task xeno_rat_server.Forms.Chat.RecvThread ( )
inline

Asynchronously receives data from the client and updates the UI with the received message.

This method continuously receives data from the connected client using asynchronous operations. Upon receiving data, it decodes the byte array into a string message using UTF-8 encoding and appends it to the UI textbox, along with the prefix "User:". It then scrolls the textbox to display the latest message. If the client is disconnected, the method closes the form if it is not already disposed.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ textBox1_TextChanged()

void xeno_rat_server.Forms.Chat.textBox1_TextChanged ( object sender,
EventArgs e )
inlineprivate

Event handler for the TextChanged event of textBox1.

Parameters
senderThe object that raised the event.
eThe event arguments.

This method is called when the text in textBox1 changes. It can be used to perform actions based on the changed text.

Here is the caller graph for this function:

◆ textBox2_KeyDown()

void xeno_rat_server.Forms.Chat.textBox2_KeyDown ( object sender,
KeyEventArgs e )
inlineprivate

Handles the KeyDown event for textBox2 and performs a click on button1 if the Enter key is pressed.

Parameters
senderThe object that raised the event.
eA KeyEventArgs that contains the event data.

This method checks if the Enter key is pressed and, if so, simulates a click on button1. It then sets the KeyEventArgs properties e.Handled and e.SuppressKeyPress to true to indicate that the key event has been handled and the key press should be suppressed.

Here is the caller graph for this function:

◆ textBox2_TextChanged()

void xeno_rat_server.Forms.Chat.textBox2_TextChanged ( object sender,
EventArgs e )
inlineprivate

Event handler for the TextChanged event of textBox2.

Parameters
senderThe source of the event.
eThe EventArgs that contains the event data.
Here is the caller graph for this function:

Member Data Documentation

◆ button1

System.Windows.Forms.Button xeno_rat_server.Forms.Chat.button1
private

◆ client

Node xeno_rat_server.Forms.Chat.client
private

◆ components

System.ComponentModel.IContainer xeno_rat_server.Forms.Chat.components = null
private

Required designer variable.

◆ textBox1

System.Windows.Forms.TextBox xeno_rat_server.Forms.Chat.textBox1
private

◆ textBox2

System.Windows.Forms.TextBox xeno_rat_server.Forms.Chat.textBox2
private

The documentation for this class was generated from the following files: