public void Run()
        {
            string errorMessage;

            NamedPipeMessages.GetActiveRepoListRequest.Response response = new NamedPipeMessages.GetActiveRepoListRequest.Response();
            response.State    = NamedPipeMessages.CompletionState.Success;
            response.RepoList = new List <string>();

            List <RepoRegistration> repos;

            if (this.registry.TryGetActiveRepos(out repos, out errorMessage))
            {
                List <string> tempRepoList = repos.Select(repo => repo.EnlistmentRoot).ToList();

                foreach (string repoRoot in tempRepoList)
                {
                    if (!this.IsValidRepo(repoRoot))
                    {
                        if (!this.registry.TryRemoveRepo(repoRoot, out errorMessage))
                        {
                            this.tracer.RelatedInfo("Removing an invalid repo failed with error: " + response.ErrorMessage);
                        }
                        else
                        {
                            this.tracer.RelatedInfo("Removed invalid repo entry from registry: " + repoRoot);
                        }
                    }
                    else
                    {
                        response.RepoList.Add(repoRoot);
                    }
                }
            }
            else
            {
                response.ErrorMessage = errorMessage;
                response.State        = NamedPipeMessages.CompletionState.Failure;
                this.tracer.RelatedError("Get active repo list failed with error: " + response.ErrorMessage);
            }

            this.WriteToClient(response.ToMessage(), this.connection, this.tracer);
        }
Esempio n. 2
0
        public void Run()
        {
            string errorMessage;

            NamedPipeMessages.GetActiveRepoListRequest.Response response = new NamedPipeMessages.GetActiveRepoListRequest.Response();

            List <RepoRegistration> repos;

            if (this.registry.TryGetActiveRepos(out repos, out errorMessage))
            {
                response.RepoList = repos.Select(repo => repo.EnlistmentRoot).ToList();
                response.State    = NamedPipeMessages.CompletionState.Success;
            }
            else
            {
                response.ErrorMessage = errorMessage;
                response.State        = NamedPipeMessages.CompletionState.Failure;
                this.tracer.RelatedError("Get active repo list failed with error: " + response.ErrorMessage);
            }

            this.WriteToClient(response.ToMessage(), this.connection, this.tracer);
        }