예제 #1
0
        protected virtual void CollapseChildChange(ChangeType change)
        {
            if (!ChangeTypeUtil.IsAddRemove(_changeThisInstance))
            {
                if (((change & ChangeType.Added) != 0) || ((change & ChangeType.RemovedNonBreaking) != 0) || ((change & ChangeType.DeclarationChangedNonBreaking) != 0) || ((change & ChangeType.ValueChangedNonBreaking) != 0))
                {
                    _changeThisInstance |= ChangeType.DeclarationChangedNonBreaking;
                }

                if (((change & ChangeType.RemovedBreaking) != 0) || ((change & ChangeType.DeclarationChangedBreaking) != 0) || ((change & ChangeType.ValueChangedBreaking) != 0))
                {
                    _changeThisInstance |= ChangeType.DeclarationChangedBreaking;
                }

                if ((change & ChangeType.VisibilityChangedBreaking) != 0)
                {
                    _changeThisInstance |= ChangeType.VisibilityChangedBreaking;
                }

                if ((change & ChangeType.VisibilityChangedNonBreaking) != 0)
                {
                    if ((_changeThisInstance & ChangeType.VisibilityChangedBreaking) == 0)
                    {
                        _changeThisInstance |= ChangeType.VisibilityChangedNonBreaking;
                    }
                }

                if ((change & ChangeType.ImplementationChanged) != 0)
                {
                    _changeThisInstance |= ChangeType.ImplementationChanged;
                }
            }
        }
        public override string GetToolTip(TreeNodeAdv node)
        {
            AssemblyGroup grp = ((AssemblyGroupTreeItem)node.Tag).Group;

            string tip = "Assembly " + grp.Name;

            if (grp.HasErrors)
            {
                tip += " failed to load. Check log messages for detailed error information.";
            }
            else if (ChangeTypeUtil.HasBreaking(grp.Change))
            {
                tip += " has breaking changes.";
            }
            else if (ChangeTypeUtil.HasNonBreaking(grp.Change))
            {
                tip += " has non-breaking changes.";
            }
            else
            {
                tip += " has no changes.";
            }

            return(tip);
        }
예제 #3
0
        protected virtual void ProcessChildChange(Type childType, ChangeType change)
        {
            if (change != ChangeType.None)
            {
                if (childType == typeof(AttributeDetail))
                {
                    _changeAllChildren |= ChangeType.AttributesChanged;
                }
                else
                {
                    if (this.CollapseChildren)
                    {
                        CollapseChildChange(change);
                    }
                    else
                    {
                        if (ChangeTypeUtil.HasBreaking(change))
                        {
                            _changeAllChildren |= ChangeType.MembersChangedBreaking;
                        }

                        if (ChangeTypeUtil.HasNonBreaking(change))
                        {
                            _changeAllChildren |= ChangeType.MembersChangedNonBreaking;
                        }
                    }
                }
            }
        }
