System.ConsoleDriver.InternalKeyAvailable C# (CSharp) Method

InternalKeyAvailable() private method

private InternalKeyAvailable ( int ms_timeout ) : int
ms_timeout int
return int
		internal static extern int InternalKeyAvailable (int ms_timeout);

Usage Example

Esempio n. 1
0
        ConsoleKeyInfo ReadKeyInternal(out bool fresh)
        {
            if (!inited)
            {
                Init();
            }

            InitKeys();

            object o;

            if ((o = GetKeyFromBuffer(true)) == null)
            {
                do
                {
                    if (ConsoleDriver.InternalKeyAvailable(150) > 0)
                    {
                        do
                        {
                            AddToBuffer(stdin.Read());
                        } while (ConsoleDriver.InternalKeyAvailable(0) > 0);
                    }
                    else if (stdin.Peek() != -1)
                    {
                        do
                        {
                            AddToBuffer(stdin.Read());
                        } while (stdin.Peek() != -1);
                    }
                    else
                    {
                        if ((o = GetKeyFromBuffer(false)) != null)
                        {
                            break;
                        }

                        AddToBuffer(stdin.Read());
                    }

                    o = GetKeyFromBuffer(true);
                } while (o == null);

                // freshly read character
                fresh = true;
            }
            else
            {
                // this char was pre-buffered (e.g. not fresh)
                fresh = false;
            }

            return((ConsoleKeyInfo)o);
        }
All Usage Examples Of System.ConsoleDriver::InternalKeyAvailable