internal static ValidationError[] ValidateAscendingQuotas(PropertyBag propertyBag, ProviderPropertyDefinition[] ascendingQuotaDefinitions, ObjectId identity) { List <ValidationError> list = new List <ValidationError>(ascendingQuotaDefinitions.Length); ProviderPropertyDefinition providerPropertyDefinition = null; Unlimited <ByteQuantifiedSize> unlimited = default(Unlimited <ByteQuantifiedSize>); int num = 0; while (ascendingQuotaDefinitions.Length > num) { ProviderPropertyDefinition providerPropertyDefinition2 = ascendingQuotaDefinitions[num]; Unlimited <ByteQuantifiedSize> unlimited2 = (Unlimited <ByteQuantifiedSize>)propertyBag[providerPropertyDefinition2]; if (!unlimited2.IsUnlimited) { if (providerPropertyDefinition != null && 0 < unlimited.CompareTo(unlimited2)) { if (propertyBag.IsChanged(providerPropertyDefinition)) { list.Add(new ObjectValidationError(DirectoryStrings.ErrorProperty1GtProperty2(providerPropertyDefinition.Name, unlimited.ToString(), providerPropertyDefinition2.Name, unlimited2.ToString()), identity, string.Empty)); } else { list.Add(new ObjectValidationError(DirectoryStrings.ErrorProperty1LtProperty2(providerPropertyDefinition2.Name, unlimited2.ToString(), providerPropertyDefinition.Name, unlimited.ToString()), identity, string.Empty)); } } providerPropertyDefinition = providerPropertyDefinition2; unlimited = unlimited2; } num++; } return(list.ToArray()); }
private static Unlimited <T> Min <T>(Unlimited <T> left, Unlimited <T> right) where T : struct, IComparable { if (left.CompareTo(right) < 0) { return(left); } return(right); }