Example #1
0
        internal void LoadFromItem(ICanCompare item, bool showAllDeclarations)
        {
            if (item == null)
            {
                LoadHtml("");
                return;
            }

            if (!(item is RootDetail))
            {
                LoadHtml(item.ToString());
                return;
            }

            StringBuilder sb = new StringBuilder();

            using (StringWriter sw = new StringWriter(sb))
            {
                HtmlUtility.WriteHtmlStart(sw);
                ((RootDetail)item).WriteHtmlDescription(sw, showAllDeclarations, false);
                HtmlUtility.WriteHtmlEnd(sw);
            }

            LoadHtml(sb.ToString());
        }
Example #2
0
        public ChangeType PerformCompare(ICanCompare from)
        {
            _changeThisInstance = PerformCompareInternal(from, false);

            CalcInheritedChanges();

            return(_changeThisInstance | _changeAllChildren);
        }
Example #3
0
        public static Visibility GetMostVisible(ICanCompare item)
        {
            Visibility visibility = (item is IHaveVisibility) ? ((IHaveVisibility)item).Visibility : Visibility.Private;

            Visibility children = GetMostVisible(item.Children);

            return (visibility > children) ? visibility : children;
        }
Example #4
0
        public static Visibility GetMostVisible(ICanCompare item)
        {
            Visibility visibility = (item is IHaveVisibility) ? ((IHaveVisibility)item).Visibility : Visibility.Private;

            Visibility children = GetMostVisible(item.Children);

            return((visibility > children) ? visibility : children);
        }
Example #5
0
        protected virtual void CompareChildren(ICanCompare from, bool suppressBreakingChanges)
        {
            ListOperations.CheckAlignment(from.Children, _children);

            for (int i = 0; i < from.Children.Count; i++)
            {
                ((RootDetail)_children[i]).PerformCompareInternal((ICanCompare)from.Children[i], suppressBreakingChanges || this.SuppressBreakingChangesInChildren);
            }
        }
Example #6
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            change |= CompareVisibility(previous, suppressBreakingChanges);
            change |= CompareDeclaration(previous, suppressBreakingChanges);

            return(change);
        }
Example #7
0
        protected ChangeType PerformCompareInternal(ICanCompare from, bool suppressBreakingChanges)
        {
            if (from == null)
            {
                throw new ArgumentNullException("from");
            }

            if (from.Status == Status.Missing && _status == Status.Missing)
            {
                _changeThisInstance = ChangeType.None;
            }
            else if (from.Status == Status.Missing)
            {
                _changeThisInstance = ChangeType.Added;

                ForceChangeToAllDescendants();
            }
            else if (_status == Status.Missing)
            {
                if (suppressBreakingChanges || (((RootDetail)from).SuppressBreakingChangesInChildren))
                {
                    _changeThisInstance = ChangeType.RemovedNonBreaking;
                }
                else
                {
                    Visibility visibility = VisibilityUtil.GetMostVisible(from);

                    if (visibility == Visibility.Public)
                    {
                        _changeThisInstance = ChangeType.RemovedBreaking;
                    }
                    else
                    {
                        _changeThisInstance = ChangeType.RemovedNonBreaking;
                    }
                }

                ForceChangeToAllDescendants();
            }
            else
            {
                if (from.GetType() != GetType())
                {
                    throw new InvalidOperationException("Cannot calculate changes between different types");
                }

                if (string.Compare(from.AlignmentIdentifier, this.AlignmentIdentifier) != 0)
                {
                    throw new InvalidOperationException("Cannot calculate changes between objects with different identifiers. The identifier correlates the same objects in different lists.");
                }

                _changeThisInstance = CompareInstance(from, suppressBreakingChanges);
            }

            return(_changeThisInstance);
        }
Example #8
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            ResourceDetail other = (ResourceDetail)previous;

            if (string.Compare(_contentHash, other._contentHash) != 0)
            {
                change |= ChangeType.ContentChanged;
            }

            return change;
        }
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            ReferenceDetail other = (ReferenceDetail)previous;

            if (string.Compare(_assemblyName, other._assemblyName) != 0)
            {
                change |= ChangeType.ValueChangedNonBreaking;
            }

            return(change);
        }
