Beispiel #1
0
        private static void BuildCache()
        {
            portDataCache = new PortDataCache();
            System.Type        baseType  = typeof(Node);
            List <System.Type> nodeTypes = new List <System.Type>();

            System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
            Assembly selfAssembly = Assembly.GetAssembly(baseType);

            if (selfAssembly.FullName.StartsWith("Assembly-CSharp"))
            {
                // If xNode is not used as a DLL, check only CSharp (fast)
                nodeTypes.AddRange(selfAssembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t)));
            }
            else
            {
                // Else, check all DDLs (slow)
                foreach (Assembly assembly in assemblies)
                {
                    nodeTypes.AddRange(assembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t)).ToArray());
                }
            }
            for (int i = 0; i < nodeTypes.Count; i++)
            {
                CachePorts(nodeTypes[i]);
            }
        }
Beispiel #2
0
        private static void BuildCache()
        {
            portDataCache = new PortDataCache();
            System.Type baseType = typeof(Node);
            List<System.Type> nodeTypes = new List<System.Type>();
            System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();
            Assembly selfAssembly = Assembly.GetAssembly(baseType);
            if ( selfAssembly.FullName.StartsWith( "Assembly-CSharp" ) && !selfAssembly.FullName.Contains( "-firstpass" ) )
            {
                // If xNode is not used as a DLL, check only CSharp (fast)
                nodeTypes.AddRange( selfAssembly.GetTypes().Where( t => !t.IsAbstract && baseType.IsAssignableFrom( t ) ) );
            }
            else
            {
                // Else, check all relevant DDLs (slower) ignore all unity related assemblies
                foreach ( Assembly assembly in assemblies )
                {
                    if ( assembly.FullName.StartsWith( "Unity" ) )
                    {
                        continue;
                    }
                    // unity created assemblies always have version 0.0.0
                    if ( !assembly.FullName.Contains( "Version=0.0.0" ) )
                    {
                        continue;
                    }

                    nodeTypes.AddRange( assembly.GetTypes().Where( t => !t.IsAbstract && baseType.IsAssignableFrom( t ) ).ToArray() );
                }
            }
            for ( int i = 0; i < nodeTypes.Count; i++ )
            {
                CachePorts( nodeTypes[i] );
            }
        }
Beispiel #3
0
        private static void BuildCache()
        {
            _portDataCache = new PortDataCache();
            List <Type> nodeTypes = ChildrenTypeCache.GetChildrenTypes <NodeData>();

            foreach (var nodeType in nodeTypes)
            {
                CachePorts(nodeType);
            }
        }
Beispiel #4
0
        private static void BuildCache()
        {
            portDataCache = new PortDataCache();
            System.Type baseType = typeof(Node);
            Assembly    assembly = Assembly.GetAssembly(baseType);

            System.Type[] nodeTypes = assembly.GetTypes().Where(t =>
                                                                !t.IsAbstract &&
                                                                baseType.IsAssignableFrom(t)
                                                                ).ToArray();

            for (int i = 0; i < nodeTypes.Length; i++)
            {
                CachePorts(nodeTypes[i]);
            }
        }
Beispiel #5
0
        /// <summary> Cache node types </summary>
        private static void BuildCache()
        {
            portDataCache = new PortDataCache();
            System.Type        baseType  = typeof(Node);
            List <System.Type> nodeTypes = new List <System.Type>();

            System.Reflection.Assembly[] assemblies = System.AppDomain.CurrentDomain.GetAssemblies();

            // Loop through assemblies and add node types to list
            foreach (Assembly assembly in assemblies)
            {
                // Skip certain dlls to improve performance
                string assemblyName = assembly.GetName().Name;
                int    index        = assemblyName.IndexOf('.');
                if (index != -1)
                {
                    assemblyName = assemblyName.Substring(0, index);
                }
                switch (assemblyName)
                {
                // The following assemblies, and sub-assemblies (eg. UnityEngine.UI) are skipped
                case "UnityEditor":
                case "UnityEngine":
                case "System":
                case "mscorlib":
                case "Microsoft":
                    continue;

                default:
                    try
                    {
                        nodeTypes.AddRange(assembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t)).ToArray());
                    }
                    catch (System.Exception ex)
                    {
                        Debug.LogError("Catched exception when building " + assemblyName + " caches");
                        Debug.LogException(ex);
                    }
                    break;
                }
            }

            for (int i = 0; i < nodeTypes.Count; i++)
            {
                CachePorts(nodeTypes[i]);
            }
        }
Beispiel #6
0
        /// <summary> Cache node types </summary>
        private static void BuildCache()
        {
            portDataCache = new PortDataCache();

            var baseType   = typeof(Node);
            var nodeTypes  = new List <System.Type>();
            var assemblies = System.AppDomain.CurrentDomain.GetAssemblies();

            // Loop through assemblies and add node types to list
            foreach (var assembly in assemblies)
            {
                // Skip certain dlls to improve performance
                var assemblyName = assembly.GetName().Name;
                var index        = assemblyName.IndexOf('.');

                if (index != -1)
                {
                    assemblyName = assemblyName.Substring(0, index);
                }

                switch (assemblyName)
                {
                // The following assemblies, and sub-assemblies (eg. UnityEngine.UI) are skipped
                case "UnityEditor":
                case "UnityEngine":
                case "System":
                case "mscorlib":
                case "Microsoft":
                    continue;

                default:
                    nodeTypes.AddRange(assembly.GetTypes().Where(t => !t.IsAbstract && baseType.IsAssignableFrom(t))
                                       .ToArray());
                    break;
                }
            }

            for (var i = 0; i < nodeTypes.Count; i++)
            {
                CachePorts(nodeTypes[i]);
            }
        }