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;
                        }
                    }
                }
            }
        }
        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);
        }
        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());
        }
示例#4
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();
            }
        }
示例#5
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>");
            }
        }
示例#6
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);
                    }
                }
            }
        }
        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;
            }
        }
示例#8
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;
            }
        }
示例#10
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;
                        }
                    }
                }
            }
        }