Пример #1
0
 public override void Deserialize()
 {
     this.member = BloxMemberInfo.DecodeMember(this.memberStoredData);
     if (this.sourceObjType == DataSourceOject.Instance)
     {
         this.instanceMember = BloxMemberInfo.DecodeMember(this.sourceObjData);
     }
 }
Пример #2
0
 public void Deserialize()
 {
     if (this.dataContext == DataContext.Constant)
     {
         this.constant.Deserialize();
     }
     else if (this.dataContext == DataContext.GlobalProperty)
     {
         this.member   = BloxMemberInfo.DecodeMember(this.storedData);
         this.property = (this.member.GetValue(null) as Property);
     }
 }
Пример #3
0
        private static IEnumerator Loader()
        {
            Debug.Log("Loader", "MemberBindProviderEd", Color.blue);
            int count            = 0;
            int countBeforeYield = 20;

            if (MemberBindProviderEd.getterBindables == null || MemberBindProviderEd.setterBindables == null)
            {
                MemberBindProviderEd.getterBindables = new Dictionary <string, BindableData>();
                MemberBindProviderEd.setterBindables = new Dictionary <string, BindableData>();
                if (MemberBindProviderEd.scanTypes == null)
                {
                    MemberBindProviderEd.scanTypes = new List <Type>();
                    List <Type> usedValueTypes = new List <Type>(20)
                    {
                        typeof(bool),
                        typeof(int),
                        typeof(float),
                        typeof(string),
                        typeof(Vector2),
                        typeof(Vector3),
                        typeof(Rect),
                        typeof(Color)
                    };
                    new List <Type>();
                    List <string> lines = plyEdUtil.ReadCompressedLines(plyEdUtil.ProjectFullPath + BloxEdGlobal.MiscPath + "blocks.bin");
                    if (lines.Count > 0)
                    {
                        yield return((object)null);

                        for (int i = 0; i < lines.Count; i++)
                        {
                            string text = lines[i];
                            if (!string.IsNullOrEmpty(text))
                            {
                                BloxMemberInfo bloxMemberInfo = BloxMemberInfo.DecodeMember(text);
                                if (bloxMemberInfo != null && !MemberBindProviderEd.scanTypes.Contains(bloxMemberInfo.ReflectedType))
                                {
                                    MemberBindProviderEd.scanTypes.Add(bloxMemberInfo.ReflectedType);
                                }
                                count++;
                                if (count >= countBeforeYield)
                                {
                                    count = 0;
                                    yield return((object)null);
                                }
                            }
                        }
                    }
                    foreach (Type item in usedValueTypes)
                    {
                        if (!MemberBindProviderEd.scanTypes.Contains(item))
                        {
                            MemberBindProviderEd.scanTypes.Add(item);
                        }
                    }
                    yield return((object)null);

                    MemberBindProviderEd.scanTypes.Sort((Type a, Type b) => a.FullName.CompareTo(b.FullName));
                }
                List <Type> .Enumerator enumerator2 = MemberBindProviderEd.scanTypes.GetEnumerator();
                try
                {
                    while (enumerator2.MoveNext())
                    {
                        Type current2 = enumerator2.Current;
                        if (current2.IsClass && !current2.IsEnum && (!current2.IsAbstract || current2.IsSealed) && !current2.IsSpecialName && !current2.IsSubclassOf(typeof(Attribute)) && current2 != typeof(Attribute) && !current2.IsSubclassOf(typeof(Delegate)) && current2 != typeof(Delegate) && !current2.IsSubclassOf(typeof(Exception)) && current2 != typeof(Exception) && !current2.IsSubclassOf(typeof(BloxEventHandler)) && current2 != typeof(BloxEventHandler))
                        {
                            bool     inclOnlySpecifiedMembers = false;
                            object[] customAttributes         = current2.GetCustomAttributes(typeof(ExcludeFromBloxAttribute), true);
                            if (customAttributes.Length != 0)
                            {
                                if (!((ExcludeFromBloxAttribute)customAttributes[0]).ExceptForSpecifiedMembers)
                                {
                                    continue;
                                }
                                inclOnlySpecifiedMembers = true;
                            }
                            bool         flag         = true;
                            BindingFlags bindingFlags = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public;
                            if (BloxEd.Instance.includeDeclaredOnly | flag)
                            {
                                bindingFlags = (BindingFlags)((int)bindingFlags | 2);
                            }
                            PropertyInfo[] properties = current2.GetProperties(bindingFlags);
                            for (int j = 0; j < properties.Length; j++)
                            {
                                PropertyInfo propertyInfo = properties[j];
                                MemberBindProviderEd.ProcessBindableMember(propertyInfo, propertyInfo.PropertyType, inclOnlySpecifiedMembers);
                            }
                            FieldInfo[] fields = current2.GetFields(bindingFlags);
                            for (int j = 0; j < fields.Length; j++)
                            {
                                FieldInfo fieldInfo = fields[j];
                                MemberBindProviderEd.ProcessBindableMember(fieldInfo, fieldInfo.FieldType, inclOnlySpecifiedMembers);
                            }
                            MethodInfo[] methods = current2.GetMethods(bindingFlags);
                            for (int j = 0; j < methods.Length; j++)
                            {
                                MethodInfo methodInfo = methods[j];
                                if (!methodInfo.IsSpecialName)
                                {
                                    MemberBindProviderEd.ProcessBindableMember(methodInfo, methodInfo.ReturnType, inclOnlySpecifiedMembers);
                                }
                            }
                            count++;
                            if (count >= countBeforeYield)
                            {
                                count = 0;
                                yield return((object)null);
                            }
                        }
                    }
                }
                finally
                {
                    ((IDisposable)enumerator2).Dispose();
                }
                enumerator2 = default(List <Type> .Enumerator);
            }
            yield return((object)null);

            MemberBindProviderEd.loader.Stop();
            MemberBindProviderEd.loader = null;
        }