コード例 #1
0
        public async Task <UniversalServerPacket> WaitForResultAsync()
        {
            UniversalServerPacket serverPacket = null;
            await Task.Run(() =>
            {
                byte[] data            = new byte[Client.Client.ReceiveBufferSize];
                int receivedDataLength = Client.Client.Receive(data);
                serverPacket           = JsonConvert.DeserializeObject <UniversalServerPacket>
                                             (Encoding.ASCII.GetString(data, 0, receivedDataLength));

                if (serverPacket.Encrypted)
                {
                    serverPacket.Message = Encryption.Decrypt(serverPacket.Message, Encryption.GetClientPrivateKey());
                }
            });

            return(serverPacket);
        }
コード例 #2
0
 public int DecryptInt(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToInt32(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
コード例 #3
0
 public string DecryptString(ByteArray strTodecrypt)
 {
     return(BitConverter.ToString(ClientRSA.Decrypt(strTodecrypt.Bytes, false)));
 }
コード例 #4
0
 public double DecryptDouble(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToDouble(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
コード例 #5
0
 public float DecryptFloat(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToSingle(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
コード例 #6
0
 public bool DecryptBool(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToBoolean(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }
コード例 #7
0
 public long DecryptLong(ByteArray itemToDecrypt)
 {
     return(BitConverter.ToInt64(ClientRSA.Decrypt(itemToDecrypt.Bytes, false), 0));
 }