mirror of
https://github.com/quasar/Quasar.git
synced 2026-04-25 15:25:59 +03:00
[GH-ISSUE #443] Qussion About (For each client c in SelectedClients) #229
Labels
No labels
bug
bug
cant-reproduce
discussion
duplicate
easy
enhancement
help wanted
improvement
invalid
need more info
pull-request
question
wont-add
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/Quasar#229
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @darknet1990 on GitHub (Apr 11, 2016).
Original GitHub issue: https://github.com/quasar/Quasar/issues/443
Hello Everyone i just need an answer for my Qussion and to understant more
Here is my code !!
Foreach (Client c in SelectedClients)
{
//# Here can i put any command wich every client will make it ?? Like >>
System.IO.Directory.Delete("C:\Jony", true);
//# every client in the list will delete this folder ??
}
@DragonzMaster commented on GitHub (Apr 11, 2016):
It should send the command to each client that is selected in the Listview in main form.
@darknet1990 commented on GitHub (Apr 11, 2016):
Thank You @DragonzMaster I mean there is no need to write any class in (client and server ) this code will excute what i want ? @DragonzMaster
@DragonzMaster commented on GitHub (Apr 11, 2016):
You should add server packet and client packet and edit the the handler ( Core\Commands ) and add the new packets to serializer in the following files Core\Networking\server.cs AND Core\Networking\client.cs , but remember that this command will be sent ONLY to selected clients (may be 1,2 or 20 ... etc...) NOT all of them (except you have selected all the clients).
You can add a new item to context-menu and double click on it to add the code like the examples below.
Here are examples:
@darknet1990 commented on GitHub (Apr 11, 2016):
i mean if i write a Long code Between (foreach) without adding any packets to core like >>
_calculate every photo in this folder i think it must work _
I see soo much codes and function and clasess why we dont write what we want without this serializer and Core\Networking\server.cs *Core\Networking\client.cs * just we write what we want in the form directly between foreach or the selected client ?
i feel its a littile comlicated
@DragonzMaster commented on GitHub (Apr 11, 2016):
Sorry, this code won't work. you should do what I've mentioned before (adding new packets ,edit handler and add packets to serializer).
@DragonzMaster commented on GitHub (Apr 11, 2016):
I Think This project uses this style to manage and add packets and make it serliazable. (hope I'm not wrong)
In my opinion it is not complicated but it is about code management.
@LostSoulfly commented on GitHub (Apr 11, 2016):
Looks like you just want to delete a specific folder on each of the connect clients?
You wouldn't need to add your own packet, just use .DoPathDelete
if (_connectClient != null) new Core.Packets.ServerPackets.DoPathDelete(path, type).Execute(_connectClient);and you could loop through _connectClient instead of the list itself, assuming you want to send it to every computer. Otherwise, look at the existing code to send the command only to the selected computers.
@darknet1990 commented on GitHub (Apr 11, 2016):
Yes Thanks for all answers i understand at the end that i can write my code (foreach) and put my command like my code between it ..
@LostSoulFly it was just an example i want to execute a long script in all connected clients but my command line is very long and complicated this why i asked this Qussion to avoid making any classes and serializer / packets ... if i am wrong please explain more ...
@DragonzMaster commented on GitHub (Apr 11, 2016):
Unfortunately as I've mentioned before you have to add new packets/edit handler/add packets to serializer to make the code run on your clients, I think you can't just add your code between for-each block and it will work as the server ONLY send packets NOT code blocks .
@darknet1990 commented on GitHub (Apr 11, 2016):
yes you are true i actually tried just now and it dont work !!
it is just working on my one computer but others on my network no
@LostSoulfly commented on GitHub (Apr 11, 2016):
@DragonzMaster is correct, I was misunderstanding your goal. If you are only putting your code between a "for each", it's only going to run on the server itself and not the clients.
@DragonzMaster commented on GitHub (Apr 11, 2016):
I will try to simplify how it works and I hope that there is nothing wrong.
The server only send and recieve packets and these packets hold the data between the server and client, some of them are server packets like GetConnections and the others are client packets like GetConnectionsResponse and MUST be added to both of server and client.
These packets are serialized using NetSerializer to make it easy to travel over network and of course they are compressed.
Then there are the handlers as their mission is to deal with the data received from/sent to => server/client and do most of the magic using these data like adding them to listview or delete file .... etc.
Now I hope you understand how it is working so simply you CAN'T just add the code between foreach block as the code will only executed on your machine and doesn't even travel over network.
@darknet1990 commented on GitHub (Apr 12, 2016):
Yes @DragonzMaster thank you for your Explain i thout it will be easy but it seems i need some time to understant how it works spichaly this all of classes and packets i am c# porgramer but its my first time working at Sockets Project >>>
@DragonzMaster commented on GitHub (Apr 12, 2016):
No problem, I've faced the same thing the first time I tried to add a new feature but It's very easy and not that complicated. 😄 and you can guide with any existed feature and you will know how it works.
May be I can help you with the feature you want to add.
Sorry for my English.
@darknet1990 commented on GitHub (Apr 12, 2016):
@DragonzMaster how can i contact you via what ? wich feature do you added ?
@DragonzMaster commented on GitHub (Apr 12, 2016):
You can fork the project and see if I can help you. I've added TCP Connections feature.
@darknet1990 commented on GitHub (Apr 12, 2016):
online i cannot put *my project *