Ejemplo n.º 1
0
        public static IndexingActivityHistory GetHistory()
        {
            IndexingActivityHistory result;
            var list = new List <IndexingActivityHistoryItem>(_history.Length);

            lock (_lock)
            {
                for (int i = _position; i < _history.Length; i++)
                {
                    if (_history[i] != null)
                    {
                        list.Add(_history[i]);
                    }
                }
                for (int i = 0; i < _position; i++)
                {
                    if (_history[i] != null)
                    {
                        list.Add(_history[i]);
                    }
                }

                result = new IndexingActivityHistory()
                {
                    State  = IndexingActivityQueue.GetCurrentState(),
                    Recent = list.ToArray()
                };
            }
            return(result);
        }
Ejemplo n.º 2
0
        public static IndexingActivityHistory Reset()
        {
            IndexingActivityHistory result;

            lock (_lock)
            {
                for (int i = 0; i < _history.Length; i++)
                {
                    _history[i] = null;
                }

                _position   = 0;
                _unfinished = 0;

                result = new IndexingActivityHistory()
                {
                    State  = IndexingActivityQueue.GetCurrentState(),
                    Recent = new IndexingActivityHistoryItem[0]
                };
            }
            return(result);
        }