示例#1
0
        private string FindWorkspace()
        {
            using (var tfsCollection = TfsCollectionFactory.Create())
            {
                tfsCollection.EnsureAuthenticated();

                var server = tfsCollection.GetService <VersionControlServer>();


                var workspaces = server.QueryWorkspaces(null, server.AuthorizedUser, Environment.MachineName);

                foreach (var w in workspaces)
                {
                    foreach (var f in w.Folders)
                    {
                        if (_serverPath.StartsWith(f.ServerItem, StringComparison.OrdinalIgnoreCase))
                        {
                            return(w.Name);
                        }
                    }
                }
            }

            return(null);
        }
示例#2
0
 public TfsGateway(IFileSystemManager fileSystemManager, IWorkspaceSelector workspaceSelector, IThreadingServices threadingServices)
 {
     _fileSystemManager   = fileSystemManager;
     _workspaceSelector   = workspaceSelector;
     this.Tfs             = TfsCollectionFactory.Create();
     _tfsCache            = new TfsCache(Tfs, ROOT_FOLDER, threadingServices);
     _historyCacheManager = new HistoryCacheManager(this.VersionControlServer);
 }