public void SendToClientRSA(NetComClientData pClient, NetComInstruction pInstruction) { if (pClient != null) { Debug($"Queueing message for {pClient.Username}: {pInstruction}", DebugParams); OutgoingInstructions.AddRSA(pInstruction, pClient); } }
public override void Execute(NetComClientData pClient = null) { if (NetComUser.LocalUser.GetType() == typeof(NetComServer) && pClient != null) { (NetComUser.LocalUser as NetComServer).LClientList[pClient.Socket].SetUsername((user as NetComUserDummy).Username); (NetComUser.LocalUser as NetComServer).LClientList[pClient.Socket].SetPublicKey((user as NetComUserDummy).PublicKey); } if (NetComUser.LocalUser.GetType() == typeof(NetComClient)) { (NetComUser.LocalUser as NetComClient).ServerPublicKey = (user as NetComUserDummy).PublicKey; (NetComUser.LocalUser as NetComClient).Send(new NetComInstructionLib.PreAuth(NetComUser.LocalUser as NetComClient)); } Console.WriteLine("\r\n\r\nReceived Public-Key from Partner: \r\n\r\n" + (user as NetComUserDummy).PublicKey + "\r\n\r\n"); }
public void SendToClient(NetComClientData pClient, NetComInstruction pInstruction) { if (pClient != null) { byte[] data; if (pInstruction.RSAEncrypted && pInstruction.Client.PublicKey != null) { data = Encoding.UTF8.GetBytes(pInstruction.Encode(true, pInstruction.Client.PublicKey)); } else { data = Encoding.UTF8.GetBytes(pInstruction.Encode(false)); } pClient.Send(data); Debug($"Sent Message to {pInstruction.Username}: {pInstruction.Instruction}.", DebugParams); } }
public abstract void Execute(NetComClientData pClient = null);
public static string DefaultServer(string pMessage, NetComClientData pClient) { return(pMessage); }
public override void Execute(NetComClientData pClient = null) => Console.WriteLine("\r\n\r\n" + Value + "\r\n\r\n");
public NetComInstructionQueueElement(NetComInstruction pInstruction, NetComClientData pClient, bool pRSAEncrypted) { Instruction = pInstruction; Client = pClient; RSAEncrypted = pRSAEncrypted; }
public NetComInstructionQueueElement(NetComInstruction pInstruction, NetComClientData pClient) : this(pInstruction, pClient, false) { }