コード例 #1
0
        public ResourceManagerTypeTreeV09()
        {
            this.name = "Base";
            this.type = "ResourceManager";
            var map = new TypeTree();

            map.name = "m_Container";
            map.type = "map";

            var array = new TypeTree();

            array.name = "Array";
            array.type = "Array";

            var arraySize = new TypeTree();

            arraySize.name = "size";
            arraySize.type = "int";
            array.AddChild(arraySize);

            var arrayData = new TypeTree();

            arrayData.name = "data";
            arrayData.type = "pair";

            var arrayDataPairKey = new TypeTree();

            arrayDataPairKey.name = "path";
            arrayDataPairKey.type = "string";

            arrayData.AddChild(arrayDataPairKey);

            var arrayDataPairValue = new TypeTree();

            arrayDataPairValue.name = "asset";
            arrayDataPairValue.type = "PPtr<Object>";

            var objectFileIdentInType = new TypeTree();

            objectFileIdentInType.name = "m_FileID";
            objectFileIdentInType.type = "int";

            arrayDataPairValue.AddChild(objectFileIdentInType);

            var objectUnkowFiled = new TypeTree();

            objectUnkowFiled.name = "m_PathID";
            objectUnkowFiled.type = "int";

            arrayDataPairValue.AddChild(objectUnkowFiled);
            arrayData.AddChild(arrayDataPairValue);

            array.AddChild(arrayData);
            map.AddChild(array);

            AddChild(map);
        }
コード例 #2
0
        public ResourceManagerTypeTreeV09()
        {
            this.name = "Base";
            this.type = "ResourceManager";
            var map = new TypeTree();
            map.name = "m_Container";
            map.type = "map";

            var array = new TypeTree();
            array.name = "Array";
            array.type = "Array";

            var arraySize = new TypeTree();
            arraySize.name = "size";
            arraySize.type = "int";
            array.AddChild(arraySize);

            var arrayData = new TypeTree();
            arrayData.name = "data";
            arrayData.type = "pair";

            var arrayDataPairKey = new TypeTree();
            arrayDataPairKey.name = "path";
            arrayDataPairKey.type = "string";

            arrayData.AddChild(arrayDataPairKey);

            var arrayDataPairValue = new TypeTree();
            arrayDataPairValue.name = "asset";
            arrayDataPairValue.type = "PPtr<Object>";

            var objectFileIdentInType = new TypeTree();
            objectFileIdentInType.name = "m_FileID";
            objectFileIdentInType.type = "int";

            arrayDataPairValue.AddChild(objectFileIdentInType);

            var objectUnkowFiled = new TypeTree();
            objectUnkowFiled.name = "m_PathID";
            objectUnkowFiled.type = "int";

            arrayDataPairValue.AddChild(objectUnkowFiled);
            arrayData.AddChild(arrayDataPairValue);

            array.AddChild(arrayData);
            map.AddChild(array);

            AddChild(map);
        }
コード例 #3
0
ファイル: Extension.cs プロジェクト: xhute/Kooboo
        public TypeTree TypeTree(ApiCall call)
        {
            var dlls = GlobalDb.Dlls.All().OrderBy(x => x.AssemblyName).ToList();
            var tree = new TypeTree();

            foreach (var dll in dlls)
            {
                var asmNode = new TypeTree();
                asmNode.Id       = "asm-" + dll.AssemblyName;
                asmNode.Name     = dll.AssemblyName;
                asmNode.Text     = dll.AssemblyName + " (" + dll.AssemblyVersion + ")";
                asmNode.Icon     = "fa fa-folder";
                asmNode.NodeType = NodeType.Assembly;

                var types = Assembly.Load(dll.Content).GetExportedTypes();

                CreateSubTree(types.ToList(), asmNode);

                tree.AddChild(asmNode);
            }

            return(tree);
        }
コード例 #4
0
ファイル: Extension.cs プロジェクト: xhute/Kooboo
        public static TypeTree CreateSubTree(List <Type> types, TypeTree root = null)
        {
            if (root == null)
            {
                root = new TypeTree();
            }

            foreach (var group in types.GroupBy(x => x.Namespace).OrderBy(x => x.Key))
            {
                var NameSpaceNode = new TypeTree
                {
                    Name     = group.Key,
                    Text     = group.Key,
                    Icon     = "fa fa-folder icon-state-warning",
                    NodeType = NodeType.NameSpace
                };

                foreach (var type in group.OrderBy(x => x.Name))
                {
                    // Ignore types do not have parameterless constructors
                    if (!type.GetConstructors().Any(x => x.GetParameters().Length == 0))
                    {
                        continue;
                    }

                    // Ignore special types
                    if (typeof(Attribute).IsAssignableFrom(type) ||
                        typeof(Exception).IsAssignableFrom(type))
                    {
                        continue;
                    }

                    var typeNode = new TypeTree
                    {
                        Id       = type.FullName,
                        Name     = AssemblyQualifiedNameWithoutVersion(type),
                        Text     = type.Name,
                        Icon     = "fa fa-file icon-state-warning",
                        NodeType = NodeType.Type
                    };

                    foreach (var method in Lib.Reflection.TypeHelper.GetPublicMethods(type).OrderBy(x => x.Name))
                    {
                        var parameters = method.GetParameters();
                        if (parameters.Any(p => p.IsIn || p.IsOut))
                        {
                            continue;
                        }

                        if (method.ReturnType == typeof(void))
                        {
                            continue;
                        }

                        var methodType = new TypeTree
                        {
                            Id           = TypeHelper.GetMethodSignatureHash(method).ToString(),
                            Name         = method.Name,
                            Text         = method.Name, // GetMethodDisplayName(method),
                            Icon         = "fa fa-flash icon-state-warning",
                            NodeType     = NodeType.Method,
                            TypeName     = type.Name,
                            TypeFullName = type.FullName,
                            TypeAssemblyQualifiedName = AssemblyQualifiedNameWithoutVersion(type)
                        };

                        typeNode.AddChild(methodType);
                    }

                    if (typeNode.Children.Count > 0)
                    {
                        NameSpaceNode.AddChild(typeNode);
                    }
                }

                if (NameSpaceNode.Children.Count > 0)
                {
                    root.AddChild(NameSpaceNode);
                }
            }
            return(root);
        }