namespace StockSharp.Fix.Native;
using Ecng.Reflection;
///
/// Dialect source.
///
/// Dialect interface type (e.g. IFixDialect).
/// Assembly holder type.
public class DialectSource : ItemsSourceBase
{
private static readonly CachedSynchronizedSet _source = [];
static DialectSource()
{
foreach (var type in typeof(TAsmHolder).Assembly.FindImplementations(true, true))
{
Add(type);
}
}
///
/// Add new dialect.
///
/// Type.
public static void Add(Type type) => _source.Add(type ?? throw new ArgumentNullException(nameof(type)));
///
/// Get values.
///
/// Values.
protected override IEnumerable GetValues() => _source.Cache;
///
///
///
///
///
protected override string GetName(Type value) => value.GetDisplayName();
///
///
///
///
///
protected override string GetDescription(Type value) => value.GetDescription();
///
///
///
///
///
protected override Uri GetIcon(Type value) => value.TryGetIconUrl();
}