void AllResults(WorkerResult lastResult, WorkerResult newResult, CancellationToken token)
 {
     // Search files
     if (newResult.IncludeFiles)
     {
         newResult.filteredFiles = new List <ProjectFile> ();
         bool startsWithLastFilter          = lastResult != null && lastResult.pattern != null && newResult.pattern.StartsWith(lastResult.pattern) && lastResult.filteredFiles != null;
         IEnumerable <ProjectFile> allFiles = startsWithLastFilter ? lastResult.filteredFiles : files;
         foreach (ProjectFile file in allFiles)
         {
             token.ThrowIfCancellationRequested();
             SearchResult curResult = newResult.CheckFile(file);
             if (curResult != null)
             {
                 newResult.filteredFiles.Add(file);
                 newResult.results.Add(curResult);
             }
         }
     }
 }
        IEnumerable <SearchResult> AllResults(BackgroundWorker worker, WorkerResult lastResult, WorkerResult newResult)
        {
            string toMatch = newResult.pattern;
            int    i       = toMatch.IndexOf(':');

            if (i != -1)
            {
                toMatch = toMatch.Substring(0, i);
            }

            // Search files
            if (newResult.IncludeFiles)
            {
                newResult.filteredFiles = new List <ProjectFile> ();
                bool startsWithLastFilter          = lastResult.pattern != null && toMatch.StartsWith(lastResult.pattern) && lastResult.filteredFiles != null;
                IEnumerable <ProjectFile> allFiles = startsWithLastFilter ? lastResult.filteredFiles : files;
                foreach (ProjectFile file in allFiles)
                {
                    if (worker.CancellationPending)
                    {
                        yield break;
                    }
                    SearchResult curResult = newResult.CheckFile(file, toMatch);
                    if (curResult != null)
                    {
                        newResult.filteredFiles.Add(file);
                        yield return(curResult);
                    }
                }
            }

            // Search Types
            if (newResult.IncludeTypes)
            {
                newResult.filteredTypes = new List <IType> ();
                bool         startsWithLastFilter = lastResult.pattern != null && toMatch.StartsWith(lastResult.pattern) && lastResult.filteredTypes != null;
                List <IType> allTypes             = startsWithLastFilter ? lastResult.filteredTypes : types;
                foreach (IType type in allTypes)
                {
                    if (worker.CancellationPending)
                    {
                        yield break;
                    }
                    SearchResult curResult = newResult.CheckType(type, toMatch);
                    if (curResult != null)
                    {
                        newResult.filteredTypes.Add(type);
                        yield return(curResult);
                    }
                }
            }

            // Search members
            if (newResult.IncludeMembers)
            {
                newResult.filteredMembers = new List <IMember> ();
                bool           startsWithLastFilter = lastResult.pattern != null && toMatch.StartsWith(lastResult.pattern) && lastResult.filteredMembers != null;
                List <IMember> allMembers           = startsWithLastFilter ? lastResult.filteredMembers : members;
                foreach (IMember member in allMembers)
                {
                    if (worker.CancellationPending)
                    {
                        yield break;
                    }
                    SearchResult curResult = newResult.CheckMember(member, toMatch);
                    if (curResult != null)
                    {
                        newResult.filteredMembers.Add(member);
                        yield return(curResult);
                    }
                }
            }
        }
Exemplo n.º 3
0
        IEnumerable <SearchResult> AllResults(BackgroundWorker worker, WorkerResult lastResult, WorkerResult newResult)
        {
            // Search files
            if (newResult.IncludeFiles)
            {
                newResult.filteredFiles = new List <ProjectFile> ();
                bool startsWithLastFilter          = lastResult.pattern != null && newResult.pattern.StartsWith(lastResult.pattern) && lastResult.filteredFiles != null;
                IEnumerable <ProjectFile> allFiles = startsWithLastFilter ? lastResult.filteredFiles : files;
                foreach (ProjectFile file in allFiles)
                {
                    if (worker.CancellationPending)
                    {
                        yield break;
                    }
                    SearchResult curResult = newResult.CheckFile(file);
                    if (curResult != null)
                    {
                        newResult.filteredFiles.Add(file);
                        yield return(curResult);
                    }
                }
            }
            if (newResult.isGotoFilePattern)
            {
                yield break;
            }

            // Search Types
            if (newResult.IncludeTypes)
            {
                newResult.filteredTypes = new List <IType> ();
                lock (types) {
                    bool         startsWithLastFilter = lastResult.pattern != null && newResult.pattern.StartsWith(lastResult.pattern) && lastResult.filteredTypes != null;
                    List <IType> allTypes             = startsWithLastFilter ? lastResult.filteredTypes : types;
                    foreach (IType type in allTypes)
                    {
                        if (worker.CancellationPending)
                        {
                            yield break;
                        }
                        SearchResult curResult = newResult.CheckType(type);
                        if (curResult != null)
                        {
                            newResult.filteredTypes.Add(type);
                            yield return(curResult);
                        }
                    }
                }
            }

            // Search members
            if (newResult.IncludeMembers)
            {
                newResult.filteredMembers = new List <IMember> ();
                lock (members) {
                    bool           startsWithLastFilter = lastResult.pattern != null && newResult.pattern.StartsWith(lastResult.pattern) && lastResult.filteredMembers != null;
                    List <IMember> allMembers           = startsWithLastFilter ? lastResult.filteredMembers : members;
                    foreach (IMember member in allMembers)
                    {
                        if (worker.CancellationPending)
                        {
                            yield break;
                        }
                        SearchResult curResult = newResult.CheckMember(member);
                        if (curResult != null)
                        {
                            newResult.filteredMembers.Add(member);
                            yield return(curResult);
                        }
                    }
                }
            }
        }
Exemplo n.º 4
0
 void AllResults(WorkerResult lastResult, WorkerResult newResult, CancellationToken token)
 {
     // Search files
     if (newResult.IncludeFiles) {
         newResult.filteredFiles = new List<ProjectFile> ();
         bool startsWithLastFilter = lastResult != null && lastResult.pattern != null && newResult.pattern.StartsWith (lastResult.pattern) && lastResult.filteredFiles != null;
         IEnumerable<ProjectFile> allFiles = startsWithLastFilter ? lastResult.filteredFiles : files;
         foreach (ProjectFile file in allFiles) {
             token.ThrowIfCancellationRequested ();
             SearchResult curResult = newResult.CheckFile (file);
             if (curResult != null) {
                 newResult.filteredFiles.Add (file);
                 newResult.results.Add (curResult);
             }
         }
     }
 }