예제 #4
0
        public virtual string GetHtmlChangeDescription()
        {
            StringBuilder sb       = new StringBuilder();
            RootDetail    previous = (RootDetail)_navigateBackward;

            if (this.Change == ChangeType.None)
            {
                sb.Append("None");
            }

            if ((this.Change & ChangeType.Added) != 0)
            {
                AppendClauseHtml(sb, false, "Added");
            }

            if (((this.Change & ChangeType.RemovedBreaking) != 0) || ((this.Change & ChangeType.RemovedNonBreaking) != 0))
            {
                AppendClauseHtml(sb, ((this.Change & ChangeType.RemovedBreaking) != 0), "Removed");
            }

            if ((this.Change & ChangeType.AttributesChanged) != 0)
            {
                AppendClauseHtml(sb, false, "Attributes changed");
            }

            if ((this.Change & ChangeType.ImplementationChanged) != 0)
            {
                AppendClauseHtml(sb, false, "Implementation changed");
            }

            if ((this.Change & ChangeType.ContentChanged) != 0)
            {
                AppendClauseHtml(sb, ChangeTypeUtil.HasBreaking(this.Change), "Content changed");
            }

            if (((this.Change & ChangeType.ValueChangedBreaking) != 0) || ((this.Change & ChangeType.ValueChangedNonBreaking) != 0))
            {
                AppendClauseHtml(sb, ((this.Change & ChangeType.ValueChangedBreaking) != 0), "Value changed");
            }

            if (((this.Change & ChangeType.DeclarationChangedBreaking) != 0) || ((this.Change & ChangeType.DeclarationChangedNonBreaking) != 0))
            {
                AppendClauseHtml(sb, ((this.Change & ChangeType.DeclarationChangedBreaking) != 0), "Declaration changed");
            }

            if (((this.Change & ChangeType.VisibilityChangedBreaking) != 0) || ((this.Change & ChangeType.VisibilityChangedNonBreaking) != 0))
            {
                AppendClauseHtml(sb, ((this.Change & ChangeType.VisibilityChangedBreaking) != 0), GetVisibilityChangeText(previous));
            }

            if (((this.Change & ChangeType.MembersChangedBreaking) != 0) || ((this.Change & ChangeType.MembersChangedNonBreaking) != 0))
            {
                GetHtmlChangeDescriptionBriefMembers(sb);
            }

            return(sb.ToString());
        }
예제 #5
0
        public void WriteMarkdownDescription(TextWriter tw)
        {
            tw.WriteLine($"# {_name}");
            tw.WriteLine();

            if (_hasErrors)
            {
                tw.WriteLine("```");
                if (string.IsNullOrEmpty(_errorDetail))
                {
                    tw.WriteLine("Failed to load one or more versions of this assembly. Examine the log messages pane for detailed error information.");
                }
                else
                {
                    tw.WriteLine("Failed to load one or more versions of this assembly:");
                    tw.WriteLine(_errorDetail);
                }
                tw.WriteLine("```");
            }
            else
            {
                if (_change == ChangeType.None)
                {
                    if (_assemblies.Count == 1)
                    {
                        tw.WriteLine("Only one version of this assembly was found (nothing to compare to!)");
                        tw.WriteLine();
                    }
                    else
                    {
                        tw.WriteLine("No changes were found across all versions of this assembly.");
                        tw.WriteLine();
                    }
                }
                else if (ChangeTypeUtil.HasBreaking(_change))
                {
                    tw.WriteLine("**Breaking changes were found between versions of this assembly.**");
                    tw.WriteLine();
                }
                else if (ChangeTypeUtil.HasNonBreaking(_change))
                {
                    tw.WriteLine("Non-breaking changes were found between versions of this assembly.");
                    tw.WriteLine();
                }

                tw.WriteLine("The following files have been compared in this set:");
                tw.WriteLine();

                foreach (AssemblyDetail detail in _assemblies)
                {
                    tw.WriteLine($"* {MarkdownUtility.ToInlineCode(detail.Location)}");
                }

                tw.WriteLine();
            }
        }
예제 #6
0
        public void WriteHtmlDescription(TextWriter tw)
        {
            tw.Write("<p class='hdr1'>Assembly '");
            tw.Write(_name);
            tw.Write("'</p>");

            if (_hasErrors)
            {
                if (string.IsNullOrEmpty(_errorDetail))
                {
                    tw.Write("<p style='color:red'>Failed to load one or more versions of this assembly. Examine the log messages pane for detailed error information.</p>");
                }
                else
                {
                    tw.Write("<p style='color:red'>Failed to load one or more versions of this assembly: " + _errorDetail + "</p>");
                }
            }
            else
            {
                if (_change == ChangeType.None)
                {
                    if (_assemblies.Count == 1)
                    {
                        tw.Write("<p>Only one version of this assembly was found (nothing to compare to!)</p>");
                    }
                    else
                    {
                        tw.Write("<p>No changes were found across all versions of this assembly.</p>");
                    }
                }
                else if (ChangeTypeUtil.HasBreaking(_change))
                {
                    tw.Write("<p style='color:red'>Breaking changes were found between versions of this assembly.</p>");
                }
                else if (ChangeTypeUtil.HasNonBreaking(_change))
                {
                    tw.Write("<p>Non-breaking changes were found between versions of this assembly.</p>");
                }

                tw.Write("<p>The following files have been compared in this set:</p>");

                tw.Write("<ul>");

                foreach (AssemblyDetail detail in _assemblies)
                {
                    tw.Write("<li>");
                    tw.Write(detail.Location);
                    tw.Write("</li>");
                }

                tw.Write("</ul>");
            }
        }
