Пример #1
0
        public void RegisterRecentRepository(RepositoryLink repository)
        {
            Verify.Argument.IsNotNull(repository, "repository");

            int id = -1;

            for (int i = 0; i < _recent.Count; ++i)
            {
                if (string.Compare(_recent[i].Path, repository.Path, true) == 0)
                {
                    id = i;
                    break;
                }
            }
            if (id == 0)
            {
                return;
            }
            if (id != -1)
            {
                _recent.RemoveAt(id);
            }
            _recent.Insert(0, repository);
            var diff = _recent.Count - _maxRecentREpositories;

            if (diff > 0)
            {
                _recent.RemoveRange(_recent.Count - diff, diff);
            }
        }