コード例 #1
0
        private static IEnumerable <IScriptField> CreateFields(MonoManager manager, TypeDefinition type, IReadOnlyDictionary <GenericParameter, TypeReference> arguments)
        {
            List <IScriptField> fields = new List <IScriptField>();

            foreach (FieldDefinition field in type.Fields)
            {
                if (!MonoField.IsSerializable(field, arguments))
                {
                    continue;
                }

                MonoField monoField = new MonoField(manager, field, arguments);
                fields.Add(monoField);
            }
            return(fields);
        }
コード例 #2
0
ファイル: MonoType.cs プロジェクト: zbx91/UtinyRipper
        private static Field[] CreateFields(MonoManager manager, TypeReference type, IReadOnlyDictionary <GenericParameter, TypeReference> arguments)
        {
            TypeDefinition definition = type.Resolve();
            List <Field>   fields     = new List <Field>();

            foreach (FieldDefinition field in definition.Fields)
            {
                if (MonoField.IsSerializable(field, arguments))
                {
                    TypeReference    fieldType  = GetSerializedElementType(field.FieldType, arguments);
                    SerializableType scriptType = manager.GetSerializableType(fieldType, arguments);
                    bool             isArray    = IsSerializableArray(field.FieldType, arguments);
                    Field            fieldStruc = new Field(scriptType, isArray, field.Name);
                    fields.Add(fieldStruc);
                }
            }
            return(fields.ToArray());
        }
コード例 #3
0
        private static Field[] CreateFields(MonoManager manager, MonoTypeContext context)
        {
            List <Field>   fields     = new List <Field>();
            TypeDefinition definition = context.Type.Resolve();
            IReadOnlyDictionary <GenericParameter, TypeReference> arguments = context.GetContextArguments();

            foreach (FieldDefinition field in definition.Fields)
            {
                if (MonoField.IsSerializable(field, arguments))
                {
                    MonoTypeContext  fieldContext    = new MonoTypeContext(field.FieldType, arguments);
                    MonoTypeContext  resolvedContext = fieldContext.Resolve();
                    MonoTypeContext  serFieldContext = GetSerializedElementContext(resolvedContext);
                    SerializableType scriptType      = manager.GetSerializableType(serFieldContext);
                    bool             isArray         = MonoField.IsSerializableArray(resolvedContext.Type);
                    Field            fieldStruc      = new Field(scriptType, isArray, field.Name);
                    fields.Add(fieldStruc);
                }
            }
            return(fields.ToArray());
        }