protected override void AddComponents(Library library, IServiceProvider serviceProvider) { string text = string.Empty; string caption = string.Empty; MessageBoxIcon asterisk = MessageBoxIcon.Asterisk; bool installToGac = this.GetInstallToGac(serviceProvider); ArrayList copyList = new ArrayList(); if (this.ProcessComponentSection(library, Library.RuntimeFilesSection, installToGac, copyList, serviceProvider)) { caption = "Web controls from the library have been added to the toolbox."; } else { caption = "No valid Web controls were found in the library."; } if (this.ProcessComponentSection(library, Library.DesignTimeFilesSection, installToGac, copyList, serviceProvider)) { text = text + "\nWeb control designers from the library have been installed."; } if (copyList.Count > 0) { if (installToGac) { text = text + "\nThere was an error adding the following {0} to the Global Assembly Cache:\n\n"; asterisk = MessageBoxIcon.Hand; } else { text = text + "\nThe following {0} {1} not added to the Global Assembly Cache:\n\n"; asterisk = MessageBoxIcon.Exclamation; } foreach (string str3 in copyList) { text = text + str3 + "\n"; } text = string.Format(text + "\nTo run a web page that uses these assemblies, you will need to copy the {0} listed above to the '\\bin' directory of your web application.", (copyList.Count > 1) ? "assemblies" : "assembly", (copyList.Count > 1) ? "were" : "was"); } base.ShowMessage(caption, text, MessageBoxButtons.OK, asterisk, MessageBoxDefaultButton.Button1, serviceProvider); if (library.Sections.Contains(Library.ClientFilesSection)) { string path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ProgramFiles), @"ASP.NET\Client Files\"); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } library.UnpackFiles(Library.ClientFilesSection, path); } }
private bool ProcessComponentSection(Library library, string sectionName, bool installToGac, ArrayList copyList, IServiceProvider serviceProvider) { IApplicationIdentity service = serviceProvider.GetService(typeof(IApplicationIdentity)) as IApplicationIdentity; IDictionary dictionary = (IDictionary) library.Sections[sectionName]; bool flag = false; if ((dictionary != null) && (dictionary.Count > 0)) { if (!Directory.Exists(service.ComponentsPath)) { Directory.CreateDirectory(service.ComponentsPath); } foreach (string str in library.UnpackFiles(sectionName, service.ComponentsPath)) { bool flag2 = false; if (installToGac) { flag2 = this.InstallToGac(str); } if (!flag2) { copyList.Add(str); } Assembly assembly = Assembly.Load(AssemblyName.GetAssemblyName(str)); flag |= base.ProcessAssembly(assembly); } } return flag; }
protected override void AddComponents(Library library, IServiceProvider serviceProvider) { IApplicationIdentity service = serviceProvider.GetService(typeof(IApplicationIdentity)) as IApplicationIdentity; IDictionary dictionary = (IDictionary) library.Sections[Library.RuntimeFilesSection]; string text = string.Empty; if ((dictionary != null) && (dictionary.Count > 0)) { if (!Directory.Exists(service.PluginsPath)) { Directory.CreateDirectory(service.PluginsPath); } bool flag = false; foreach (string str2 in library.UnpackFiles(Library.RuntimeFilesSection, service.PluginsPath)) { Assembly assembly = Assembly.LoadFrom(str2); flag |= base.ProcessAssembly(assembly); } if (!flag) { text = "No valid CodeWizards were found."; } else { text = "CodeWizards have added to the toolbox."; } } else { text = "No CodeWizards were found in the library."; } base.ShowMessage("Customize Toolbox", text, serviceProvider); }