Exemplo n.º 1
0
        private void GetTypeData(Object target, ref BindingFlags flags)
        {
            if (_typeDataDictionary == null)
            {
                return;
            }

            var type = target.GetType();
            var data = _typeDataDictionary.GetValue(type, flags);

            if (data == null)
            {
                data = TypeData.GetTypeData(type, flags);
            }

            for (var i = 0; i < data.members.Length; i++)
            {
                var member = data.members[i];

                if (!string.IsNullOrEmpty(this.returnTypeName))
                {
                    if (!member.returnTypeName.Equals(this.returnTypeName))
                    {
                        continue;
                    }
                }

                _targets.Add(target);
                _dataList.Add(data);
                _members.Add(member);
                _labels.Add(member.longLabel);
            }
        }
Exemplo n.º 2
0
        private void INTERNAL_UpdateData()
        {
            INTERNAL_ClearData();

            var memberFilters     = new[] { BindingFlags.Instance, BindingFlags.Static };
            var visibilityFilters = new[] { BindingFlags.Public, BindingFlags.NonPublic };
            var levelFilters      = new[] { BindingFlags.DeclaredOnly, BindingFlags.FlattenHierarchy };
            var filters           = new List <BindingFlags>();

            foreach (var mf in memberFilters)
            {
                foreach (var vf in visibilityFilters)
                {
                    foreach (var lf in levelFilters)
                    {
                        filters.Add(mf | vf | lf);
                    }
                }
            }

            var typesTemp = new List <Type>()
            {
                typeof(GameObject)
            };
            var namespaces = new List <string> {
                TypeExtension.UNITY_NAMESPACE
            };

            if (this.customNamespaces != null)
            {
                namespaces.AddRange(this.customNamespaces);
            }

            foreach (var nsp in namespaces)
            {
                var componentTypes = AppDomain.CurrentDomain.GetAssemblies()
                                     .SelectMany(a => a.GetTypes())
                                     .Where(t => IsValidType(t, nsp));

                typesTemp.AddRange(componentTypes);
            }

            var types = typesTemp.OrderBy(t => t.FullName);

            foreach (var type in types)
            {
                this.types.Add(string.Format("{0};{1}", type.Namespace, type.Name));

                foreach (var filter in filters)
                {
                    var key      = ComposeKey(type, filter);
                    var typeData = TypeData.GetTypeData(type, filter);

                    this.keys.Add(key);
                    this.values.Add(typeData);
                }
            }
        }