Beispiel #1
0
        private NuGenFoundItemEventArgs OnFoundItem(NuGenAssembly assembly, NuGenTokenBase tokenObject)
        {
            NuGenFoundItemEventArgs eventArgs   = new NuGenFoundItemEventArgs(assembly, tokenObject);
            IAsyncResult            asyncResult = CallbackForm.BeginInvoke(FoundItemCallback, this, eventArgs);

            asyncResult.AsyncWaitHandle.WaitOne();

            return(eventArgs);
        }
Beispiel #2
0
        private void Search(object searchTextObject)
        {
            bool   cancel     = false;
            string searchText = (string)searchTextObject;

            if (NuGenProject.Instance.Assemblies != null)
            {
                List <NuGenAssembly> .Enumerator assemblyEnumerator = NuGenProject.Instance.Assemblies.GetEnumerator();

                while (!cancel && assemblyEnumerator.MoveNext())
                {
                    Dictionary <uint, NuGenTokenBase> .ValueCollection.Enumerator tokenEnumerator = assemblyEnumerator.Current.AllTokens.Values.GetEnumerator();

                    if (((assemblyEnumerator.Current.SearchOptions & SearchOptions.Assembly) == SearchOptions.Assembly &&
                         assemblyEnumerator.Current.Name != null && assemblyEnumerator.Current.Name.Contains(searchText)) ||
                        (assemblyEnumerator.Current.SearchOptions & SearchOptions.TokenValues) == SearchOptions.TokenValues &&
                        assemblyEnumerator.Current.Token.ToString("x").Contains(searchText))
                    {
                        NuGenFoundItemEventArgs eventArgs = OnFoundItem(assemblyEnumerator.Current, assemblyEnumerator.Current);

                        cancel = eventArgs.Cancel;
                    }

                    while (!cancel && tokenEnumerator.MoveNext())
                    {
                        NuGenTokenBase tokenObject   = tokenEnumerator.Current;
                        SearchOptions  searchOptions = assemblyEnumerator.Current.SearchOptions;

                        if ((tokenObject.ItemType != SearchOptions.None &&
                             (searchOptions & tokenObject.ItemType) == tokenObject.ItemType &&
                             ((searchText.Length == 0 ||
                               (tokenObject.Name != null && tokenObject.Name.Contains(searchText))))) ||
                            ((searchOptions & SearchOptions.TokenValues) == SearchOptions.TokenValues &&
                             tokenObject.Token.ToString("x").Contains(searchText) &&
                             tokenObject.ItemType != SearchOptions.None))
                        {
                            NuGenFoundItemEventArgs eventArgs = OnFoundItem(assemblyEnumerator.Current, tokenObject);

                            cancel = eventArgs.Cancel;
                        }
                    }
                }
            }
        }
Beispiel #3
0
        private void FoundItem(object sender, NuGenFoundItemEventArgs eventArgs)
        {
            if (sender != QuickFinder)
            {
                eventArgs.Cancel = true;
            }
            else
            {
                ListViewGroup assemblyGroup = (FoundAssemblies.ContainsKey(eventArgs.Assembly) ? FoundAssemblies[eventArgs.Assembly] : null);

                if (assemblyGroup == null)
                {
                    assemblyGroup = new ListViewGroup(eventArgs.Assembly.Name);
                    foundItemsList.Groups.Add(assemblyGroup);
                    FoundAssemblies[eventArgs.Assembly] = assemblyGroup;
                }

                ListViewItem foundItem = new ListViewItem(new string[] { eventArgs.FoundTokenObject.Name, Convert.ToString(eventArgs.FoundTokenObject.ItemType) });
                foundItem.Group       = assemblyGroup;
                foundItem.ToolTipText = eventArgs.FoundTokenObject.Name;
                foundItem.Tag         = eventArgs.FoundTokenObject;
                foundItemsList.Items.Add(foundItem);
            }
        }