public void AddExtensionFromDisk(string extensionPath)
        {
            try
            {
                IExtensibleFrameworkInterface efi = null;

                Assembly assembly = Assembly.LoadFile(extensionPath);
                Type[]   types    = assembly.GetTypes();

                for (int i = 0; i < types.Length; i++)
                {
                    if (types[i].GetInterface(typeof(IExtensibleFrameworkInterface).FullName) != null)
                    {
                        efi = (IExtensibleFrameworkInterface)Activator.CreateInstance(types[i]);
                        break;
                    }
                }

                AddExtension(efi);
            }
            catch (Exception ex)
            {
                throw new Exception("An implementation for 'IExtensibleFrameworkInterface' could not be found in the specified assembly.");
            }
        }
Esempio n. 2
0
 public void EnableExtension(IExtensibleFrameworkInterface extension)
 {
     if (Extensions == null)
     {
         Extensions = new List <IExtensibleFrameworkInterface>();
     }
     Extensions.Add(extension);
 }
 /// <summary>
 /// Enable the loading of a framework extension (EFI) as soon as the server core is booted
 /// </summary>
 /// <param name="extension"></param>
 protected void EnableExtension(IExtensibleFrameworkInterface extension)
 {
     Services.GetService <IEFIManager>().AddExtension(extension);
 }
 public void AddExtension(IExtensibleFrameworkInterface extension)
 {
     Extensions.Add(extension);
 }