You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
using System; using System.Collections.Concurrent; using System.IO; using System.Linq; using System.Reflection; using System.Web;
namespace CounsellorBL.Helper { public static class AssemblyHelper { public static ConcurrentDictionary<string, Assembly> Load(Assembly a, string i_sPattern) { ConcurrentDictionary<string, Assembly> dicRes = new ConcurrentDictionary<string, Assembly>(); if (a != null && i_sPattern != null) { FileInfo fi = new FileInfo(HttpUtility.UrlDecode(new Uri(a.CodeBase).AbsolutePath)); FileInfo[] afi = fi.Directory.GetFiles(i_sPattern);
foreach (FileInfo fiCur in afi) { if (!a.GetReferencedAssemblies().Any(x => x.Name == fiCur.Name)) { #pragma warning disable S3885 // "Assembly.Load" should be used
dicRes.TryAdd(fiCur.Name, Assembly.LoadFile(fiCur.FullName)); #pragma warning restore S3885 // "Assembly.Load" should be used
} } } return dicRes; } } }
|