Esempio n. 1
0
        internal void GeneratePersistFields(RSTypeAssembly inAssembly)
        {
            using (PooledList <RSPersistFieldInfo> persistFields = PooledList <RSPersistFieldInfo> .Alloc())
            {
                foreach (var persistField in Reflect.FindFields <RSPersistFieldAttribute>(OwnerType, BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public))
                {
                    FieldInfo field = persistField.Info;
                    RSPersistFieldAttribute fieldAttr = persistField.Attribute;

                    RSPersistFieldInfo fieldInfo = new RSPersistFieldInfo(fieldAttr, field);
                    persistFields.Add(fieldInfo);
                }

                if (persistFields.Count > 0)
                {
                    m_PersistFields = new Dictionary <string, RSPersistFieldInfo>(persistFields.Count);
                    for (int i = 0; i < persistFields.Count; ++i)
                    {
                        RSPersistFieldInfo info = persistFields[i];
                        info.Link(inAssembly);
                        m_PersistFields.Add(info.Name, info);
                    }
                }
            }
        }
Esempio n. 2
0
        public RSPersistFieldInfo(RSPersistFieldAttribute inAttribute, FieldInfo inInfo)
        {
            Name = inAttribute?.Name ?? inInfo.Name;

            m_FieldInfo = inInfo;
            m_FieldType = inInfo.FieldType;
        }