Exemplo n.º 1
0
        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");
            }
        }
Exemplo n.º 2
0
        public ImportTests()
        {
            UINotifyPropertyChanges.BeginIgnoreAllChanges();
            MAExtensionObject re = new MAExtensionObject();

            this.re             = re;
            this.rulesExtension = re;
        }
Exemplo n.º 3
0
        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;
            }
        }
Exemplo n.º 4
0
        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");
        }