public void LoadAssembly() { if (string.IsNullOrEmpty(this.CustomDLL)) { return; } Tracer.TraceInformation("enter-loadassembly"); try { { Tracer.TraceInformation("loading-assembly {0}", Path.Combine(Utils.ExtensionsDirectory, this.CustomDLL)); #if DEBUG this.Assembly = Assembly.LoadFile(Path.Combine(System.IO.Directory.GetCurrentDirectory(), this.CustomDLL)); #else this.Assembly = Assembly.LoadFile(Path.Combine(Utils.ExtensionsDirectory, this.CustomDLL)); #endif Type[] types = Assembly.GetExportedTypes(); Type type = types.Where(u => u.GetInterface("Microsoft.MetadirectoryServices.IMASynchronization") != null).FirstOrDefault(); if (type != null) { instance = Activator.CreateInstance(type) as IMASynchronization; } } } catch (Exception ex) { Tracer.TraceError("loadassembly {0}", ex.GetBaseException()); throw; } finally { Tracer.TraceInformation("exit-loadassembly"); } }
public ImportTests() { UINotifyPropertyChanges.BeginIgnoreAllChanges(); MAExtensionObject re = new MAExtensionObject(); this.re = re; this.rulesExtension = re; }
private void Initialize() { if (!hasInitialized) { if (ExtensionPassThroughAction.InitializedExtensions.ContainsKey(this.ExtensionFileName)) { this.extensionInterface = ExtensionPassThroughAction.InitializedExtensions[this.ExtensionFileName]; } else { this.LoadExtension(); this.extensionInterface.Initialize(); ExtensionPassThroughAction.InitializedExtensions.Add(this.ExtensionFileName, this.extensionInterface); } hasInitialized = true; } }
internal void LoadExtension() { this.extensionAssembly = Assembly.LoadFrom(this.ExtensionFileName); Type intType = typeof(IMASynchronization); foreach (Type t in this.extensionAssembly.GetExportedTypes()) { if (!t.IsClass || t.IsNotPublic) { continue; } if (intType.IsAssignableFrom(t)) { this.extensionInterface = (IMASynchronization)Activator.CreateInstance(t); return; } } throw new EntryPointNotFoundException("The extension {0} did not contain a type with the IMASynchronization interface"); }