Example #10
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            MethodDetail other = (MethodDetail)previous;

            if (string.Compare(_body, other._body) != 0)
            {
                change |= ChangeType.ImplementationChanged;
            }

            return(change);
        }
Example #11
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            TraitDetail other = (TraitDetail)previous;

            if (string.Compare(_value, other._value) != 0)
            {
                change |= ChangeType.ValueChangedNonBreaking;
            }

            return(change);
        }
Example #12
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            TraitDetail other = (TraitDetail)previous;

            if (string.Compare(_value, other._value) != 0)
            {
                change |= ChangeType.ValueChangedNonBreaking;
            }

            return change;
        }
Example #13
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            ResourceDetail other = (ResourceDetail)previous;

            if (string.Compare(_contentHash, other._contentHash) != 0)
            {
                change |= ChangeType.ContentChanged;
            }

            return(change);
        }
Example #14
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            ReferenceDetail other = (ReferenceDetail)previous;

            if (string.Compare(_assemblyName, other._assemblyName) != 0)
            {
                change |= ChangeType.ValueChangedNonBreaking;
            }

            return change;
        }
Example #15
0
		protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
		{
			ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

			StubDetail other = (StubDetail)previous;

			change |= VisibilityUtil.GetVisibilityChange(other._visibility, _visibility, suppressBreakingChanges);

			if (_content != other._content)
			{
				change |= ChangeType.ContentChanged;
			}

			return change;
		}
Example #16
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            StubDetail other = (StubDetail)previous;

            change |= VisibilityUtil.GetVisibilityChange(other._visibility, _visibility, suppressBreakingChanges);

            if (_content != other._content)
            {
                change |= ChangeType.ContentChanged;
            }

            return(change);
        }
Example #17
0
        protected virtual ChangeType CompareDeclaration(ICanCompare previous, bool suppressBreakingChanges)
        {
            MemberDetail other = (MemberDetail)previous;

            if (string.Compare(_declaration, other._declaration) != 0)
            {
                if ((!suppressBreakingChanges) && (_visibility == Visibility.Public && other._visibility == Visibility.Public))
                {
                    return(ChangeType.DeclarationChangedBreaking);
                }
                else
                {
                    return(ChangeType.DeclarationChangedNonBreaking);
                }
            }

            return(ChangeType.None);
        }
Example #18
0
        private static ICanCompare FindInAssembly(AssemblyComparison ac, params string[] names)
        {
            ICanCompare current = ac.Groups[0].Assemblies[1];

            for (int i = 0; i < names.Length; i++)
            {
                ICanCompare child = (ICanCompare)FindChildByName(current, names[i]);

                if ((i < names.Length - 1) && (child == null))
                {
                    Assert.Inconclusive("Did not find child named {0} in {1}.", names[i], current.Name);
                }

                current = child;
            }

            return(current);
        }
Example #19
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = ChangeType.None;

            EnumItemDetail other = (EnumItemDetail)previous;

            if (_value != other._value)
            {
                if ((!suppressBreakingChanges) && (_visibility == Visibility.Public && other._visibility == Visibility.Public))
                {
                    change |= ChangeType.ValueChangedBreaking;
                }
                else
                {
                    change |= ChangeType.ValueChangedNonBreaking;
                }
            }

            return(change);
        }
Example #20
0
        private void diffViewer1_SelectedDetailItemChanged(object sender, EventArgs e)
        {
            ICanCompare item = diffViewer1.SelectedItem;

            if (item != null)
            {
                changeInfoDetail1.LoadFromItem(item, diffViewer1.SelectedColumnIndex == 0);
                return;
            }

            AssemblyGroup grp = diffViewer1.SelectedGroupItem;

            if (grp != null)
            {
                changeInfoDetail1.LoadFrom(grp);
                return;
            }

            changeInfoDetail1.Clear();
        }
