コード例 #1
0
        protected override IDiffItem GenerateDiffItem(TypeDefinition oldElement, TypeDefinition newElement)
        {
            IEnumerable <IDiffItem> attributeDiffs = new CustomAttributeComparer().GetMultipleDifferences(oldElement.CustomAttributes, newElement.CustomAttributes);

            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll <IDiffItem>(
                    attributeDiffs,
                    CheckVisibility(oldElement, newElement)
                    );

            IEnumerable <IDiffItem> childrenDiffs =
                EnumerableExtensions.ConcatAll <IDiffItem>(
                    GetFieldDifferences(oldElement, newElement),
                    GetPropertyDifferences(oldElement, newElement),
                    GetMethodDifferences(oldElement, newElement),
                    GetEventDifferences(oldElement, newElement),
                    GetNestedTypeDiffs(oldElement, newElement)
                    );

            if (declarationDiffs.IsEmpty() && childrenDiffs.IsEmpty())
            {
                return(null);
            }
            return(new TypeDiffItem(oldElement, newElement, declarationDiffs, childrenDiffs.Cast <IMetadataDiffItem>()));
        }
コード例 #2
0
        public IMetadataDiffItem <AssemblyDefinition> Compare()
        {
            IEnumerable <IDiffItem> declarationDiffs = new CustomAttributeComparer().GetMultipleDifferences(oldAssembly.CustomAttributes, newAssembly.CustomAttributes);
            IEnumerable <IDiffItem> childrenDiffs    = new ModuleComparer().GetMultipleDifferences(oldAssembly.Modules, newAssembly.Modules);

            if (declarationDiffs.IsEmpty() && childrenDiffs.IsEmpty())
            {
                return(null);
            }
            return(new AssemblyDiffItem(oldAssembly, newAssembly, declarationDiffs, childrenDiffs.Cast <IMetadataDiffItem <ModuleDefinition> >()));
        }
コード例 #3
0
        protected override IDiffItem GenerateDiffItem(EventDefinition oldElement, EventDefinition newElement)
        {
            IEnumerable <IDiffItem> declarationDiffs = new CustomAttributeComparer().GetMultipleDifferences(oldElement.CustomAttributes, newElement.CustomAttributes);
            IEnumerable <IMetadataDiffItem <MethodDefinition> > childrenDiffs = GenerateAccessorDifferences(oldElement, newElement);

            if (declarationDiffs.IsEmpty() && childrenDiffs.IsEmpty())
            {
                return(null);
            }

            return(new EventDiffItem(oldElement, newElement, declarationDiffs, childrenDiffs));
        }
コード例 #4
0
        protected override IDiffItem GenerateDiffItem(FieldDefinition oldElement, FieldDefinition newElement)
        {
            IEnumerable <IDiffItem> attributeDiffs = new CustomAttributeComparer().GetMultipleDifferences(oldElement.CustomAttributes, newElement.CustomAttributes);
            IEnumerable <IDiffItem> fieldTypeDiffs = GetFieldTypeDiff(oldElement, newElement);

            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll(
                    attributeDiffs,
                    CheckVisibility(oldElement, newElement),
                    CheckStaticFlag(oldElement, newElement),
                    fieldTypeDiffs
                    );

            if (declarationDiffs.IsEmpty())
            {
                return(null);
            }
            return(new FieldDiffItem(oldElement, newElement, declarationDiffs));
        }
コード例 #5
0
        private IEnumerable <IDiffItem> GetDeclarationDiffsChecked(MethodDefinition oldMethod, MethodDefinition newMethod)
        {
            IEnumerable <IDiffItem> attributeDifferences     = new CustomAttributeComparer().GetMultipleDifferences(oldMethod.CustomAttributes, newMethod.CustomAttributes);
            IEnumerable <IDiffItem> reducedVisibilityDiff    = CheckVisibility(oldMethod, newMethod);
            IEnumerable <IDiffItem> virtualFlagDiff          = CheckVirtualFlag(oldMethod, newMethod);
            IEnumerable <IDiffItem> staticFlagDiff           = CheckStaticFlag(oldMethod, newMethod);
            IEnumerable <IDiffItem> returnTypeDiff           = GetReturnTypeDifference(oldMethod, newMethod);
            IEnumerable <IDiffItem> parameterNameDifferences = GetParameterNameDiffs(oldMethod, newMethod);

            IEnumerable <IDiffItem> declarationDiffs =
                EnumerableExtensions.ConcatAll(
                    attributeDifferences,
                    reducedVisibilityDiff,
                    virtualFlagDiff,
                    staticFlagDiff,
                    returnTypeDiff,
                    parameterNameDifferences
                    );

            return(declarationDiffs);
        }