Files
mika@stocksharp.com f1f267d7f3 Take in the FIX protocol library and its dialect framework
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.
2026-07-30 20:22:03 +03:00

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();
}