Example #1
0
        /// <summary>
        /// Dequeue Commands from pending buffer.
        /// </summary>
        /// <returns>Current Commands.</returns>
        public virtual IEnumerable <Command> DequeueCommands()
        {
            if (!IsSettingsValid)
            {
                return(null);
            }

            var commandBytes = CommandIO.ReadBuffer();
            var ioCommands   = CommandParser.ToCommands(commandBytes);

            if (ioCommands != null)
            {
                commandBuffer.AddRange(ioCommands);
            }

            var currentCommands = new List <Command>(commandBuffer);

            commandBuffer.Clear();
            return(currentCommands);
        }
        /// <summary>
        /// Dequeue commands from pending and IO buffer.
        /// </summary>
        /// <returns>Current commands.</returns>
        public virtual IEnumerable <Command> DequeueCommands()
        {
            if (!IsSettingsValid)
            {
                return(null);
            }

            var ioBuffer   = CommandIO.ReadBuffer();
            var ioCommands = CommandParser.ToCommands(ioBuffer);

            if (ioCommands != null)
            {
                commandBuffer.AddRange(ioCommands);
            }

            var commands = commandBuffer.ToArray();

            commandBuffer.Clear();
            return(commands);
        }