コード例 #1
0
 public void SendToClientRSA(NetComClientData pClient, NetComInstruction pInstruction)
 {
     if (pClient != null)
     {
         Debug($"Queueing message for {pClient.Username}: {pInstruction}", DebugParams);
         OutgoingInstructions.AddRSA(pInstruction, pClient);
     }
 }
コード例 #2
0
            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");
            }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
 public abstract void Execute(NetComClientData pClient = null);
コード例 #5
0
 public static string DefaultServer(string pMessage, NetComClientData pClient)
 {
     return(pMessage);
 }
コード例 #6
0
 public override void Execute(NetComClientData pClient = null) =>
 Console.WriteLine("\r\n\r\n" + Value + "\r\n\r\n");
コード例 #7
0
 public NetComInstructionQueueElement(NetComInstruction pInstruction, NetComClientData pClient, bool pRSAEncrypted)
 {
     Instruction  = pInstruction;
     Client       = pClient;
     RSAEncrypted = pRSAEncrypted;
 }
コード例 #8
0
 public NetComInstructionQueueElement(NetComInstruction pInstruction, NetComClientData pClient) : this(pInstruction, pClient, false)
 {
 }