/// <summary> /// Uninstalls the component. /// </summary> public void Uninstall() { log.Trace("()"); if (Status.HasFlag(InstallableComponentStatus.Running)) { Stop(); } if (Status.HasFlag(InstallableComponentStatus.AutorunInstalled)) { AutorunSetupUninstall(); } foreach (InstallationFile instFile in installationFiles) { if (instFile.Status != InstallationFileStatus.None) { log.Info("Uninstalling '{0}'.", instFile.Name); instFile.Uninstall(); } } Status &= ~InstallableComponentStatus.InstallationCompleted; log.Trace("(-)"); }
/// <summary> /// Installs all installation files of the component. /// </summary> /// <returns>true if the function succeeds, false otherwise.</returns> public virtual bool Install() { log.Trace("()"); bool res = false; Status = InstallableComponentStatus.InstallationInitiated; bool error = false; installationFiles = GetInstallationFiles(); foreach (InstallationFile instFile in installationFiles) { log.Info("Installing '{0}'.", instFile.Name); CUI.WriteRich("Installing module <white>{0}</white>.\n", instFile.Name); if (!instFile.Install()) { log.Error("Installation of '{0}' failed.", instFile.Name); error = true; break; } } if (!error) { Status |= InstallableComponentStatus.InstallationCompleted; res = true; } else { // Cleanup. foreach (InstallationFile instFile in installationFiles) { if (instFile.Status != InstallationFileStatus.None) { log.Info("Uninstalling '{0}'.", instFile.Name); instFile.Uninstall(); } } } log.Trace("(-):{0}", res); return(res); }