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); } }
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); } }
public void AddMostRecentRepository(string repo) { repo = repo.Trim(); if (string.IsNullOrEmpty(repo)) { return; } repo = repo.Replace(Settings.PathSeparatorWrong, Settings.PathSeparator); if (!repo.EndsWith(Settings.PathSeparator.ToString()) && !repo.StartsWith("http", StringComparison.CurrentCultureIgnoreCase) && !repo.StartsWith("git", StringComparison.CurrentCultureIgnoreCase) && !repo.StartsWith("ssh", StringComparison.CurrentCultureIgnoreCase)) { repo += Settings.PathSeparator; } foreach (var recentRepository in Repositories) { if (!recentRepository.Path.Equals(repo, StringComparison.CurrentCultureIgnoreCase)) { continue; } Repositories.Remove(recentRepository); break; } var repository = new Repository(repo, null, null) { RepositoryType = RepositoryType.History }; Repositories.Insert(0, repository); if (Repositories.Count > 30) { Repositories.RemoveAt(30); } }