using System.Collections.Generic; class FieldMetaInfo { public readonly string csharpName; public readonly string cppName; public readonly string cppRowSize; public FieldMetaInfo(string csharpName, string cppName, string cppRowSize) { this.csharpName = csharpName; this.cppName = cppName; this.cppRowSize = cppRowSize; } public FieldMetaInfo(string csharpName, string cppRowSize) : this(csharpName, csharpName.Substring(0, 1).ToLower() + csharpName.Substring(1), cppRowSize) { } } class TableMetaInfo { public readonly string csharpTypeName; public readonly string cppTypeName; public readonly string cppEnumName; public readonly List fields; public TableMetaInfo(string csharpTypeName, string cppTypeName, string cppEnumName, List fields) { this.csharpTypeName = csharpTypeName; this.cppTypeName = cppTypeName; this.cppEnumName = cppEnumName; this.fields = fields; } public TableMetaInfo(string csharpTypeName, List fields) : this(csharpTypeName, csharpTypeName, csharpTypeName.ToUpper(), fields) { } } class TableMetaInfos { public static readonly List tableMetaInfos = new List { new TableMetaInfo("Module", new List { new FieldMetaInfo("Generation", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Mvid", "ComputGUIDIndexByte()"), new FieldMetaInfo("EncId", "ComputGUIDIndexByte()"), new FieldMetaInfo("EncBaseId", "ComputGUIDIndexByte()"), }), new TableMetaInfo("TypeRef", new List { new FieldMetaInfo("ResolutionScope", "ComputTableIndexByte(TableType::MODULE, TableType::MODULEREF, TableType::ASSEMBLYREF, TableType::TYPEREF, TagBits::ResoulutionScope)"), new FieldMetaInfo("Name", "typeName", "ComputStringIndexByte()"), new FieldMetaInfo("Namespace", "typeNamespace", "ComputStringIndexByte()"), }), new TableMetaInfo("TypeDef", new List { new FieldMetaInfo("Flags", "4"), new FieldMetaInfo("Name", "typeName", "ComputStringIndexByte()"), new FieldMetaInfo("Namespace", "typeNamespace", "ComputStringIndexByte()"), new FieldMetaInfo("Extends", "ComputTableIndexByte(TableType::TYPEDEF, TableType::TYPEREF, TableType::TYPESPEC, TagBits::TypeDefOrRef)"), new FieldMetaInfo("FieldList", "ComputTableIndexByte(TableType::FIELD)"), new FieldMetaInfo("MethodList", "ComputTableIndexByte(TableType::METHOD)"), }), new TableMetaInfo("FieldPtr", new List { new FieldMetaInfo("Field", "ComputTableIndexByte(TableType::FIELD)"), }), new TableMetaInfo("Field", new List { new FieldMetaInfo("Flags", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Signature", "ComputBlobIndexByte()"), }), new TableMetaInfo("MethodPtr", new List { new FieldMetaInfo("Method", "ComputTableIndexByte(TableType::METHOD)"), }), new TableMetaInfo("Method", new List { new FieldMetaInfo("RVA", "rva", "4"), new FieldMetaInfo("ImplFlags", "2"), new FieldMetaInfo("Flags", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Signature", "ComputBlobIndexByte()"), new FieldMetaInfo("ParamList", "ComputTableIndexByte(TableType::PARAM)"), }), new TableMetaInfo("ParamPtr", new List { new FieldMetaInfo("Param", "ComputTableIndexByte(TableType::PARAM)"), }), new TableMetaInfo("Param", new List { new FieldMetaInfo("Flags", "2"), new FieldMetaInfo("Sequence", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), }), new TableMetaInfo("InterfaceImpl", new List { new FieldMetaInfo("Class", "classIdx", "ComputTableIndexByte(TableType::TYPEDEF)"), new FieldMetaInfo("Interface", "interfaceIdx", "ComputTableIndexByte(TableType::TYPEDEF, TableType::TYPEREF, TableType::TYPESPEC, TagBits::TypeDefOrRef)"), }), new TableMetaInfo("MemberRef", new List { new FieldMetaInfo("Class", "classIdx", "ComputTableIndexByte(TableType::METHOD, TableType::MODULEREF, TableType::TYPEDEF, TableType::TYPEREF, TagBits::MemberRefParent)"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Signature", "ComputBlobIndexByte()"), }), new TableMetaInfo("Constant", new List { new FieldMetaInfo("Type", "1"), new FieldMetaInfo("Padding", "1"), new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::PARAM, TableType::FIELD, TableType::PROPERTY, TagBits::HasConstant)"), new FieldMetaInfo("Value", "ComputBlobIndexByte()"), }), new TableMetaInfo("CustomAttribute", new List { new FieldMetaInfo("Parent", "ComputTableIndexByte(HasCustomAttributeAssociateTables, sizeof(HasCustomAttributeAssociateTables) / sizeof(TableType), TagBits::HasCustomAttribute)"), new FieldMetaInfo("Type", "ComputTableIndexByte(TableType::METHOD, TableType::MEMBERREF, TagBits::CustomAttributeType)"), new FieldMetaInfo("Value", "ComputBlobIndexByte()"), }), new TableMetaInfo("FieldMarshal", new List { new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::FIELD, TableType::PARAM, TagBits::HasFieldMarshal)"), new FieldMetaInfo("NativeType", "ComputBlobIndexByte()"), }), new TableMetaInfo("DeclSecurity", new List { new FieldMetaInfo("Action", "2"), new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::TYPEDEF, TableType::METHOD, TableType::ASSEMBLY, TagBits::HasDeclSecurity)"), new FieldMetaInfo("PermissionSet", "ComputBlobIndexByte()"), }), new TableMetaInfo("ClassLayout", new List { new FieldMetaInfo("PackingSize", "2"), new FieldMetaInfo("ClassSize", "4"), new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::TYPEDEF)"), }), new TableMetaInfo("FieldLayout", new List { new FieldMetaInfo("OffSet", "offset", "4"), new FieldMetaInfo("Field", "ComputTableIndexByte(TableType::FIELD)"), }), new TableMetaInfo("StandAloneSig", new List { new FieldMetaInfo("Signature", "ComputBlobIndexByte()"), }), new TableMetaInfo("EventMap", new List { new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::TYPEDEF)"), new FieldMetaInfo("EventList", "ComputTableIndexByte(TableType::EVENT)"), }), new TableMetaInfo("EventPtr", new List { new FieldMetaInfo("Event", "ComputTableIndexByte(TableType::EVENT)"), }), new TableMetaInfo("Event", new List { new FieldMetaInfo("EventFlags", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("EventType", "ComputTableIndexByte(TableType::TYPEDEF, TableType::TYPEREF, TableType::TYPESPEC, TagBits::TypeDefOrRef)"), }), new TableMetaInfo("PropertyMap", new List { new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::TYPEDEF)"), new FieldMetaInfo("PropertyList", "ComputTableIndexByte(TableType::PROPERTY)"), }), new TableMetaInfo("PropertyPtr", new List { new FieldMetaInfo("Property", "ComputTableIndexByte(TableType::PROPERTY)"), }), new TableMetaInfo("Property", new List { new FieldMetaInfo("PropFlags", "flags", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Type", "ComputBlobIndexByte()"), }), new TableMetaInfo("MethodSemantics", new List { new FieldMetaInfo("Semantic", "semantics", "2"), new FieldMetaInfo("Method", "ComputTableIndexByte(TableType::METHOD)"), new FieldMetaInfo("Association", "ComputTableIndexByte(TableType::EVENT, TableType::PROPERTY, TagBits::HasSemantics)"), }), new TableMetaInfo("MethodImpl", new List { new FieldMetaInfo("Class", "classIdx", "ComputTableIndexByte(TableType::TYPEDEF)"), new FieldMetaInfo("MethodBody", "ComputTableIndexByte(TableType::METHOD, TableType::MEMBERREF, TagBits::MethodDefOrRef)"), new FieldMetaInfo("MethodDeclaration", "ComputTableIndexByte(TableType::METHOD, TableType::MEMBERREF, TagBits::MethodDefOrRef)"), }), new TableMetaInfo("ModuleRef", new List { new FieldMetaInfo("Name", "ComputStringIndexByte()"), }), new TableMetaInfo("TypeSpec", new List { new FieldMetaInfo("Signature", "ComputBlobIndexByte()"), }), new TableMetaInfo("ImplMap", new List { new FieldMetaInfo("MappingFlags", "2"), new FieldMetaInfo("MemberForwarded", "ComputTableIndexByte(TableType::FIELD, TableType::METHOD, TagBits::MemberForwarded)"), new FieldMetaInfo("ImportName", "ComputStringIndexByte()"), new FieldMetaInfo("ImportScope", "ComputTableIndexByte(TableType::MODULEREF)"), }), new TableMetaInfo("FieldRVA", new List { new FieldMetaInfo("RVA", "rva", "4"), new FieldMetaInfo("Field", "ComputTableIndexByte(TableType::FIELD)"), }), new TableMetaInfo("ENCLog","EncLog", "ENCLOG", new List { new FieldMetaInfo("Token", "4"), new FieldMetaInfo("FuncCode", "4"), }), new TableMetaInfo("ENCMap", "EncMap", "ENCMAP", new List { new FieldMetaInfo("Token", "4"), }), new TableMetaInfo("Assembly", new List { new FieldMetaInfo("HashAlgId", "4"), new FieldMetaInfo("MajorVersion", "2"), new FieldMetaInfo("MinorVersion", "2"), new FieldMetaInfo("BuildNumber", "2"), new FieldMetaInfo("RevisionNumber", "2"), new FieldMetaInfo("Flags", "4"), new FieldMetaInfo("PublicKey", "ComputBlobIndexByte()"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Locale", "ComputStringIndexByte()"), }), new TableMetaInfo("AssemblyProcessor", new List { new FieldMetaInfo("Processor", "4"), }), new TableMetaInfo("AssemblyOS", new List { new FieldMetaInfo("OSPlatformId", "osPlatformId", "4"), new FieldMetaInfo("OSMajorVersion", "osMajorVersion", "4"), new FieldMetaInfo("OSMinorVersion", "osMinorVersion", "4"), }), new TableMetaInfo("AssemblyRef", new List { new FieldMetaInfo("MajorVersion", "2"), new FieldMetaInfo("MinorVersion", "2"), new FieldMetaInfo("BuildNumber", "2"), new FieldMetaInfo("RevisionNumber", "2"), new FieldMetaInfo("Flags", "4"), new FieldMetaInfo("PublicKeyOrToken", "ComputBlobIndexByte()"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Locale", "ComputStringIndexByte()"), new FieldMetaInfo("HashValue", "ComputBlobIndexByte()"), }), new TableMetaInfo("AssemblyRefProcessor", new List { new FieldMetaInfo("AssemblyRef", "4"), new FieldMetaInfo("Processor", "ComputTableIndexByte(TableType::ASSEMBLYREF)"), }), new TableMetaInfo("AssemblyRefOS", new List { new FieldMetaInfo("OSPlatformId", "osPlatformId", "4"), new FieldMetaInfo("OSMajorVersion", "osMajorVersion", "4"), new FieldMetaInfo("OSMinorVersion", "osMinorVersion", "4"), new FieldMetaInfo("AssemblyRef", "ComputTableIndexByte(TableType::ASSEMBLYREF)"), }), new TableMetaInfo("File", new List { new FieldMetaInfo("Flags", "4"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("HashValue", "ComputBlobIndexByte()"), }), new TableMetaInfo("ExportedType", new List { new FieldMetaInfo("Flags", "4"), new FieldMetaInfo("TypeDefId", "4"), new FieldMetaInfo("TypeName", "ComputStringIndexByte()"), new FieldMetaInfo("TypeNamespace", "ComputStringIndexByte()"), new FieldMetaInfo("Implementation", "ComputTableIndexByte(TableType::FILE, TableType::EXPORTEDTYPE, TableType::ASSEMBLY, TagBits::Implementation)"), }), new TableMetaInfo("ManifestResource", new List { new FieldMetaInfo("Offset", "4"), new FieldMetaInfo("Flags", "4"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Implementation", "ComputTableIndexByte(TableType::FILE, TableType::ASSEMBLYREF, TagBits::Implementation)"), }), new TableMetaInfo("NestedClass", new List { new FieldMetaInfo("NestedClass", "ComputTableIndexByte(TableType::TYPEDEF)"), new FieldMetaInfo("EnclosingClass", "ComputTableIndexByte(TableType::TYPEDEF)"), }), new TableMetaInfo("GenericParam", new List { new FieldMetaInfo("Number", "2"), new FieldMetaInfo("Flags", "2"), new FieldMetaInfo("Owner", "ComputTableIndexByte(TableType::TYPEDEF, TableType::METHOD, TagBits::TypeOrMethodDef)"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), }), new TableMetaInfo("MethodSpec", new List { new FieldMetaInfo("Method", "ComputTableIndexByte(TableType::METHOD, TableType::MEMBERREF, TagBits::MethodDefOrRef)"), new FieldMetaInfo("Instantiation", "ComputBlobIndexByte()"), }), new TableMetaInfo("GenericParamConstraint", new List { new FieldMetaInfo("Owner", "ComputTableIndexByte(TableType::GENERICPARAM)"), new FieldMetaInfo("Constraint", "ComputTableIndexByte(TableType::TYPEDEF, TableType::TYPEREF, TableType::TYPESPEC, TagBits::TypeDefOrRef)"), }), new TableMetaInfo("Document", new List { new FieldMetaInfo("Name", "ComputBlobIndexByte()"), new FieldMetaInfo("HashAlgorithm", "ComputGUIDIndexByte()"), new FieldMetaInfo("Hash", "ComputBlobIndexByte()"), new FieldMetaInfo("Language", "ComputGUIDIndexByte()"), }), new TableMetaInfo("MethodDebugInformation", new List { new FieldMetaInfo("Document", "ComputTableIndexByte(TableType::DOCUMENT)"), new FieldMetaInfo("SequencePoints", "ComputBlobIndexByte()"), }), new TableMetaInfo("LocalScope", new List { new FieldMetaInfo("Method", "ComputTableIndexByte(TableType::METHOD)"), new FieldMetaInfo("ImportScope", "ComputTableIndexByte(TableType::IMPORTSCOPE)"), new FieldMetaInfo("VariableList", "variables", "ComputTableIndexByte(TableType::LOCALVARIABLE)"), new FieldMetaInfo("ConstantList", "constants", "ComputTableIndexByte(TableType::LOCALCONSTANT)"), new FieldMetaInfo("StartOffset", "4"), new FieldMetaInfo("Length", "4"), }), new TableMetaInfo("LocalVariable", new List { new FieldMetaInfo("Attributes", "2"), new FieldMetaInfo("Index", "2"), new FieldMetaInfo("Name", "ComputStringIndexByte()"), }), new TableMetaInfo("LocalConstant", new List { new FieldMetaInfo("Name", "ComputStringIndexByte()"), new FieldMetaInfo("Signature", "ComputBlobIndexByte()"), }), new TableMetaInfo("ImportScope", new List { new FieldMetaInfo("Parent", "ComputTableIndexByte(TableType::IMPORTSCOPE)"), new FieldMetaInfo("Imports", "ComputBlobIndexByte()"), }), new TableMetaInfo("StateMachineMethod", new List { new FieldMetaInfo("MoveNextMethod", "ComputTableIndexByte(TableType::METHOD)"), new FieldMetaInfo("KickoffMethod", "ComputTableIndexByte(TableType::METHOD)"), }), new TableMetaInfo("CustomDebugInformation", new List { new FieldMetaInfo("Parent", "ComputTableIndexByte(HasCustomDebugInformation, sizeof(HasCustomDebugInformation) / sizeof(TableType), TagBits::HasCustomDebugInformation)"), new FieldMetaInfo("Kind", "ComputGUIDIndexByte()"), new FieldMetaInfo("Value", "ComputBlobIndexByte()"), }), }; }