//--------------------------------------------------------------------- private int ShowStatus() { HostOS hostOS = Component.HostEnvironment.hostOS; foreach (Component comp in _components) { Console.Write("{0, -15}: ", comp.Name); if (comp.InstallOnThisOS(hostOS)) { bool isInstalled = comp.IsInstalled(); Console.WriteLine("Installed: {0} Version: {1}", isInstalled ? "Y" : "N", isInstalled ? comp.GetVersion() : "-"); } else { Console.WriteLine("Skipped, not required on this OS: {0}", hostOS.ToString()); continue; } } return(0); }
//--------------------------------------------------------------------- private int ListComponents() { HostOS hostOS = Component.HostEnvironment.hostOS; foreach (Component comp in _components) { Console.Write("{0, -15}: ", comp.Name); if (comp.InstallOnThisOS(hostOS)) { Console.Write("File: "); foreach (string file in comp.InstallerFiles) { Console.Write("{0} ", file); } Console.WriteLine(); } else { Console.WriteLine("Skipped, not required on this OS: {0}", hostOS.ToString()); continue; } } return(0); }
//--------------------------------------------------------------------- private int UninstallAll(bool removeSysPrereq) { HostOS hostOS = Component.HostEnvironment.hostOS; List <Component> components = _components; components.Reverse(); foreach (Component comp in components) { if (comp.IsSystemPrerequisite && !removeSysPrereq) { continue; // skip this component if this is not a cleanup run } Console.WriteLine("Uninstalling {0} ...", comp.Name); if (!comp.InstallOnThisOS(hostOS)) { Console.WriteLine("component '{0}' is not necessary for this OS: {1}, uninstall skipped", comp.Name, hostOS.ToString()); continue; } if (!comp.IsInstalled() && !comp.ForceOperation) { Console.WriteLine("component '{0}' already uninstalled", comp.Name); continue; } // ignore failure exit codes when uninstalling comp.Uninstall(); } return(0); }
//--------------------------------------------------------------------- private int InstallAll() { HostOS hostOS = Component.HostEnvironment.hostOS; foreach (Component comp in _components) { Console.WriteLine("Installing {0} ...", comp.Name); if (!comp.InstallOnThisOS(hostOS)) { Console.WriteLine("component '{0}' is not necessary for this OS: {1}, skipping install", comp.Name, hostOS.ToString()); continue; } if (comp.IsInstalled() && !_forceInstall && !comp.ForceOperation) { Console.WriteLine("component '{0}' already installed; found version = {1}", comp.Name, comp.GetVersion()); continue; } int exitCode = comp.Install(); if (exitCode != 0) { Console.WriteLine("Component {0} failed to install, aborting!", comp.Name); return(exitCode); } } return(0); }