/// <summary> /// Finds any properties in the old-transition that are also in the new one, /// and removes them from the old one. /// </summary> /// <param name="newTransition">The new transition.</param> /// <param name="oldTransition">The old transition.</param> private void removeDuplicates(ZeroitTransitor newTransition, ZeroitTransitor oldTransition) { // Note: This checking might be a bit more efficient if it did the checking // with a set rather than looking through lists. That said, it is only done // when transitions are added (which isn't very often) rather than on the // timer, so I don't think this matters too much. // We get the list of properties for the old and new transitions... IList <ZeroitTransitor.TransitionedPropertyInfo> newProperties = newTransition.TransitionedProperties; IList <ZeroitTransitor.TransitionedPropertyInfo> oldProperties = oldTransition.TransitionedProperties; // We loop through the old properties backwards (as we may be removing // items from the list if we find a match)... for (int i = oldProperties.Count - 1; i >= 0; i--) { // We get one of the properties from the old transition... ZeroitTransitor.TransitionedPropertyInfo oldProperty = oldProperties[i]; // Is this property part of the new transition? foreach (ZeroitTransitor.TransitionedPropertyInfo newProperty in newProperties) { if (oldProperty.target == newProperty.target && oldProperty.propertyInfo == newProperty.propertyInfo) { // The old transition contains the same property as the new one, // so we remove it from the old transition... oldTransition.removeProperty(oldProperty); } } } }