public static Component CreateFromXml(XmlElement element) { Component l_Comp; string xmltype = element.Attributes["type"].InnerText; if (xmltype == "msi") { l_Comp = new ComponentMsi(); } else if (xmltype == "msu") { l_Comp = new ComponentMsu(); } else if (xmltype == "msp") { l_Comp = new ComponentMsp(); } else if (xmltype == "cmd") { l_Comp = new ComponentCmd(); } else if (xmltype == "openfile") { l_Comp = new ComponentOpenFile(); } else if (xmltype == "exe") { l_Comp = new ComponentExe(); } else { throw new Exception(string.Format("Invalid type: {0}", xmltype)); } l_Comp.FromXml(element); return(l_Comp); }
public static Component CreateFromXml(XmlElement element) { Component l_Comp; string xmltype = element.Attributes["type"].InnerText; if (xmltype == "msi") l_Comp = new ComponentMsi(); else if (xmltype == "msu") l_Comp = new ComponentMsu(); else if (xmltype == "msp") l_Comp = new ComponentMsp(); else if (xmltype == "cmd") l_Comp = new ComponentCmd(); else if (xmltype == "openfile") l_Comp = new ComponentOpenFile(); else if (xmltype == "exe") l_Comp = new ComponentExe(); else throw new Exception(string.Format("Invalid type: {0}", xmltype)); l_Comp.FromXml(element); return l_Comp; }
public void TestUninstallMspSilentMode() { Console.WriteLine("TestUninstallMspSilentMode"); InstallUILevel[] testUILevels = { InstallUILevel.basic, InstallUILevel.silent }; foreach (InstallUILevel uilevel in testUILevels) { // a configuration with no components ConfigFile configFile = new ConfigFile(); SetupConfiguration setupConfiguration = new SetupConfiguration(); configFile.Children.Add(setupConfiguration); ComponentMsp msp = new ComponentMsp(); msp.package = "mspdoesntexist.msp"; msp.uninstall_cmdparameters = ""; msp.uninstall_cmdparameters_basic = "/qb-"; msp.uninstall_cmdparameters_silent = "/qb-"; InstalledCheckFile self = new InstalledCheckFile(); self.filename = dotNetInstallerExeUtils.Executable; self.comparison = installcheckfile_comparison.exists; msp.Children.Add(self); setupConfiguration.Children.Add(msp); // silent install, no dialog messages configFile.ui_level = uilevel; // save config file string configFilename = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString() + ".xml"); Console.WriteLine("Writing '{0}'", configFilename); configFile.SaveAs(configFilename); // execute dotNetInstaller dotNetInstallerExeUtils.RunOptions options = new dotNetInstallerExeUtils.RunOptions(configFilename); options.uninstall = true; Assert.AreEqual(1619, dotNetInstallerExeUtils.Run(options)); File.Delete(configFilename); } }