示例#1
0
        public SchemaConstructorBuilder(SchemaDocument doc,
                                        SchemaTypeBuilder types,
                                        SchemaFieldBuilder fields,
                                        SchemaBasicReaderBuilder basic)
        {
            Doc    = doc;
            Types  = types;
            Fields = fields;
            Basic  = basic;

            CompoundConstructors = Types.CompoundTypes
                                   .ToDictionary(
                kvp => kvp.Key,
                kvp => WriteCompoundConstructor(kvp.Value)
                );
            //NiObjectConstructors = Types.NiObjectTypes
            //    .ToDictionary(
            //        kvp => kvp.Key,
            //        kvp => kvp.Value.DefineDefaultConstructor(MethodAttributes.Public)
            //    );
        }
示例#2
0
        /// <summary>
        /// Writes types for each niObject, compound, enum, bitflag and bitfield
        /// into a reflection module, as well as building constructors for each
        /// type.
        /// </summary>
        /// <param name="moduleBuilder">The module to write the types to</param>
        /// <param name="document">The base schema document that described the types in NIF.xml/BlockStructure format</param>
        /// <param name="basics">A map of basic type names to their primitive values</param>
        /// <param name="version">The specific version of the document to use</param>
        public SchemaDocumentBuilder(ModuleBuilder moduleBuilder,
                                     SchemaDocument document,
                                     Dictionary <string, Type> basics,
                                     VersionKey version)
        {
            Document          = document;
            SchemaBasicReader = new SchemaBasicReaderBuilder(moduleBuilder, document, basics);

            SchemaTypes        = new SchemaTypeBuilder(document, moduleBuilder, SchemaBasicReader);
            SchemaFields       = new SchemaFieldBuilder(this, version);
            SchemaInheritance  = new SchemaInheritanceBuilder(SchemaTypes);
            SchemaEnum         = new SchemaEnumBuilder(SchemaTypes);
            SchemaConstructors = new SchemaConstructorBuilder(document, SchemaTypes, SchemaFields, SchemaBasicReader);
            SchemaILBuilder    = new SchemaConstructorILBuilder(this);

            foreach (var enumBuilder in SchemaTypes.BuiltEnumsByName.Values)
            {
                enumBuilder.CreateTypeInfo();
            }
            foreach (var typeBuilder in SchemaTypes.BuiltTypesByName.Values)
            {
                typeBuilder.CreateTypeInfo();
            }
        }