Exemplo n.º 1
0
 private void OnFileExploreHit(object sender, EventArgs e)
 {
     FileExploreHitArgs args = (FileExploreHitArgs)e;
 }
Exemplo n.º 2
0
        private void OnFileExploreHit(object sender, EventArgs e)
        {
            FileExploreHitArgs args = (FileExploreHitArgs)e;

            if (args.ID.Equals(currentScanID))
            {
                // Use callback if set.
                // This is purposely above the ignore filter check.
                // Results filtered by the primary filter do not make it here.
                // IgnoreFilter is secondary and does not exclude from the callback.
                if (ExploreHitCallback != null)
                {
                    ExploreHitCallback(args.Entry);
                }

                // Ignore filter check.
                if (IgnoreFilter != null && IgnoreFilter.IsMatch(args.Entry.Name))
                {
                    return;
                }

                found++;

                if (fileList != null)
                {
                    if (splitIntoDirectories)
                    {
                        List <string> pathParts = args.Entry.FullName.Split('\\').ToList();

                        int      index       = 1;
                        TreeNode currentNode = null;
                        foreach (string pathPart in pathParts)
                        {
                            if (currentNode != null)
                            {
                                currentNode = TreeNodeHelper.FindOrCreateSubNode(currentNode, pathPart);

                                if (index == pathParts.Count)
                                {
                                    currentNode.Tag = args.Entry;
                                }
                            }
                            else
                            {
                                currentNode = TreeNodeHelper.FindOrCreateSubNode(fileList, pathPart);
                            }
                            index++;
                        }
                    }
                    else
                    {
                        TreeNode newNode = new TreeNode(args.Entry.Name);
                        newNode.Tag = args.Entry;
                        fileList.Nodes.Add(newNode);
                    }
                }

                if (status != null)
                {
                    status.Text = string.Format(Constants.GENERIC_WINDOW_SEARCH_STATE, found, Constants.SEARCH_STATE_SEARCHING);
                }
            }
        }