/// <summary> /// Attempts to increment the RunCount option for the specified version of the specified Type /// </summary> /// <param name="configuration">The configuration in which the option will be found</param> /// <param name="type">The Type for which the RunCount value will be incremented</param> /// <returns></returns> public static bool IncrementRunCountForVersionOfType(XmlConfiguration configuration, Type type, out DateTime installDate, out int runCount) { installDate = DateTime.Now; runCount = 0; try { XmlConfigurationCategory category = InstallationEngine.GetExistingCategoryForTypeVersion(configuration, type, CategoryNames.Installed); if (category != null) { XmlConfigurationOption option = null; option = category.Options[@"InstallDate"]; if (option != null) { installDate = (DateTime)option.Value; } option = category.Options[@"RunCount"]; if (option != null) { // retrieve, increment, and set the run count runCount = (int)option.Value; runCount++; option.Value = runCount; } } } catch (System.Exception systemException) { System.Diagnostics.Trace.WriteLine(systemException); } return(false); }
public static bool RemoveUninstalledEntryForType(XmlConfiguration configuration, Type type) { XmlConfigurationCategory category = null; // find and remove the install category for this type category = InstallationEngine.GetExistingCategoryForTypeVersion(configuration, type, CategoryNames.Uninstalled); if (category != null) { category.Remove(); category = null; } return(true); }