diff --git a/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs b/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs index 6a27d40a35..26636918c6 100644 --- a/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs +++ b/src/chocolatey/infrastructure.app/configuration/ConfigFileSettings.cs @@ -27,14 +27,6 @@ namespace chocolatey.infrastructure.app.configuration [XmlRoot("chocolatey")] public class ConfigFileSettings { - [Obsolete("This will be removed in v1 of Chocolatey")] - [XmlElement(ElementName = "cacheLocation")] - public string CacheLocation { get; set; } - - [Obsolete("This will be removed in v1 of Chocolatey")] - [XmlElement(ElementName = "commandExecutionTimeoutSeconds")] - public int CommandExecutionTimeoutSeconds { get; set; } - [XmlArray("config")] public HashSet ConfigSettings { get; set; } @@ -57,9 +49,7 @@ public override bool Equals(object obj) var item = (ConfigFileSettings) obj; - return (CacheLocation == item.CacheLocation) - && (CommandExecutionTimeoutSeconds == item.CommandExecutionTimeoutSeconds) - && (ConfigSettings == item.ConfigSettings) + return (ConfigSettings == item.ConfigSettings) && (Sources == item.Sources) && (Features == item.Features) && (ApiKeys == item.ApiKeys); @@ -68,9 +58,7 @@ public override bool Equals(object obj) public override int GetHashCode() { return HashCode - .Of(CacheLocation) - .And(CommandExecutionTimeoutSeconds) - .AndEach(ConfigSettings) + .OfEach(ConfigSettings) .AndEach(Sources) .AndEach(Features) .AndEach(ApiKeys); diff --git a/src/chocolatey/infrastructure.app/utility/HashCode.cs b/src/chocolatey/infrastructure.app/utility/HashCode.cs index cac40983e2..21522be0fb 100644 --- a/src/chocolatey/infrastructure.app/utility/HashCode.cs +++ b/src/chocolatey/infrastructure.app/utility/HashCode.cs @@ -43,6 +43,17 @@ public static HashCode Of(T item) return new HashCode(GetHashCode(item)); } + public static HashCode OfEach(IEnumerable items) + { + if (items == null) + { + return new HashCode(this.value); + } + + var hashCode = items.Any() ? items.Select(GetHashCode).Aggregate(CombineHashCodes) : 0; + return new HashCode(CombineHashCodes(this.value, hashCode)); + } + public HashCode And(T item) { return new HashCode(CombineHashCodes(this.value, GetHashCode(item)));