예제 #1
0
        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);
            }
        }
예제 #2
0
        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);
            }
        }