// Copyright Keysight Technologies 2012-2019
// This Source Code Form is subject to the terms of the Mozilla Public
// License, v. 2.0. If a copy of the MPL was not distributed with this
// file, you can obtain one at http://mozilla.org/MPL/2.0/.
using System.Collections.Generic;
using System.Linq;
namespace OpenTap
{
/// Searches for .NET types. This is the default TypeData searcher.
[Display(".NET Type Data Searcher", "Provides .NET plugin types.")]
public class DotNetTypeDataSearcher : ITypeDataSourceProvider
{
///
/// Get all types found by the search.
///
IEnumerable ITypeDataSearcher.Types => types;
IEnumerable types;
/// Performs an implementation specific search for types. Generates ITypeData objects for all types found Types property.
void ITypeDataSearcher.Search()
{
types = PluginManager.GetSearcher().AllTypes.Values.ToArray();
}
ITypeDataSource ITypeDataSourceProvider.GetSource(ITypeData typeData)
{
if (typeData is TypeData td && td.Assembly.Location != null)
return td.Assembly;
return null;
}
}
}