Exemple #1
0
 private void InitializeFromAssembly()
 {
     Type[] installerTypes;
     try
     {
         installerTypes = AssemblyInstaller.GetInstallerTypes(Assembly);
     }
     catch (Exception ex)
     {
         Context.LogMessage(Res.GetString("InstallException", (object)Path));
         Installer.LogException(ex, Context);
         Context.LogMessage(Res.GetString("InstallAbort", (object)Path));
         throw new InvalidOperationException(Res.GetString("InstallNoInstallerTypes", (object)Path), ex);
     }
     if (installerTypes == null || installerTypes.Length == 0)
     {
         Context.LogMessage(Res.GetString("InstallNoPublicInstallers", (object)Path));
     }
     else
     {
         for (var index = 0; index < installerTypes.Length; ++index)
         {
             try
             {
                 Installers.Add((Installer)Activator.CreateInstance(installerTypes[index], BindingFlags.Instance | BindingFlags.Public | BindingFlags.CreateInstance, null, new object[0], null));
             }
             catch (Exception ex)
             {
                 Context.LogMessage(Res.GetString("InstallCannotCreateInstance", (object)installerTypes[index].FullName));
                 Installer.LogException(ex, Context);
                 throw new InvalidOperationException(Res.GetString("InstallCannotCreateInstance", (object)installerTypes[index].FullName), ex);
             }
         }
         _initialized = true;
     }
 }