/// <summary> /// Sets the <see cref="ISpatial"/>s to place a transformation boxes over. Items that are the /// same <see cref="Type"/> as the <see cref="Type"/>s define din <see cref="TypesToIgnore"/> will not be added, /// and neither will <see cref="ISpatial"/>s where <see cref="ISpatial.SupportsMove"/> and /// <see cref="ISpatial.SupportsResize"/> is false. /// </summary> /// <param name="items">The <see cref="ISpatial"/>s to place transformation boxes over. Using a null or /// empty collection is synonymous with just using <see cref="Clear"/>.</param> /// <param name="camera">The camera describing the view area.</param> public void SetItems(IEnumerable <ISpatial> items, ICamera2D camera) { // Clear Clear(camera); if (items == null) { return; } // Get the items to add // If it doesn't support moving, don't add it, even if it supports resizing since a lot of our resizing requires moving var toAdd = items.Where(x => x.SupportsMove && TypesToIgnore.All(y => x.GetType() != y)); if (toAdd.IsEmpty()) { return; } // Add the items _items.AddRange(toAdd); // Update UpdateTransBoxes(camera); }
private bool IgnoreTypeForType(Type type, Type typeToIgnore) { if (TypeSpecificCompareOptions.ContainsKey(type)) { return(TypeSpecificCompareOptions[type].TypesToIgnore.Contains(typeToIgnore)); } return(TypesToIgnore.Contains(typeToIgnore)); }
private void CompareWithCustomComparer(object object1, object object2, string breadCrumb, Type t1, Delegate customComparer) { if (TypesToIgnore.Contains(t1)) { return; } CustomComparerDelegateWithDifferenceRecording customComparerDelegateWithDifferenceRecording = customComparer as CustomComparerDelegateWithDifferenceRecording; CustomComparerDelegate customComparerDelegate = customComparer as CustomComparerDelegate; if (customComparerDelegateWithDifferenceRecording != null) { // Compare with a custom comparator List <string> differences = customComparerDelegateWithDifferenceRecording.Invoke(object1, object2); if (differences.Count > 0) { Differences.AddRange(differences); } } else { if (customComparerDelegate != null) { // Compare with a custom comparator if (!customComparerDelegate.Invoke(object1, object2)) { Differences.Add(string.Format("object1{0} != object2{0} ({1},{2})", breadCrumb, object1, object2)); } } else { throw new InvalidOperationException("Bad custom comparer specified."); } } if (Differences.Count >= MaxDifferences) { return; } }
private bool ShouldCreateUiFor(Type type, string memberName) { if (TypesToIgnore.Contains(type)) { return(false); } if (MembersToIgnore.Contains(memberName)) { return(false); } if (typeof(Delegate).IsAssignableFrom(type)) { return(false); } return(true); }
/// <summary> /// Compare the properties, fields of a class /// </summary> /// <param name="object1"></param> /// <param name="object2"></param> /// <param name="breadCrumb"></param> private void CompareClass(object object1, object object2, string breadCrumb) { try { _parents.Add(object1); _parents.Add(object2); Type t1 = object1.GetType(); //We ignore the class name if (ElementsToIgnore.Contains(t1.Name)) { return; } if (TypesToIgnore.Contains(t1)) { return; } if (CompareChildrenForType(t1)) { // Compare the properties, if allowed for this object type if (ComparePropertiesForType(t1)) { PerformCompareProperties(t1, object1, object2, breadCrumb); } // Compare the fields, if allowed for this object type if (CompareFieldsForType(t1)) { PerformCompareFields(t1, object1, object2, breadCrumb); } } } finally { _parents.Remove(object1); _parents.Remove(object2); } }
public DefaultRegistration() : base(typeof(DefaultRegistration).Assembly) { TypesToIgnore.Add(typeof(ITicketDataToPrincipalMapper)); TypesToIgnore.Add(typeof(IUnauthenticatedPrincipalCreator)); }