Ejemplo n.º 1
0
        public static ToffeeInternalPacketReadResult Read <T>(ToffeeParticipant receiver, byte[] packet, out T output) where T : new()
        {
            // Default the output
            output = new T();

            // Read the packet
            ToffeeInternalPacketReadResult result = Read(receiver, packet);

            if (result.Success)
            {
                // Create a new iterator for the decompressed/decrypted packet data
                ToffeePacketIterator iterator = new ToffeePacketIterator(receiver, result.Data);
                output = (T)iterator.Read(typeof(T));
            }

            // Return the read result
            return(result);
        }