public static string GetPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName, string featureName, bool tryWithoutFeature) { string featurePropName = propName; if ( !string.IsNullOrEmpty(featureName) && // if belongs to a feature propName.Equals(propName.ToUpper()) // if it is a public property (upper case) ) { featurePropName = string.Format("{0}_{1}", propName, featureName); } Func <string, string> valueGetter = (name) => { if (session.IsInDeferredMode()) { return(session.CustomActionData[name]); } else { return(session[name]); } }; var ret = valueGetter(featurePropName); if (string.IsNullOrEmpty(ret) && !featurePropName.Equals(propName)) { ret = valueGetter(propName); } return(ret); }
public static void ShowErrorMessage(this Microsoft.Deployment.WindowsInstaller.Session session, Exception ex) { Microsoft.Deployment.WindowsInstaller.Record record = new Microsoft.Deployment.WindowsInstaller.Record(); record.FormatString = ex.ToString(); session.Message( Microsoft.Deployment.WindowsInstaller.InstallMessage.Error | (Microsoft.Deployment.WindowsInstaller.InstallMessage)System.Windows.Forms.MessageBoxButtons.OK | (Microsoft.Deployment.WindowsInstaller.InstallMessage)System.Windows.Forms.MessageBoxIcon.Error, record); }
public static bool GetBooleanPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName, string featureName, bool tryWithoutFeature) { var stringValue = GetPropertyValue(session, propName, featureName, tryWithoutFeature); bool ret; bool.TryParse(stringValue, out ret); return(ret); }
public static void SetPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName, string propValue) { if (session.IsInDeferredMode()) { session.CustomActionData[propName] = propValue; } else { session[propName] = propValue; } }
public static WindowHandleWrapper InstallerWindowWrapper(this Microsoft.Deployment.WindowsInstaller.Session session) { var title = session.GetPropertyValue(PropertyNames.ProductName); var ret = new WindowHandleWrapper(title + " Setup"); if (ret.Handle == IntPtr.Zero) { ret = new WindowHandleWrapper(title); } return(ret); }
public static Version GetDetectedOlderVersion(this Microsoft.Deployment.WindowsInstaller.Session session) { var olderVersionProductCodeProp = session.GetPropertyValue(PropertyNames.OlderVersionDetected); if (!string.IsNullOrEmpty(olderVersionProductCodeProp)) { var productCodes = olderVersionProductCodeProp.Split(new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries); var versions = from code in productCodes join prod in Microsoft.Deployment.WindowsInstaller.ProductInstallation.AllProducts.AsQueryable() on code equals prod.ProductCode select prod.ProductVersion; if (versions.Count() > 0) { return(versions.Max()); } } return(null); }
public SessionWrapper(Microsoft.Deployment.WindowsInstaller.Session session) { this._session = session; }
public static InstallUILevel UiLevel(this Microsoft.Deployment.WindowsInstaller.Session session) { return((InstallUILevel)int.Parse(session.GetPropertyValue("UILevel"))); }
public static string GetInstallDirProperty(this Microsoft.Deployment.WindowsInstaller.Session session) { return(CprBroker.Utilities.Strings.EnsureDirectoryEndSlash(session.GetPropertyValue(PropertyNames.InstallDir))); }
public static bool GetBooleanPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName, string featureName) { return(GetBooleanPropertyValue(session, propName, featureName, false)); }
public static string GetPropertyValue(this Microsoft.Deployment.WindowsInstaller.Session session, string propName) { return(GetPropertyValue(session, propName, "")); }
public static bool IsOlderVersionDetected(this Microsoft.Deployment.WindowsInstaller.Session session) { return(!string.IsNullOrEmpty(session.GetPropertyValue(PropertyNames.OlderVersionDetected))); }
public static bool IsPatching(this Microsoft.Deployment.WindowsInstaller.Session session) { return(!string.IsNullOrEmpty(session.GetPropertyValue(PropertyNames.Patch))); }
public static bool IsInDeferredMode(this Microsoft.Deployment.WindowsInstaller.Session session) { return(session.GetMode(Microsoft.Deployment.WindowsInstaller.InstallRunMode.Scheduled) || session.GetMode(Microsoft.Deployment.WindowsInstaller.InstallRunMode.Rollback) || session.GetMode(Microsoft.Deployment.WindowsInstaller.InstallRunMode.Commit)); }