Inheritance: Microsoft.TeamFoundation.Client.Services.TFSCollectionService
コード例 #1
0
 private UpdateLocalVersion ProcessDelete(GetOperation operation, VersionControlDownloadService downloadService, ProcessDirection processDirection, ProcessType processType)
 {
     if (processDirection == ProcessDirection.Undo)
     {
         var update   = ProcessGet(operation, downloadService, ProcessDirection.Normal);
         var filePath = (FilePath)operation.TargetLocalItem;
         var projects = IdeApp.Workspace.GetAllProjects();
         foreach (var project in projects)
         {
             if (filePath.IsChildPathOf(project.BaseDirectory))
             {
                 if (operation.ItemType == ItemType.File)
                 {
                     project.AddFile(operation.TargetLocalItem);
                 }
                 if (operation.ItemType == ItemType.Folder)
                 {
                     project.AddDirectory(operation.TargetLocalItem.Substring(((string)project.BaseDirectory).Length + 1));
                 }
                 break;
             }
         }
         return(update);
     }
     else
     {
         return(InternalProcessDelete(operation, processType));
     }
 }
コード例 #2
0
        private string DownloadFile(GetOperation operation, VersionControlDownloadService downloadService)
        {
            string path = string.IsNullOrEmpty(operation.TargetLocalItem) ? operation.SourceLocalItem : operation.TargetLocalItem;

            if (string.IsNullOrEmpty(path))
            {
                return(string.Empty);
            }
            if (operation.ItemType == ItemType.Folder)
            {
                if (!Directory.Exists(path))
                {
                    Directory.CreateDirectory(path);
                }
                return(path);
            }
            if (operation.ItemType == ItemType.File)
            {
                if (!Directory.Exists(Path.GetDirectoryName(path)))
                {
                    Directory.CreateDirectory(Path.GetDirectoryName(path));
                }
                return(downloadService.Download(path, operation.ArtifactUri));
            }
            return(string.Empty);
        }
コード例 #3
0
 private UpdateLocalVersion ProcessGet(GetOperation operation, VersionControlDownloadService downloadService, ProcessDirection processDirection)
 {
     if (processDirection == ProcessDirection.Normal)
     {
         var path = DownloadFile(operation, downloadService);
         if (operation.ItemType == ItemType.File)
         {
             MakeFileReadOnly(path);
         }
         return(new UpdateLocalVersion(operation.ItemId, path, operation.VersionServer));
     }
     return(null);
 }
コード例 #4
0
 private UpdateLocalVersion ProcessEdit(GetOperation operation, VersionControlDownloadService downloadService, ProcessDirection processDirection)
 {
     if (processDirection == ProcessDirection.Undo)
     {
         var path = DownloadFile(operation, downloadService);
         if (operation.ItemType == ItemType.File)
         {
             MakeFileReadOnly(path);
         }
     }
     else
     {
         string path = string.IsNullOrEmpty(operation.TargetLocalItem) ? operation.SourceLocalItem : operation.TargetLocalItem;
         MakeFileWritable(path);
     }
     return(new UpdateLocalVersion(operation.ItemId, operation.TargetLocalItem, operation.VersionServer));
 }