Ejemplo n.º 1
0
        public InputRecord[] ReadPendingEvents(int Max)
        {
            if (Max == 0)
            {
                return(null);
            }

            InputRecord[] EventList = new InputRecord[Max];

            uint ReadCount;

            if (!WinAPI.ReadConsoleInput(BufferHandle, EventList, (uint)Max, out ReadCount))
            {
                throw new ConsoleExException("ConsoleEx: Unable to read input buffer");
            }

            if (ReadCount < Max)
            {
                InputRecord[] NewList = new InputRecord[ReadCount];
                Array.Copy(EventList, NewList, ReadCount);
                EventList = NewList;
            }

            return(EventList);
        }
Ejemplo n.º 2
0
 static public extern bool ReadConsoleInput(Microsoft.Win32.SafeHandles.SafeFileHandle ConsoleInput, out InputRecord Buffer, uint Length, out uint NumberOfEventsRead);