private void LoadExistingConstraints() { DebugSymbolConstraintCollection existingConstraints = DebugSymbolConstraintCollection.Load(); foreach (DebugSymbolConstraint constraint in existingConstraints) { constraints.Items.Add(constraint); } }
/// <summary> /// Validates a configuration against all <see cref="DebugSymbolConstraint"/> saved in the constraints /// file and checks which of the <see cref="DebugSymbolConstraint"/> are unsatisfied with it. /// </summary> /// <remarks> /// A configuration is considered invalid only if it matches the name of a constraint but does not match /// the requested debug type of that constraint. /// </remarks> private static IEnumerable <DebugSymbolConstraint> GetUnsatisfiedConstraints(string configurationName, string debugType) { DebugSymbolConstraintCollection constraints = DebugSymbolConstraintCollection.Load(); foreach (DebugSymbolConstraint constraint in constraints) { // Is the constraint's configuration name contained in "configuration"? bool configurationNameContained = configurationName.Contains(constraint.ConfigurationName); if (configurationNameContained) { // Is the constraint's requested debug type the same as "debugType"? string requestedDebugInfo = constraint.RequestedDebugInfo.ToString().ToLower(); bool debugTypeMatches = debugType.Equals(requestedDebugInfo); if (!debugTypeMatches) { // This constraint is unsatisfied. yield return(constraint); } } } }