public RepositoryInfo GetRepositoryFromGuid(Guid guid) { lock (this) { if (GuidToRepository.ContainsKey(guid)) { return(GuidToRepository[guid]); } } return(null); }
protected void LoadRepositories() { lock (GuidToRepository) { GuidToRepository.Clear(); foreach (RepositoryInfo nextRepo in Settings.GetRepositories()) { DirectoryInfo rootDirectory = new DirectoryInfo(nextRepo.RepositoryPath); GuidToRepository[nextRepo.Guid] = new LocalRepositoryState(rootDirectory, false); } } }
public void RemoveRepository(Guid guid) { lock (this) { if (GuidToRepository.ContainsKey(guid) == false) { throw new Exception("Repository GUID is not registered."); } RepositoryInfo repoInfo = GuidToRepository[guid]; GuidToRepository.Remove(guid); if (repoInfo.Name != null) { NameToRepository.Remove(repoInfo.Name); } } }
public void AddRepository(RepositoryInfo repoInfo) { lock (this) { if (GetRepositoryFromGuid(repoInfo.Guid) != null) { throw new Exception("Repository GUID is already registered."); } if (repoInfo.Name != null && GetRepositoryFromName(repoInfo.Name) != null) { throw new Exception("Repository name is already registered."); } GuidToRepository.Add(repoInfo.Guid, repoInfo); if (repoInfo.Name != null) { NameToRepository[repoInfo.Name] = repoInfo; } } }