private static CheckResult CheckDataIfStartMenuIsExpectedToNotExist(ICollection<FileChange> fileChanges, ICollection<Registryhange> registryChanges, FileChange fileChange, StartMenuData startMenuData, Registryhange registryChange) { if (fileChange == null) { return CheckResult.Succeeded(startMenuData); } if (fileChange.Type != FileChangeType.Delete) { fileChanges.Remove(fileChange); if (registryChange != null) { registryChanges.Remove(registryChange); } return CheckResult.Failure("Found menu item:'" + startMenuData.Name + "' when is was not expected"); } // When uninstalling this key get changed const string startPageKey = @"HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Explorer\StartPage"; var uninstallStartMenuKey = registryChanges.FirstOrDefault(x => string.Equals(x.Key, startPageKey, StringComparison.InvariantCultureIgnoreCase) && x.ValueName == "FavoritesRemovedChanges" && x.Type == RegistryChangeType.SetValue); if (uninstallStartMenuKey == null) { fileChanges.Remove(fileChange); return CheckResult.Failure(""); } registryChanges.Remove(uninstallStartMenuKey); fileChanges.Remove(fileChange); return CheckResult.Succeeded(startMenuData); }
private static CheckResult CheckDataIfStartMenuIsExpectedToExist(ICollection<FileChange> fileChanges, ICollection<Registryhange> registryChanges, FileChange fileChange, StartMenuData startMenuData, Registryhange registryChange) { if (fileChange == null) { return CheckResult.Failure("Could not find start menu item:'" + startMenuData.Name + "'"); } if (fileChange.Type == FileChangeType.Delete) { fileChanges.Remove(fileChange); return CheckResult.Failure("Could not find start menu item:'" + startMenuData.Name + "'"); } if (registryChange == null) { fileChanges.Remove(fileChange); return CheckResult.Failure("Could not find start menu item:'" + startMenuData.Name + "'"); } fileChanges.Remove(fileChange); registryChanges.Remove(registryChange); return CheckResult.Succeeded(startMenuData); }
protected bool Equals(Registryhange other) { return Type == other.Type && string.Equals(Key, other.Key) && string.Equals(Value, other.Value) && string.Equals(ValueName, other.ValueName); }