コード例 #1
0
        public ParseResult TryParse(List <char> content, XtermConsole console)
        {
            string contentString;

            lock ( content )
            {
                contentString = new string ( content.ToArray( ));
            }

            Match tryMatch = TryEscape.Match(contentString);

            if (tryMatch.Success)
            {
                Match fullMatch = FullEscape.Match(contentString);

                if (fullMatch.Success)
                {
                    lock ( content )
                    {
                        content.RemoveRange(0, fullMatch.Value.Length);
                    }

                    switch (fullMatch.Groups [1].Value)
                    {
                    case "A":
                    {
                        console.InvokeKeyPressed(
                            new ConsoleKeyInfo(
                                default,
                                ConsoleKey.UpArrow,
                                false,
                                false,
                                false));
                        break;
                    }
コード例 #2
0
        public ParseResult TryParse(List <char> content, XtermConsole console)
        {
            string contentString;

            lock ( content )
            {
                contentString = new string ( content.ToArray( ));
            }

            Match tryMatch = TryEscape.Match(contentString);

            if (tryMatch.Success)
            {
                Match fullMatch = FullEscape.Match(contentString);

                if (fullMatch.Success)
                {
                    lock ( content )
                    {
                        content.RemoveRange(0, fullMatch.Value.Length);
                    }

                    int height = Convert.ToInt32(fullMatch.Groups [1].Value);
                    int width  = Convert.ToInt32(fullMatch.Groups [2].Value);

                    console.InternalSize = new Size(width, height);

                    return(ParseResult.Finished);
                }
                else
                {
                    return(ParseResult.Established);
                }
            }
            else
            {
                return(ParseResult.CanNotEstablish);
            }
        }