コード例 #1
0
        public static TypeNode Create(NamespaceNode parent, IOldToNewTupleMap <TypeMetadata> map)
        {
            var oldTypeMetadata = map.OldType;
            var newTypeMetadata = map.NewType;

            IDecompilationResults oldResult = null;
            IDecompilationResults newResult = null;

            IDecompilationResults result;

            if (oldTypeMetadata != null &&
                GlobalDecompilationResultsRepository.Instance.TryGetDecompilationResult(
                    oldTypeMetadata.AssemblyPath,
                    oldTypeMetadata.Module.TokenId,
                    oldTypeMetadata.TokenId,
                    out result))
            {
                oldResult = result;
            }

            if (newTypeMetadata != null &&
                GlobalDecompilationResultsRepository.Instance.TryGetDecompilationResult(
                    newTypeMetadata.AssemblyPath,
                    newTypeMetadata.Module.TokenId,
                    newTypeMetadata.TokenId,
                    out result))
            {
                newResult = result;
            }

            var typeNode = new TypeNode(parent, map, new MemberNodeBase[0], oldResult, newResult);

            var memberManager = new MemberMergeManager(map);
            var members       = memberManager.GetMergedCollection().Select <IOldToNewTupleMap <MemberDefinitionMetadataBase>, MemberNodeBase> (
                e =>
            {
                if (e.GetFirstNotNullItem().MemberType == MemberType.Type)
                {
                    return(NestedTypeNode.Create(
                               typeNode,
                               new OldToNewTupleMap <TypeMetadata> ((TypeMetadata)e.OldType, (TypeMetadata)e.NewType)));
                }
                return(new MemberNode(
                           typeNode,
                           new OldToNewTupleMap <MemberMetadata> ((MemberMetadata)e.OldType, (MemberMetadata)e.NewType)));
            }).ToArray();

            typeNode.Members = members;


            return(typeNode);
        }
コード例 #2
0
        public static NestedTypeNode Create(TypeNode parent, IOldToNewTupleMap <TypeMetadata> map)
        {
            var nestedTypeNode = new NestedTypeNode(parent, map, new MemberNodeBase[0]);

            var memberManager = new MemberMergeManager(map);
            var members       = memberManager.GetMergedCollection().Select <IOldToNewTupleMap <MemberDefinitionMetadataBase>, MemberNodeBase> (
                e =>
            {
                if (e.GetFirstNotNullItem().MemberType == MemberType.Type)
                {
                    return(Create(
                               parent,
                               new OldToNewTupleMap <TypeMetadata> ((TypeMetadata)e.OldType, (TypeMetadata)e.NewType)));
                }
                return(new MemberNode(
                           nestedTypeNode,
                           new OldToNewTupleMap <MemberMetadata> ((MemberMetadata)e.OldType, (MemberMetadata)e.NewType)));
            }).ToArray();

            nestedTypeNode.Members = members;

            return(nestedTypeNode);
        }
コード例 #3
0
        protected override void LoadChildren()
        {
            LoadAPIItemsContext context = this.apiDiffInfo.GenerateLoadAPIItemsContext();

            var memberManager = new MemberMergeManager(TypesMap);
            ObservableCollection <ItemNodeBase> collection = new ObservableCollection <ItemNodeBase>(memberManager
                                                                                                     .GetMergedCollection()
                                                                                                     .Where(ApiOnlyFilter)
                                                                                                     .Select(tuple => GetItemNodeFromMemberType(tuple, context)));

            context.Validate();

            DispatcherObjectExt.BeginInvoke(() =>
            {
                foreach (var item in collection)
                {
                    this.Children.Add(item);
                }
                this.OnChildrenLoaded();
            }, DispatcherPriority.Background);
        }