public override bool Equals(XElement source, XElement target, ApiChanges changes) { RenderAttributes(source, target, changes); // We don't want to compare attributes. RemoveAttributes(source); RemoveAttributes(target); return(base.Equals(source, target, changes)); }
public override void Modified(XElement source, XElement target, ApiChanges diff) { // hack - there could be changes that we're not monitoring (e.g. attributes properties) var output = Output; State.Output = new StringWriter(); var sb = source.GetAttribute("base"); var tb = target.GetAttribute("base"); var rm = $"{State.Namespace}.{State.Type}: Modified base type: '{sb}' to '{tb}'"; State.LogDebugMessage($"Possible -r value: {rm}"); if (sb != tb && !State.IgnoreRemoved.Any(re => re.IsMatch(rm)) && !(State.IgnoreNonbreaking && IsBaseChangeCompatible(sb, tb))) { Formatter.BeginMemberModification(Output, "Modified base type"); var apichange = new ApiChange($"{State.Namespace}.{State.Type}", State).AppendModified(sb, tb, true); Formatter.Diff(Output, apichange); Formatter.EndMemberModification(Output); } ccomparer.Compare(source, target); icomparer.Compare(source, target); fcomparer.Compare(source, target); pcomparer.Compare(source, target); ecomparer.Compare(source, target); mcomparer.Compare(source, target); var si = source.Element("classes"); if (si != null) { var ti = target.Element("classes"); kcomparer = new NestedClassComparer(State); State.Parent = State.Type; kcomparer.Compare(si.Elements("class"), ti == null ? null : ti.Elements("class")); State.Type = State.Parent; } var s = (Output as StringWriter).ToString(); State.Output = output; if (s.Length > 0) { SetContext(target); Formatter.BeginTypeModification(Output); Output.WriteLine(s); Formatter.EndTypeModification(Output); } }
public override void Modified(XElement source, XElement target, ApiChanges diff) { SourceAssembly = source.GetAttribute("name"); TargetAssembly = target.GetAttribute("name"); var sb = source.GetAttribute("version"); var tb = target.GetAttribute("version"); if (sb != tb) { Output.WriteLine("<h4>Assembly Version Changed: {0} vs {1}</h4>", tb, sb); } // ? custom attributes ? comparer.Compare(source, target); }
public override void Modified(XElement source, XElement target, ApiChanges differences) { var output = Output; State.Output = new StringWriter(); comparer.Compare(source, target); var s = Output.ToString(); State.Output = output; if (s.Length > 0) { var name = target.Attribute("name").Value; Formatter.BeginNamespace(Output); Output.WriteLine(s); Formatter.EndNamespace(Output); } }
public override bool Equals(XElement source, XElement target, ApiChanges changes) { if (base.Equals(source, target, changes)) { return(true); } XElement srcGetter, srcSetter; XElement tgtGetter, tgtSetter; GetAccessors(source, out srcGetter, out srcSetter); GetAccessors(target, out tgtGetter, out tgtSetter); List <XElement> srcIndexers = null; List <XElement> tgtIndexers = null; bool isIndexer = false; if (srcGetter != null) { srcIndexers = srcGetter.DescendantList("parameters", "parameter"); tgtIndexers = tgtGetter.DescendantList("parameters", "parameter"); isIndexer = srcIndexers != null && srcIndexers.Count > 0; } var change = new ApiChange(GetDescription(source), State); change.Header = "Modified " + GroupName; RenderMethodAttributes(GetMethodAttributes(srcGetter, srcSetter), GetMethodAttributes(tgtGetter, tgtSetter), change); RenderPropertyType(source, target, change); if (isIndexer) { RenderIndexers(srcIndexers, tgtIndexers, change); } else { RenderName(source, target, change); } RenderGenericParameters(source, target, change); RenderAccessors(srcGetter, tgtGetter, srcSetter, tgtSetter, change); changes.Add(source, target, change); return(false); }
void Modify(ApiChanges modified) { foreach (var changes in modified) { if (State.IgnoreNonbreaking && changes.Value.All(c => !c.Breaking)) { continue; } Formatter.BeginMemberModification(Output, changes.Key); foreach (var element in changes.Value) { if (State.IgnoreNonbreaking && !element.Breaking) { continue; } Formatter.Diff(Output, element); } Formatter.EndMemberModification(Output); } }
public override bool Equals(XElement source, XElement target, ApiChanges changes) { if (base.Equals(source, target, changes)) { return(true); } var change = new ApiChange(GetDescription(source), State); change.Header = "Modified " + GroupName; RenderMethodAttributes(source, target, change); RenderReturnType(source, target, change); RenderName(source, target, change); RenderGenericParameters(source, target, change); RenderParameters(source, target, change); changes.Add(source, target, change); return(false); }
public override void Modified(XElement source, XElement target, ApiChanges change) { }
public override bool Equals(XElement source, XElement target, ApiChanges changes) { if (base.Equals(source, target, changes)) { return(true); } var name = source.GetAttribute("name"); var srcValue = source.GetAttribute("value"); var tgtValue = target.GetAttribute("value"); var change = new ApiChange(GetDescription(source), State); change.Header = "Modified " + GroupName; if (State.BaseType == "System.Enum") { change.Append(name).Append(" = "); if (srcValue != tgtValue) { change.AppendModified(srcValue, tgtValue, true); } else { change.Append(srcValue); } } else { RenderFieldAttributes(source.GetFieldAttributes(), target.GetFieldAttributes(), change); var srcType = source.GetTypeName("fieldtype", State); var tgtType = target.GetTypeName("fieldtype", State); if (srcType != tgtType) { change.AppendModified(srcType, tgtType, true); } else { change.Append(srcType); } change.Append(" "); change.Append(name); if (srcType == "string" && srcValue != null) { srcValue = "\"" + srcValue + "\""; } if (tgtType == "string" && tgtValue != null) { tgtValue = "\"" + tgtValue + "\""; } if (srcValue != tgtValue) { change.Append(" = "); if (srcValue == null) { srcValue = "null"; } if (tgtValue == null) { tgtValue = "null"; } change.AppendModified(srcValue, tgtValue, true); } else if (srcValue != null) { change.Append(" = "); change.Append(srcValue); } change.Append(";"); } changes.Add(source, target, change); return(false); }
public virtual bool Equals(XElement source, XElement target, ApiChanges changes) { return(XNode.DeepEquals(source, target)); }
public abstract void Modified(XElement source, XElement target, ApiChanges changes);
public Comparer(State state) { State = state; removed = new List <XElement> (); modified = new ApiChanges(state); }