Beispiel #1
0
 public static RecursionStatus RecurseItems(
     VssProject project, VssProjectCallback projectCallback, VssFileCallback fileCallback)
 {
     if (projectCallback != null)
     {
         RecursionStatus status = projectCallback(project);
         if (status != RecursionStatus.Continue)
         {
             return(status);
         }
     }
     foreach (VssProject subproject in project.Projects)
     {
         RecursionStatus status = RecurseItems(
             subproject, projectCallback, fileCallback);
         if (status == RecursionStatus.Abort)
         {
             return(status);
         }
     }
     foreach (VssFile file in project.Files)
     {
         RecursionStatus status = fileCallback(project, file);
         if (status == RecursionStatus.Abort)
         {
             return(status);
         }
     }
     return(RecursionStatus.Continue);
 }
Beispiel #2
0
        public static RecursionStatus RecurseItems(
            VssProject project, VssProjectCallback projectCallback, VssFileCallback fileCallback)
        {
            if (projectCallback != null)
            {
                RecursionStatus status = projectCallback(project);
                if (status != RecursionStatus.Continue)
                {
                    return(status);
                }
            }
            foreach (VssProject subproject in project.Projects)
            {
                RecursionStatus status = RecurseItems(
                    subproject, projectCallback, fileCallback);
                if (status == RecursionStatus.Abort)
                {
                    return(status);
                }
            }

            HashSet <string> locallyProcessedFiles = new HashSet <string>();

            foreach (VssFile file in project.Files)
            {
                RecursionStatus status = fileCallback(project, file);
                locallyProcessedFiles.Add(file.PhysicalName);
                if (status == RecursionStatus.Abort)
                {
                    return(status);
                }
            }
            foreach (VssRevision revision in project.Revisions)
            {
                var namedAction = revision.Action as VssNamedAction;
                if (namedAction != null && !namedAction.Name.IsProject)
                {
                    string physicalName = namedAction.Name.PhysicalName;
                    if (!locallyProcessedFiles.Contains(physicalName))
                    {
                        VssFile file = project.GetHistoricalFile(physicalName, namedAction.Name.LogicalName);
                        locallyProcessedFiles.Add(file.PhysicalName);
                        if (File.Exists(file.PhysicalPath) && File.Exists(file.DataPath))
                        {
                            RecursionStatus status = fileCallback(project, file);
                            if (status == RecursionStatus.Abort)
                            {
                                return(status);
                            }
                        }
                    }
                }
            }
            return(RecursionStatus.Continue);
        }
Beispiel #3
0
        public static RecursionStatus RecurseItems(
            VssProject project, VssProjectCallback projectCallback, VssFileCallback fileCallback)
        {
            if (projectCallback != null)
            {
                RecursionStatus status = projectCallback(project);
                if (status != RecursionStatus.Continue)
                {
                    return(status);
                }
            }
            bool logged = false;

            try
            {
                foreach (VssProject subproject in project.Projects)
                {
                    RecursionStatus status = RecurseItems(
                        subproject, projectCallback, fileCallback);
                    if (status == RecursionStatus.Abort)
                    {
                        return(status);
                    }
                }
            } catch (System.IO.IOException e)
            {
                logger.WriteLine("Warning: {0}", e);
                logged = true;
            }
            try
            {
                foreach (VssFile file in project.Files)
                {
                    RecursionStatus status = fileCallback(project, file);
                    if (status == RecursionStatus.Abort)
                    {
                        return(status);
                    }
                }
            }
            catch (System.IO.IOException e)
            {
                if (!logged)
                {
                    logger.WriteLine("Warning: {0}", e);
                }
            }
            return(RecursionStatus.Continue);
        }