private ProjectLocationInformation GetProjectLocation(ICredentials credentials, string projectName)
        {
            projectName = projectName.ToLower();
            if (!projectLocations.ContainsKey(projectName))
            {
                string[] servers = this.server.Split(',');
                foreach (string server in servers)
                {
                    ICredentials credentialsForServer = CredentialsHelper.GetCredentialsForServer(server, credentials);
                    SourceItem[] items = sourceControlService.QueryItems(server, credentialsForServer, Constants.ServerRootPath + projectName, RecursionType.None, VersionSpec.Latest, DeletedState.NonDeleted, ItemType.Folder);

                    if (items != null && items.Length > 0)
                    {
                        string remoteProjectName = items[0].RemoteName.Substring(Constants.ServerRootPath.Length);
                        projectLocations[projectName] = new ProjectLocationInformation(remoteProjectName, server);
                    }
                }
                if (!projectLocations.ContainsKey(projectName))
                {
                    throw new InvalidOperationException("Could not find project '" + projectName + "' in: " + this.server);
                }
            }
            return(projectLocations[projectName]);
        }
 public FileRepository(string serverUrl, ICredentials credentials, IWebTransferService webTransferService)
 {
     this.credentials        = CredentialsHelper.GetCredentialsForServer(serverUrl, credentials);
     this.webTransferService = webTransferService;
 }
示例#3
0
 public TfsWorkItemModifier(string serverUrl, ICredentials credentials)
 {
     this.serverUrl   = serverUrl;
     this.credentials = CredentialsHelper.GetCredentialsForServer(serverUrl, credentials);
     username         = this.credentials.GetCredential(new Uri(serverUrl), "basic").UserName;
 }