예제 #1
0
 public static void AddMostRecentRepository(string repo)
 {
     if (Repository.PathIsUrl(repo))
     {
         RemoteRepositoryHistory.AddMostRecentRepository(repo);
     }
     else
     {
         RepositoryHistory.AddMostRecentRepository(repo);
         AssignRepositoryHistoryFromCategories(repo);
     }
 }
예제 #2
0
        public void AddMostRecentRepository(string repo)
        {
            if (string.IsNullOrEmpty(repo))
            {
                return;
            }

            repo = repo.Trim();

            if (string.IsNullOrEmpty(repo))
            {
                return;
            }

            if (!Repository.PathIsUrl(repo))
            {
                repo = repo.Replace(AppSettings.PathSeparatorWrong, AppSettings.PathSeparator);
                if (!repo.EndsWith(AppSettings.PathSeparator.ToString()))
                {
                    repo += AppSettings.PathSeparator.ToString();
                }
            }

            Repository.RepositoryAnchor anchor = Repository.RepositoryAnchor.None;
            foreach (var recentRepository in Repositories)
            {
                if (!recentRepository.Path.Equals(repo, StringComparison.CurrentCultureIgnoreCase))
                {
                    continue;
                }
                anchor = recentRepository.Anchor;
                Repositories.Remove(recentRepository);
                break;
            }

            var repository = new Repository(repo, null, null)
            {
                RepositoryType = RepositoryType.History,
                Anchor         = anchor
            };

            Repositories.Insert(0, repository);

            if (Repositories.Count > 30)
            {
                Repositories.RemoveAt(30);
            }
        }
예제 #3
0
        public void AddMostRecentRepository(string repo)
        {
            if (string.IsNullOrEmpty(repo))
            {
                return;
            }

            repo = repo.Trim();

            if (string.IsNullOrEmpty(repo))
            {
                return;
            }

            if (!Repository.PathIsUrl(repo))
            {
                repo = repo.ToNativePath().EnsureTrailingPathSeparator();
            }

            Repository.RepositoryAnchor anchor = Repository.RepositoryAnchor.None;
            foreach (var recentRepository in Repositories)
            {
                if (!recentRepository.Path.Equals(repo, StringComparison.CurrentCultureIgnoreCase))
                {
                    continue;
                }
                anchor = recentRepository.Anchor;
                Repositories.Remove(recentRepository);
                break;
            }

            var repository = new Repository(repo, null, null)
            {
                RepositoryType = RepositoryType.History,
                Anchor         = anchor
            };

            Repositories.Insert(0, repository);

            while (MaxCount > 0 && Repositories.Count > MaxCount)
            {
                Repositories.RemoveAt(MaxCount);
            }
        }