Ejemplo n.º 1
0
        /// <summary>
        /// Tries to parse an encrypted operation response.
        /// </summary>
        /// <param name="data">The data.</param>
        /// <param name="cryptoProvider">The crypto provider.</param>
        /// <param name="operationResponse">The operation response.</param>
        /// <returns> true if the operation response was parsed successfully; otherwise false.</returns>
        public bool TryParseOperationResponseEncrypted(byte[] data, ICryptoProvider cryptoProvider, out OperationResponse operationResponse)
        {
            object obj2;

            if (cryptoProvider == null)
            {
                operationResponse = null;
                return(false);
            }
            byte[] buffer = cryptoProvider.Decrypt(data, 2, data.Length - 2);
            if (buffer == null)
            {
                operationResponse = null;
                return(false);
            }
            if (operationDataLogger.IsDebugEnabled)
            {
                operationDataLogger.DebugFormat("Decrypted data: data=({0} bytes) {1}", new object[] { buffer.Length, BitConverter.ToString(buffer) });
            }
            int pos = 0;

            if (GpBinaryByteReaderV17.TryReadOperationResponse(buffer, ref pos, out obj2))
            {
                operationResponse = (OperationResponse)obj2;
                return(true);
            }
            operationResponse = null;
            return(false);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///  Tries to parse an operation response.
        /// </summary>
        /// <param name="data">A byte array containing the binary operation response data.</param>
        /// <param name="operationResponse">Contains the parsed operation response, if the methods returns with success;
        ///otherwise, the parameter will be uninitialized. </param>
        /// <returns>true if the operation response was parsed successfully; otherwise false.</returns>
        public bool TryParseOperationResponse(byte[] data, out OperationResponse operationResponse)
        {
            object obj2;
            int    pos = 2;

            if (GpBinaryByteReaderV17.TryReadOperationResponse(data, ref pos, out obj2))
            {
                operationResponse = (OperationResponse)obj2;
                return(true);
            }
            operationResponse = null;
            return(false);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///  Tries to parse an <see cref="T:Photon.SocketServer.OperationRequest"/>.
        /// </summary>
        /// <param name="data"> The raw request data.</param>
        /// <param name="operationRequest">The operation request.</param>
        /// <returns>True if request was parsed successfully.</returns>
        public bool TryParseOperationRequest(byte[] data, out OperationRequest operationRequest)
        {
            object obj2;
            int    offset = 2;

            if (GpBinaryByteReaderV17.ReadOperationRequest(data, ref offset, out obj2))
            {
                operationRequest = (OperationRequest)obj2;
                return(true);
            }
            operationRequest = null;
            return(false);
        }
Ejemplo n.º 4
0
        /// <summary>
        ///  Tries to parse an event.
        /// </summary>
        /// <param name="data"> The data.</param>
        /// <param name="eventData"> The event data.</param>
        /// <returns>true if successful.</returns>
        public bool TryParseEventData(byte[] data, out EventData eventData)
        {
            object obj2;
            int    offset = 2;

            if (GpBinaryByteReaderV17.ReadEventData(data, ref offset, out obj2))
            {
                eventData = (EventData)obj2;
                return(true);
            }
            eventData = null;
            return(false);
        }
Ejemplo n.º 5
0
        /// <summary>
        ///  Tries to parse an event.
        /// </summary>
        /// <param name="data"> The data.</param>
        /// <param name="cryptoProvider"> The crypto Provider.</param>
        /// <param name="eventData">The event data.</param>
        /// <returns>true if successful.</returns>
        public bool TryParseEventDataEncrypted(byte[] data, ICryptoProvider cryptoProvider, out EventData eventData)
        {
            object obj2;

            if (cryptoProvider == null)
            {
                eventData = null;
                return(false);
            }
            byte[] buffer = cryptoProvider.Decrypt(data, 2, data.Length - 2);
            if (operationDataLogger.IsDebugEnabled)
            {
                operationDataLogger.DebugFormat("Decrypted data: data=({0} bytes) {1}", new object[] { buffer.Length, BitConverter.ToString(buffer) });
            }
            int offset = 0;

            if (GpBinaryByteReaderV17.ReadEventData(buffer, ref offset, out obj2))
            {
                eventData = (EventData)obj2;
                return(true);
            }
            eventData = null;
            return(false);
        }