|
| ChatForm (Node _server) |
|
async Task | Heartbeat () |
| Waits for the heartbeat from the server and disconnects if not received within a specified time.
|
|
async Task | RecvThread () |
| Asynchronously receives data from the server and updates the UI with the received message.
|
|
|
override void | Dispose (bool disposing) |
| Releases the unmanaged resources used by the component and optionally releases the managed resources.
|
|
|
async Task | InitializeAsync () |
| Initializes the asynchronous operations by calling the Heartbeat method and awaiting the RecvThread method.
|
|
async void | button1_Click (object sender, EventArgs e) |
| Sends the input message to the server and updates the UI with the sent message.
|
|
void | textBox2_KeyDown (object sender, KeyEventArgs e) |
| Handles the KeyDown event for textBox2 and performs a click on button1 when the Enter key is pressed.
|
|
void | textBox2_TextChanged (object sender, EventArgs e) |
| Event handler for the TextChanged event of textBox2.
|
|
void | ChatForm_Load (object sender, EventArgs e) |
| Activates the chat form when it is loaded.
|
|
void | InitializeComponent () |
| Initializes the components of the ChatForm, including text boxes and buttons.
|
|
◆ ChatForm()
Chat.ChatForm.ChatForm |
( |
Node | _server | ) |
|
|
inline |
◆ button1_Click()
async void Chat.ChatForm.button1_Click |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Sends the input message to the server and updates the UI with the sent message.
- Parameters
-
sender | The object that raised the event. |
e | The event data. |
This method sends the input message to the server using asynchronous communication and updates the UI with the sent message. It clears the input text box after sending the message and scrolls the chat box to the latest message.
◆ ChatForm_Load()
void Chat.ChatForm.ChatForm_Load |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Activates the chat form when it is loaded.
This method is triggered when the chat form is loaded. It ensures that the chat form is activated and brought to the front.
◆ Dispose()
override void Chat.ChatForm.Dispose |
( |
bool | disposing | ) |
|
|
inlineprotected |
Releases the unmanaged resources used by the component and optionally releases the managed resources.
- Parameters
-
disposing | True 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. If disposing is false, this method does not dispose of the managed resources.
◆ Heartbeat()
async Task Chat.ChatForm.Heartbeat |
( |
| ) |
|
|
inline |
Waits for the heartbeat from the server and disconnects if not received within a specified time.
This method continuously checks for the heartbeat from the server while it is connected. If the heartbeat is not received within 5 seconds, the server is disconnected.
◆ InitializeAsync()
async Task Chat.ChatForm.InitializeAsync |
( |
| ) |
|
|
inlineprivate |
Initializes the asynchronous operations by calling the Heartbeat method and awaiting the RecvThread method.
This method first calls the Heartbeat method to perform a heartbeat operation. Then, it awaits the RecvThread method to handle receiving data asynchronously.
◆ InitializeComponent()
void Chat.ChatForm.InitializeComponent |
( |
| ) |
|
|
inlineprivate |
Initializes the components of the ChatForm, including text boxes and buttons.
◆ RecvThread()
async Task Chat.ChatForm.RecvThread |
( |
| ) |
|
|
inline |
Asynchronously receives data from the server and updates the UI with the received message.
This method continuously receives data from the server while the server is connected. If the received data is a single byte with value 4, it sets the recived_heartbeat flag to true and continues to receive more data. If the received data is not a heartbeat, it decodes the data to a UTF-8 string and appends it to the UI element textBox1 with "Admin: " prefix. After updating the UI, it scrolls to the end of the text and continues to receive more data. Once the server connection is closed, it prints "end!" to the console and closes the UI if it is not already disposed.
◆ textBox2_KeyDown()
void Chat.ChatForm.textBox2_KeyDown |
( |
object | sender, |
|
|
KeyEventArgs | e ) |
|
inlineprivate |
Handles the KeyDown event for textBox2 and performs a click on button1 when the Enter key is pressed.
- Parameters
-
sender | The object that raised the event. |
e | A KeyEventArgs that contains the event data. |
This method checks if the Enter key is pressed and then simulates a click on button1. It also handles the event by setting e.Handled and e.SuppressKeyPress to true to prevent further processing of the key event.
◆ textBox2_TextChanged()
void Chat.ChatForm.textBox2_TextChanged |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Event handler for the TextChanged event of textBox2.
- Parameters
-
sender | The object that raised the event. |
e | The event arguments. |
This method is called when the text in textBox2 is changed. It can be used to perform actions based on the changed text.
◆ button1
System.Windows.Forms.Button Chat.ChatForm.button1 |
|
private |
◆ components
System.ComponentModel.IContainer Chat.ChatForm.components = null |
|
private |
Required designer variable.
◆ recived_heartbeat
bool Chat.ChatForm.recived_heartbeat |
|
private |
◆ server
Node Chat.ChatForm.server |
|
private |
◆ textBox1
System.Windows.Forms.TextBox Chat.ChatForm.textBox1 |
|
private |
◆ textBox2
System.Windows.Forms.TextBox Chat.ChatForm.textBox2 |
|
private |
The documentation for this class was generated from the following files:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/Chat/ChatForm.cs
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/Plugins/Chat/ChatForm.Designer.cs