예제 #1
0
        //skip comments
        //TODO unescape escaped sequences
        public override int Peek()
        {
            if (_cache.Count > 0)
            {
                return(_cache.Peek());
            }

            int p = _reader.Peek();

            if (p <= 0)
            {
                return(p);
            }
            if (unchecked ((char)p) != '/')
            {
                return(p);
            }

            _cache.Enqueue(unchecked ((char)_reader.Read()));
            p = _reader.Peek();
            if (p <= 0)
            {
                return(_cache.Peek());
            }
            if (unchecked ((char)p) != '*')
            {
                return(_cache.Peek());
            }

            _cache.Clear();
            _reader.Read();             //consume the '*'

            bool hasStar = false;

            while (true)
            {
                var next = _reader.Read();
                if (next <= 0)
                {
                    return(next);
                }
                if (unchecked ((char)next) == '*')
                {
                    hasStar = true;
                }
                else if (hasStar && unchecked ((char)next) == '/')
                {
                    return(Peek());                    //recursively call self for comments following comments
                }
                else
                {
                    hasStar = false;
                }
            }
        }
예제 #2
0
        internal static T FindDescendantView <T>(this UIView view) where T : UIView
        {
            var queue = new FormsQueue <UIView>();

            queue.Enqueue(view);

            while (queue.Count > 0)
            {
                var descendantView = queue.Dequeue();

                var result = descendantView as T;
                if (result != null)
                {
                    return(result);
                }

                for (var i = 0; i < descendantView.Subviews?.Length; i++)
                {
                    queue.Enqueue(descendantView.Subviews[i]);
                }
            }

            return(null);
        }
예제 #3
0
 public void WaitForElement(string query)
 {
     _result.Enqueue(query);
 }
예제 #4
0
 public void Tap(string button)
 {
     _buttons.Enqueue(button);
 }