예제 #1
0
 protected override void ExecuteTask()
 {
     Workspace[] Workspaces = this.ServerConnection.SourceControl.QueryWorkspaces(this.WorkspaceName, this.ServerConnection.SourceControl.AuthenticatedUser, Workstation.Current.Name);
     if (Workspaces.Length == 0 && !(this.Delete || this.DeleteMappings))
     {
         this.ServerConnection.SourceControl.CreateWorkspace(this.WorkspaceName, this.ServerConnection.SourceControl.AuthenticatedUser, this.Comment, this.Mappings.GetMappings());
     }
     else if (this.Delete)
     {
         WorkspaceAssistant Helper = new WorkspaceAssistant();
         Workspace MyWorkspace = Helper.GetWorkspaceByName(this.WorkspaceName, this.ServerConnection.SourceControl);
         MyWorkspace.Delete();
     }
     else if (this.DeleteMappings)
     {
         WorkspaceAssistant Helper = new WorkspaceAssistant();
         Workspace MyWorkspace = Helper.GetWorkspaceByName(this.WorkspaceName, this.ServerConnection.SourceControl);
         foreach (WorkingFolder Map in this.Mappings.GetMappings())
         {
             MyWorkspace.DeleteMapping(Map);
         }
     }
     else
     {
         WorkspaceAssistant Helper = new WorkspaceAssistant();
         Workspace MyWorkspace = Helper.GetWorkspaceByName(this.WorkspaceName, this.ServerConnection.SourceControl);
         foreach (WorkingFolder Map in this.Mappings.GetMappings())
         {
             MyWorkspace.Map(Map.ServerItem, Map.LocalItem);
         }
     }
 }
 private Workspace GetWorkspace(string connectionRefId, string workspaceName)
 {
     TfsServerConnection ServerConnection = this.GetServerConnection(connectionRefId);
     WorkspaceAssistant Helper = new WorkspaceAssistant();
     Workspace MyWorkspace = Helper.GetWorkspaceByName(workspaceName, ServerConnection.SourceControl);
     return MyWorkspace;
 }