mirror of
https://github.com/StockSharp/StockSharp.git
synced 2026-12-04 08:32:23 +00:00
Fix.Core and Fix.Dialects arrive from the closed apps repository. They were only there because Fix.Core referenced the closed Licensing project for a single licence check; that check is gone, and with it the reason to keep the FIX protocol out of the open source tree. They are the framework, not a venue - the FIX connector itself goes to the Connectors repository and references these two from here, the same way every connector already references Messages and Media.Names. The obfuscation stub include that both carried is dropped: it names a file at the root of the apps repository, and open sources are not obfuscated. Both build.
54 lines
1.4 KiB
C#
54 lines
1.4 KiB
C#
namespace StockSharp.Fix.Native;
|
|
|
|
using Ecng.Reflection;
|
|
|
|
/// <summary>
|
|
/// Dialect source.
|
|
/// </summary>
|
|
/// <typeparam name="TInterfaceType">Dialect interface type (e.g. IFixDialect).</typeparam>
|
|
/// <typeparam name="TAsmHolder">Assembly holder type.</typeparam>
|
|
public class DialectSource<TInterfaceType, TAsmHolder> : ItemsSourceBase<Type>
|
|
{
|
|
private static readonly CachedSynchronizedSet<Type> _source = [];
|
|
|
|
static DialectSource()
|
|
{
|
|
foreach (var type in typeof(TAsmHolder).Assembly.FindImplementations<TInterfaceType>(true, true))
|
|
{
|
|
Add(type);
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// Add new dialect.
|
|
/// </summary>
|
|
/// <param name="type">Type.</param>
|
|
public static void Add(Type type) => _source.Add(type ?? throw new ArgumentNullException(nameof(type)));
|
|
|
|
/// <summary>
|
|
/// Get values.
|
|
/// </summary>
|
|
/// <returns>Values.</returns>
|
|
protected override IEnumerable<Type> GetValues() => _source.Cache;
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
protected override string GetName(Type value) => value.GetDisplayName();
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
protected override string GetDescription(Type value) => value.GetDescription();
|
|
|
|
/// <summary>
|
|
///
|
|
/// </summary>
|
|
/// <param name="value"></param>
|
|
/// <returns></returns>
|
|
protected override Uri GetIcon(Type value) => value.TryGetIconUrl();
|
|
} |