예제 #7
0
        protected virtual void CalcInheritedChanges()
        {
            _changeAllChildren = ChangeType.None;

            if (ChangeTypeUtil.IsAddRemove(_changeThisInstance))
            {
                _changeAllChildren = _changeThisInstance;
                return;
            }

            foreach (var child in _children.Cast <RootDetail>())
            {
                child.CalcInheritedChanges();
                if (child.Change != ChangeType.None)
                {
                    ProcessChildChange(child, child.Change);
                }
            }
        }
예제 #8
0
        protected virtual void SerializeWriteContent(XmlWriter writer)
        {
            if (SerializeShouldWriteName())
            {
                writer.WriteAttributeString("Name", _name);
            }

            writer.WriteAttributeString("WhatChanged", SerializeGetWhatChangedName());

            bool breaking = ChangeTypeUtil.HasBreaking(this.Change);

            if (breaking)
            {
                writer.WriteAttributeString("Breaking", breaking.ToString());
            }

            RootDetail previous = (RootDetail)this.NavigateBackward;

            if (previous != null)
            {
                string from = null;
                string to   = SerializeGetWhatChangedValue(this.Change);

                if (this.Change != ChangeType.Added)
                {
                    from = previous.SerializeGetWhatChangedValue(this.Change);
                }

                if (string.Compare(from, to, false) != 0)
                {
                    if (from != null)
                    {
                        writer.WriteAttributeString("Previous", from);
                    }

                    if (to != null)
                    {
                        writer.WriteAttributeString("Current", to);
                    }
                }
            }
        }
예제 #9
0
        protected virtual void CalcInheritedChanges()
        {
            _changeAllChildren = ChangeType.None;

            if (ChangeTypeUtil.IsAddRemove(_changeThisInstance))
            {
                _changeAllChildren = _changeThisInstance;
                return;
            }

            foreach (RootDetail child in _children)
            {
                child.CalcInheritedChanges();
            }

            for (int i = 0; i < _children.Count; i++)
            {
                ProcessChildChange(_children[i].GetType(), ((ICanCompare)_children[i]).Change);
            }
        }
예제 #10
0
        private void WriteMarkdownTitle(TextWriter tw, bool appendAllDeclarations, ChangeType nestedChange)
        {
            RootDetail namedItem;

            if (appendAllDeclarations)
            {
                namedItem = FindItemWithStatusPresent();
            }
            else
            {
                namedItem = this;
            }

            string name;

            if (namedItem == null || namedItem.Status == Status.Missing)
            {
                name = Name;
            }
            else
            {
                name = namedItem.GetTextTitle();
            }

            string nestedChangeText = ChangeTypeUtil.GetSummaryText(nestedChange);

            tw.WriteLine("----");
            tw.WriteLine();

            tw.Write($"### {name}");
            if (nestedChangeText != null)
            {
                tw.Write($" *{nestedChangeText}*");
            }

            tw.WriteLine();
            tw.WriteLine();
        }
        private void DetailNodeControl_DrawText(object sender, DrawEventArgs e)
        {
            if (e.TextColor != SystemColors.ControlText)
            {
                return;
            }

            TreeItemBase tib    = ((TreeItemBase)e.Node.Tag);
            ChangeType   change = tib.GetItemAt(_assemblyIndex).Change;

            if (ChangeTypeUtil.HasBreaking(change))
            {
                e.TextColor = Color.Red;
            }
            else if (change == ChangeType.Added)
            {
                e.TextColor = Color.Green;
            }
            else if (tib.GetItemAt(0).GetStrongestFilterStatus() < FilterStatus.DontCare)
            {
                e.TextColor = Color.LightGray;
            }
        }
