protected void RenderAttributes(XElement source, XElement target, ApiChanges changes) { var srcObsolete = source.GetObsoleteMessage(); var tgtObsolete = target.GetObsoleteMessage(); if (srcObsolete == tgtObsolete) { return; // nothing changed } if (srcObsolete == null) { if (tgtObsolete == null) { return; // neither is obsolete } var change = new ApiChange(GetDescription(source), State); change.Header = "Obsoleted " + GroupName; Formatter.RenderObsoleteMessage(change.Member, this, GetDescription(target), tgtObsolete); change.AnyChange = true; changes.Add(source, target, change); } else if (tgtObsolete == null) { // Made non-obsolete. Do we care to report this? } else { // Obsolete message changed. Do we care to report this? } }
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); }
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 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); }