|
| WebCam (Node _client) |
|
async Task | RecvThread () |
| Asynchronously receives image data and updates the picture box with the received image.
|
|
async Task | RefreshCams () |
| Refreshes the list of cameras and updates the UI accordingly.
|
|
async Task | SetCamera (int index) |
| Sets the camera with the specified index.
|
|
async Task | SetQuality (int quality) |
| Sets the quality of the client and sends the quality value to the server.
|
|
async Task< string[]> | GetCamera () |
| Asynchronously retrieves the list of cameras from the client and returns the result.
|
|
void | TempOnDisconnect (Node node) |
| Disconnects the client and image node if the provided node is equal to the client or the image node, and closes the form if not disposed.
|
|
|
override void | Dispose (bool disposing) |
| Releases the unmanaged resources used by the component and optionally releases the managed resources.
|
|
|
async Task | InitializeAsync () |
| Initializes the object asynchronously by creating an image node, adding temporary on disconnect, refreshing cameras, and starting the receive thread.
|
|
async Task< Node > | CreateImageNode () |
| Creates an image node and returns it. If the image node already exists, returns the existing node.
|
|
void | WebCam_Load (object sender, EventArgs e) |
| Event handler for the form load event of the WebCam form.
|
|
async void | button2_Click (object sender, EventArgs e) |
| Enables the next button and disables the current button, then sends a byte array with value 2 to the client asynchronously.
|
|
async void | button3_Click (object sender, EventArgs e) |
| Disables the current button, enables the stop button, and sends a stop signal to the client. If an image is displayed in the picture box, it disposes of the image and sets it to null.
|
|
async void | button1_Click (object sender, EventArgs e) |
| Asynchronously refreshes the cameras.
|
|
async void | comboBox1_SelectedIndexChanged (object sender, EventArgs e) |
| Handles the SelectedIndexChanged event of comboBox1. Sets the camera based on the selected index of comboBox1.
|
|
async void | comboBox2_SelectedIndexChanged (object sender, EventArgs e) |
| Handles the SelectedIndexChanged event of comboBox2. Sets the quality based on the selected index in the comboBox.
|
|
void | InitializeComponent () |
| Initializes the components of the WebCam form.
|
|
◆ WebCam()
xeno_rat_server.Forms.WebCam.WebCam |
( |
Node | _client | ) |
|
|
inline |
◆ button1_Click()
async void xeno_rat_server.Forms.WebCam.button1_Click |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Asynchronously refreshes the cameras.
This method triggers the asynchronous refresh of the cameras, updating their status and properties.
◆ button2_Click()
async void xeno_rat_server.Forms.WebCam.button2_Click |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Enables the next button and disables the current button, then sends a byte array with value 2 to the client asynchronously.
- Parameters
-
sender | The object that raised the event. |
e | The event data. |
This method enables the next button (button3) and disables the current button (button2). It also disables another button (button1). The method then sends a byte array with value 2 to the client asynchronously using the client object. The playing flag is set to true after sending the byte array.
◆ button3_Click()
async void xeno_rat_server.Forms.WebCam.button3_Click |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Disables the current button, enables the stop button, and sends a stop signal to the client. If an image is displayed in the picture box, it disposes of the image and sets it to null.
- Parameters
-
sender | The object that raised the event. |
e | The event data. |
This method disables the current button, enables the stop button, and sends a stop signal to the client. It also disposes of any image displayed in the picture box and sets it to null.
◆ comboBox1_SelectedIndexChanged()
async void xeno_rat_server.Forms.WebCam.comboBox1_SelectedIndexChanged |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Handles the SelectedIndexChanged event of comboBox1. Sets the camera based on the selected index of comboBox1.
- Parameters
-
sender | The source of the event. |
e | The EventArgs that contains the event data. |
This method asynchronously sets the camera based on the selected index of comboBox1. If the selected index is not -1, it awaits the SetCamera method with the selected index as the parameter.
◆ comboBox2_SelectedIndexChanged()
async void xeno_rat_server.Forms.WebCam.comboBox2_SelectedIndexChanged |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Handles the SelectedIndexChanged event of comboBox2. Sets the quality based on the selected index in the comboBox.
- Parameters
-
sender | The source of the event. |
e | The EventArgs that contains the event data. |
This method retrieves the selected index from comboBox2 and sets the quality based on the selected index. It first checks if a valid index is selected, then it parses the quality value from the qualitys array and removes the '' symbol. The SetQuality method is then called with the parsed quality value to set the quality.
◆ CreateImageNode()
async Task< Node > xeno_rat_server.Forms.WebCam.CreateImageNode |
( |
| ) |
|
|
inlineprivate |
Creates an image node and returns it. If the image node already exists, returns the existing node.
- Returns
- The created or existing image node.
This method creates an image node if it does not already exist. If the image node already exists, it returns the existing node. The method sends a byte array with a value of 4 to the client asynchronously. It then creates a subnode asynchronously using the parent client and assigns it to the variable SubSubNode. The method sets the type and ID of the subnode using Utils.SetType2setIdAsync method and checks if the ID is not equal to -1. If the ID is not equal to -1, it returns the type and ID asynchronously using Utils.Type2returnAsync method and sends a byte array to the client. The method receives a byte array from the client and checks if it is null or the first element is 0. If so, it disconnects the subnode and returns null. If the ID is equal to -1, it disconnects the subnode and returns null. Finally, it returns the created or existing image node.
◆ Dispose()
override void xeno_rat_server.Forms.WebCam.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 all managed resources. If disposing is false, this method releases only the unmanaged resources.
◆ GetCamera()
async Task< string[]> xeno_rat_server.Forms.WebCam.GetCamera |
( |
| ) |
|
|
inline |
Asynchronously retrieves the list of cameras from the client and returns the result.
- Returns
- An array of strings containing the list of cameras retrieved from the client.
This method sends a request to the client to retrieve the list of cameras and awaits the response. The response is then parsed to obtain the number of cameras, and individual camera names are received and stored in an array. The array of camera names is then assigned to the 'Cameras' property of the class and returned as the result.
◆ InitializeAsync()
async Task xeno_rat_server.Forms.WebCam.InitializeAsync |
( |
| ) |
|
|
inlineprivate |
Initializes the object asynchronously by creating an image node, adding temporary on disconnect, refreshing cameras, and starting the receive thread.
This method initializes the object asynchronously by performing the following tasks:
- Creates an image node by awaiting the result of the CreateImageNode method.
- Adds temporary on disconnect by invoking the AddTempOnDisconnect method on the created ImageNode.
- Refreshes cameras by awaiting the result of the RefreshCams method.
- Starts the receive thread by invoking the RecvThread method.
◆ InitializeComponent()
void xeno_rat_server.Forms.WebCam.InitializeComponent |
( |
| ) |
|
|
inlineprivate |
Initializes the components of the WebCam form.
This method initializes and sets up the various components of the WebCam form, including buttons, combo boxes, and picture box. It also sets up event handlers for button clicks and combo box selection changes.
◆ RecvThread()
async Task xeno_rat_server.Forms.WebCam.RecvThread |
( |
| ) |
|
|
inline |
Asynchronously receives image data and updates the picture box with the received image.
This method continuously receives image data from the connected ImageNode and updates the picture box with the received image. If the received data is null, the method breaks the loop and stops receiving. If the application is in a playing state, the received image data is converted to an Image object and displayed in the picture box. The method uses asynchronous operations for receiving data to avoid blocking the main thread.
- Exceptions
-
Exception | Thrown if there is an error in receiving or processing the image data. |
◆ RefreshCams()
async Task xeno_rat_server.Forms.WebCam.RefreshCams |
( |
| ) |
|
|
inline |
Refreshes the list of cameras and updates the UI accordingly.
This method asynchronously retrieves the list of available cameras using the GetCamera method. It then updates the UI by clearing the existing items in the comboBox1 and adding the new camera names. If no cameras are available, it disables the button2; otherwise, it enables the button and sets the camera to the first available one using the SetCamera method.
- Exceptions
-
Exception | An exception may be thrown if there is an error while retrieving the list of cameras or setting the camera. |
- Returns
- A task representing the asynchronous operation.
◆ SetCamera()
async Task xeno_rat_server.Forms.WebCam.SetCamera |
( |
int | index | ) |
|
|
inline |
Sets the camera with the specified index.
- Parameters
-
index | The index of the camera to be set. |
- Exceptions
-
ArgumentNullException | Thrown when the client is null. |
- Returns
- A task representing the asynchronous operation.
This method sends a byte array opcode with value 1 to the client using an asynchronous send operation. Then it sends the index of the camera to the client using an asynchronous send operation after converting it to bytes.
◆ SetQuality()
async Task xeno_rat_server.Forms.WebCam.SetQuality |
( |
int | quality | ) |
|
|
inline |
Sets the quality of the client and sends the quality value to the server.
- Parameters
-
quality | The quality value to be set for the client. |
This method sends an opcode to the server indicating that the quality is being set, followed by the quality value itself. The quality value is converted to bytes using the client's socket utility method before being sent to the server.
◆ TempOnDisconnect()
void xeno_rat_server.Forms.WebCam.TempOnDisconnect |
( |
Node | node | ) |
|
|
inline |
Disconnects the client and image node if the provided node is equal to the client or the image node, and closes the form if not disposed.
- Parameters
-
node | The node to be checked for disconnection. |
If the provided node is equal to the client or the image node, this method disconnects the client and image node if it is not null. Additionally, if the form is not disposed, it is closed using Control.BeginInvoke(Delegate).
◆ WebCam_Load()
void xeno_rat_server.Forms.WebCam.WebCam_Load |
( |
object | sender, |
|
|
EventArgs | e ) |
|
inlineprivate |
Event handler for the form load event of the WebCam form.
- Parameters
-
sender | The object that raised the event. |
e | The event arguments. |
This method is called when the WebCam form is loaded. It can be used to initialize the form or perform any necessary setup.
◆ button1
System.Windows.Forms.Button xeno_rat_server.Forms.WebCam.button1 |
|
private |
◆ button2
System.Windows.Forms.Button xeno_rat_server.Forms.WebCam.button2 |
|
private |
◆ button3
System.Windows.Forms.Button xeno_rat_server.Forms.WebCam.button3 |
|
private |
◆ Cameras
string [] xeno_rat_server.Forms.WebCam.Cameras |
|
private |
◆ client
Node xeno_rat_server.Forms.WebCam.client |
|
private |
◆ comboBox1
System.Windows.Forms.ComboBox xeno_rat_server.Forms.WebCam.comboBox1 |
|
private |
◆ comboBox2
System.Windows.Forms.ComboBox xeno_rat_server.Forms.WebCam.comboBox2 |
|
private |
◆ components
System.ComponentModel.IContainer xeno_rat_server.Forms.WebCam.components = null |
|
private |
Required designer variable.
◆ ImageNode
Node xeno_rat_server.Forms.WebCam.ImageNode |
|
private |
◆ pictureBox1
System.Windows.Forms.PictureBox xeno_rat_server.Forms.WebCam.pictureBox1 |
|
private |
◆ playing
bool xeno_rat_server.Forms.WebCam.playing = false |
|
private |
◆ qualitys
string [] xeno_rat_server.Forms.WebCam.qualitys = new string[] { "100%", "90%", "80%", "70%", "60%", "50%", "40%", "30%", "20%", "10%" } |
|
private |
The documentation for this class was generated from the following files:
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/xeno rat server/Forms/WebCam.cs
- /Users/sumansaurabh/Documents/my-startup/xeno-rat/xeno rat server/Forms/WebCam.Designer.cs