/// <summary> /// Load adapters assemblies located in the given directory. /// </summary> public static Assembly[] LoadAdapters(string path) { ArrayList assemblies = new ArrayList(); if (Directory.Exists(path)) { foreach (string file in Directory.GetFiles(path, "*.dll")) { try { Assembly assembly = Assembly.LoadFrom(file); ChartAdapterAttribute adapterAttibute = (ChartAdapterAttribute)Attribute.GetCustomAttribute(assembly, typeof(ChartAdapterAttribute)); if (adapterAttibute != null) { assemblies.Add(assembly); } } catch (Exception) // ex) { //System.Windows.Forms.MessageBox.Show("LoadAdapters"+ex.Message); } } } return((Assembly[])assemblies.ToArray(typeof(Assembly))); }
/// <summary> /// Load adapters assemblies by names /// </summary> public static Assembly[] LoadAdapters(string[] assemblyNames) { ArrayList assemblies = new ArrayList(); foreach (string file in assemblyNames) { try { Assembly assembly = Assembly.LoadWithPartialName(file); ChartAdapterAttribute adapterAttibute = (ChartAdapterAttribute)Attribute.GetCustomAttribute(assembly, typeof(ChartAdapterAttribute)); if (adapterAttibute != null) { assemblies.Add(assembly); } } catch (Exception) // ex) { //System.Windows.Forms.MessageBox.Show("LoadAdapters"+ex.Message); } } return((Assembly[])assemblies.ToArray(typeof(Assembly))); }