예제 #12
0
        public void PerformCompare(ComparisonFilter filter)
        {
            for (int i = 1; i < _assemblies.Count; i++)
            {
                _assemblies[i].PerformCompare(_assemblies[i - 1]);
                _assemblies[i].ApplyFilter(filter);
            }

            _change = ChangeType.None;

            foreach (AssemblyDetail ad in _assemblies)
            {
                if (ChangeTypeUtil.HasBreaking(ad.Change))
                {
                    _change = ChangeType.MembersChangedBreaking;
                    break;
                }
                else if (ChangeTypeUtil.HasNonBreaking(ad.Change))
                {
                    _change = ChangeType.MembersChangedNonBreaking;
                }
            }
        }
        private void AssemblyGroupNodeControl_DrawText(object sender, DrawEventArgs e)
        {
            if (e.TextColor != SystemColors.ControlText)
            {
                return;
            }

            AssemblyGroup grp = ((AssemblyGroupTreeItem)e.Node.Tag).Group;

            e.TextColor = Color.Gray;

            if (grp.HasErrors)
            {
                e.TextColor = Color.LightGray;
            }
            else if (ChangeTypeUtil.HasBreaking(grp.Change))
            {
                e.TextColor = Color.Red;
            }
            else if (ChangeTypeUtil.HasNonBreaking(grp.Change))
            {
                e.TextColor = Color.Black;
            }
        }
예제 #14
0
        protected virtual void ProcessChildChange(RootDetail child, ChangeType change)
        {
            if (change != ChangeType.None)
            {
                if (child is AttributeDetail attributeDetail)
                {
                    if (attributeDetail.AttributeType != AttributeType.CompilerGenerated)
                    {
                        _changeAllChildren |= ChangeType.AttributesChanged;
                        if (this.CollapseChildren)
                        {
                            _changeThisInstance |= ChangeType.AttributesChanged;
                        }
                    }
                }
                else
                {
                    if (this.CollapseChildren)
                    {
                        CollapseChildChange(change);
                    }
                    else
                    {
                        if (ChangeTypeUtil.HasBreaking(change))
                        {
                            _changeAllChildren |= ChangeType.MembersChangedBreaking;
                        }

                        if (ChangeTypeUtil.HasNonBreaking(change))
                        {
                            _changeAllChildren |= ChangeType.MembersChangedNonBreaking;
                        }
                    }
                }
            }
        }