Example #21
0
        internal void LoadFromItem(ICanCompare item, bool showAllDeclarations)
        {
            if (item == null)
            {
                LoadHtml("");
                return;
            }

            if (!(item is RootDetail))
            {
                LoadHtml(item.ToString());
                return;
            }

            StringBuilder sb = new StringBuilder();
            using (StringWriter sw = new StringWriter(sb))
            {
                HtmlUtility.WriteHtmlStart(sw);
                ((RootDetail)item).WriteHtmlDescription(sw, showAllDeclarations, false);
                HtmlUtility.WriteHtmlEnd(sw);
            }

            LoadHtml(sb.ToString());
        }
Example #22
0
        public IEnumerable GetChildren(TreePath treePath)
        {
            if (treePath.IsEmpty())
            {
                //yield return new AssemblyGroupTreeItem(_grp);

                if (_grp.Assemblies.Count > 0)
                {
                    foreach (RootDetail child in _grp.Assemblies[0].FilterChildrenInAll <RootDetail>())
                    {
                        yield return(new DetailTreeItem(child));
                    }
                }
            }
            else if (treePath.LastNode is AssemblyGroupTreeItem)
            {
                AssemblyGroup grp = ((AssemblyGroupTreeItem)treePath.LastNode).Group;

                if (grp.Assemblies.Count > 0)
                {
                    foreach (RootDetail child in grp.Assemblies[0].FilterChildrenInAll <RootDetail>())
                    {
                        yield return(new DetailTreeItem(child));
                    }
                }
            }
            else if (treePath.LastNode is DetailTreeItem)
            {
                ICanCompare item = ((DetailTreeItem)treePath.LastNode).Item;

                foreach (RootDetail child in item.FilterChildrenInAll <RootDetail>())
                {
                    yield return(new DetailTreeItem(child));
                }
            }
        }
Example #23
0
        protected virtual ChangeType CompareObsoleteStatus(ICanCompare previous, bool suppressBreakingChanges)
        {
            MemberDetail other = (MemberDetail)previous;

            return(ObsoleteUtil.GetObsoleteChange(other._obsoleteAttribute, _obsoleteAttribute, suppressBreakingChanges));
        }
Example #24
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            MethodDetail other = (MethodDetail)previous;

            if (string.Compare(_body, other._body) != 0)
            {
                change |= ChangeType.ImplementationChanged;
            }

            return change;
        }
Example #25
0
        protected virtual ChangeType CompareInstance(ICanCompare from, bool suppressBreakingChanges)
        {
            CompareChildren(from, suppressBreakingChanges);

            return(ChangeType.None);
        }
Example #26
0
        protected virtual ChangeType CompareVisibility(ICanCompare previous, bool suppressBreakingChanges)
        {
            MemberDetail other = (MemberDetail)previous;

            return(VisibilityUtil.GetVisibilityChange(other._visibility, _visibility, suppressBreakingChanges));
        }
Example #27
0
        protected virtual ChangeType CompareDeclaration(ICanCompare previous, bool suppressBreakingChanges)
        {
            MemberDetail other = (MemberDetail)previous;

            if (string.Compare(_declaration, other._declaration) != 0)
            {
                if ((!suppressBreakingChanges) && (_visibility == Visibility.Public && other._visibility == Visibility.Public))
                {
                    return ChangeType.DeclarationChangedBreaking;
                }
                else
                {
                    return ChangeType.DeclarationChangedNonBreaking;
                }
            }

            return ChangeType.None;
        }
Example #28
0
		public DetailTreeItem(ICanCompare item)
			: base(IconMap.GetIconForItem(item))
		{
			_item = item;
		}
Example #29
0
        protected override ChangeType CompareInstance(ICanCompare previous, bool suppressBreakingChanges)
        {
            ChangeType change = base.CompareInstance(previous, suppressBreakingChanges);

            change |= CompareVisibility(previous, suppressBreakingChanges);
            change |= CompareDeclaration(previous, suppressBreakingChanges);

            return change;
        }
Example #30
0
        protected virtual ChangeType CompareVisibility(ICanCompare previous, bool suppressBreakingChanges)
        {
            MemberDetail other = (MemberDetail)previous;

            return VisibilityUtil.GetVisibilityChange(other._visibility, _visibility, suppressBreakingChanges);
        }
 public DetailTreeItem(ICanCompare item)
     : base(IconMap.GetIconForItem(item))
 {
     _item = item;
 }