예제 #1
0
        private bool IsFile(string name)
        {
            var files = FindFiles(name);

            if (files.Any())
            {
                foreach (var f in files)
                {
                    if (_files.ContainsKey(f))
                    {
                        // if we've got this file already by another parameter, just update it to
                        // keep track that we've somehow got it twice.
                        _files[f].Item1.Add(name);
                    }
                    else
                    {
                        // otherwise, lets' grab the first chunk of this file so we can check what providers
                        // can handle it (later)
                        DictionaryExtensions.Add(_files, f, new List <string> {
                            name
                        }, FilesystemExtensions.ReadBytes(f, 1024));
                    }
                }

                return(true);
            }
            return(false);
        }
예제 #2
0
        public override bool ProcessRecordAsync()
        {
            // record the names in the collection.
            if (!CollectionExtensions.IsNullOrEmpty(Name))
            {
                foreach (var name in Name)
                {
                    DictionaryExtensions.GetOrAdd(_resultsPerName, name, () => null);
                }
            }

            // it's searching for packages.
            // we need to do the actual search for the packages now,
            // and hold the results until EndProcessingAsync()
            // where we can determine if we we have no ambiguity left.
            SearchForPackages();

            return(true);
        }