예제 #15
0
        public virtual void WriteHtmlDescription(TextWriter tw, bool appendAllDeclarations, bool appendChildren)
        {
            ChangeType nestedChange = CalculateNestedChanges();

            string changeClass = ChangeTypeUtil.GetChangeClass(nestedChange);

            tw.Write("<div class='item");
            if (changeClass != null)
            {
                tw.Write(' ');
                tw.Write(changeClass);
            }
            tw.WriteLine("'>");
            if (!this.ExcludeFromReport)
            {
                FilterStatus filterThisInstance;

                if (appendAllDeclarations)
                {
                    filterThisInstance = GetStrongestFilterStatus();

                    if (this.CollapseChildren && filterThisInstance == FilterStatus.ExcludedButIncludeForChildren)
                    {
                        filterThisInstance = FilterStatus.Include;
                    }
                }
                else
                {
                    filterThisInstance = FilterStatus.Include;
                }

                if ((!appendChildren) || (filterThisInstance >= FilterStatus.DontCare))
                {
                    string nestedChangeText = ChangeTypeUtil.GetSummaryText(nestedChange);
                    tw.Write("<h2>");
                    if (nestedChangeText != null)
                    {
                        tw.Write("<span class='item-change'>");
                        tw.Write(HtmlUtility.HtmlEncode(nestedChangeText));
                        tw.Write("</span>");
                    }


                    RootDetail namedItem;
                    if (appendAllDeclarations)
                    {
                        namedItem = FindItemWithStatusPresent();
                    }
                    else
                    {
                        namedItem = this;
                    }

                    tw.Write("<span class='name'>");
                    if ((namedItem == null) || (namedItem.Status == Status.Missing))
                    {
                        tw.Write(this.Name);
                    }
                    else
                    {
                        tw.Write(HtmlUtility.HtmlEncode(namedItem.GetTextTitle()));
                    }
                    tw.Write("</span>");

                    tw.Write("</h2>");

                    tw.Write("<div class='item-body'>");

                    RootDetail eachItem = this;
                    while (eachItem != null)
                    {
                        tw.Write("<div class='item-entry'>");
                        eachItem.WriteHtmlDeclaration(tw);
                        eachItem.WriteHtmlSummaryForChange(tw);
                        tw.Write("</div>");

                        eachItem = appendAllDeclarations ? (RootDetail)eachItem.NavigateForward : null;
                    }

                    tw.WriteLine("</div>");
                }
            }

            if (appendChildren && !this.ExcludeChildrenFromReport)
            {
                foreach (RootDetail child in FilterChildrenInAll <RootDetail>())
                {
                    //                  if ((child.FullNameRoot) || (child.GetStrongestFilterStatus() != FilterStatus.ExcludedButIncludeForChildren)) // Dont include public stuff inside internal classes for -publiconly
                    {
                        child.WriteHtmlDescription(tw, appendAllDeclarations, appendChildren);
                    }
                }
            }

            tw.WriteLine("</div>");
        }
예제 #16
0
        public virtual void WriteHtmlDescription(TextWriter tw, bool appendAllDeclarations, bool appendChildren)
        {
            if (!this.ExcludeFromReport)
            {
                FilterStatus filterThisInstance;

                if (appendAllDeclarations)
                {
                    filterThisInstance = GetStrongestFilterStatus();

                    if (this.CollapseChildren && filterThisInstance == FilterStatus.ExcludedButIncludeForChildren)
                    {
                        filterThisInstance = FilterStatus.Include;
                    }
                }
                else
                {
                    filterThisInstance = FilterStatus.Include;
                }

                if ((!appendChildren) || (filterThisInstance >= FilterStatus.DontCare))
                {
                    tw.Write("<p class='hdr'>");

                    RootDetail namedItem;
                    if (appendAllDeclarations)
                    {
                        namedItem = FindItemWithStatusPresent();
                    }
                    else
                    {
                        namedItem = this;
                    }

                    if ((namedItem == null) || (namedItem.Status == Status.Missing))
                    {
                        tw.Write(this.Name);
                    }
                    else
                    {
                        tw.Write(HtmlUtility.HtmlEncode(namedItem.GetTextTitle()));
                    }

                    tw.Write("</p>");

                    RootDetail eachItem = this;
                    while (eachItem != null)
                    {
                        eachItem.WriteHtmlDeclaration(tw);
                        eachItem.WriteHtmlSummaryForChange(tw);

                        eachItem = appendAllDeclarations ? (RootDetail)eachItem.NavigateForward : null;
                    }
                }
            }

            if (appendChildren && !this.CollapseChildren && !ChangeTypeUtil.IsAddRemove(CombineAllChangesThisInstanceGoingForward()))
            {
                foreach (RootDetail child in FilterChildrenInAll <RootDetail>())
                {
//					if ((child.FullNameRoot) || (child.GetStrongestFilterStatus() != FilterStatus.ExcludedButIncludeForChildren)) // Dont include public stuff inside internal classes for -publiconly
                    {
                        child.WriteHtmlDescription(tw, appendAllDeclarations, appendChildren);
                    }
                }
            }
        }