Esempio n. 1
0
 public static uint CompressMetadataToken(CodedIndex cidx, MetadataToken token)
 {
     uint ret = 0;
     if (token.RID == 0)
         return ret;
     switch (cidx) {
     <% $coded_indexes.each { |ci| %>			case CodedIndex.<%=ci.name%> :
Esempio n. 2
0
		void WriteMetadataToken (MetadataToken token)
		{
			WriteUInt32 (token.ToUInt32 ());
		}
 void WriteMetadataToken(MetadataToken token, CodedIndex ci)
 {
     WriteByIndexSize (Utilities.CompressMetadataToken (ci, token),
         Utilities.GetCodedIndexSize (
             ci, new Utilities.TableRowCounter (GetNumberOfRows), m_ciCache));
 }
 public TypeDefRow CreateTypeDefRow(TypeAttributes _flags, uint _name, uint _namespace, MetadataToken _extends, uint _fieldList, uint _methodList)
 {
     TypeDefRow row = new TypeDefRow ();
     row.Flags = _flags;
     row.Name = _name;
     row.Namespace = _namespace;
     row.Extends = _extends;
     row.FieldList = _fieldList;
     row.MethodList = _methodList;
     return row;
 }
 public MethodSemanticsRow CreateMethodSemanticsRow(MethodSemanticsAttributes _semantics, uint _method, MetadataToken _association)
 {
     MethodSemanticsRow row = new MethodSemanticsRow ();
     row.Semantics = _semantics;
     row.Method = _method;
     row.Association = _association;
     return row;
 }
 public MemberRefRow CreateMemberRefRow(MetadataToken _class, uint _name, uint _signature)
 {
     MemberRefRow row = new MemberRefRow ();
     row.Class = _class;
     row.Name = _name;
     row.Signature = _signature;
     return row;
 }
 public InterfaceImplRow CreateInterfaceImplRow(uint _class, MetadataToken _interface)
 {
     InterfaceImplRow row = new InterfaceImplRow ();
     row.Class = _class;
     row.Interface = _interface;
     return row;
 }
 public GenericParamRow CreateGenericParamRow(ushort _number, GenericParamAttributes _flags, MetadataToken _owner, uint _name)
 {
     GenericParamRow row = new GenericParamRow ();
     row.Number = _number;
     row.Flags = _flags;
     row.Owner = _owner;
     row.Name = _name;
     return row;
 }
 void WriteMetadataToken(MetadataToken token, CodedIndex ci)
 {
     WriteByIndexSize(Utilities.CompressMetadataToken(ci, token),
                      Utilities.GetCodedIndexSize(
                          ci, new Utilities.TableRowCounter(GetNumberOfRows), m_ciCache));
 }
        public TypeDefRow CreateTypeDefRow(TypeAttributes _flags, uint _name, uint _namespace, MetadataToken _extends, uint _fieldList, uint _methodList)
        {
            TypeDefRow row = new TypeDefRow();

            row.Flags      = _flags;
            row.Name       = _name;
            row.Namespace  = _namespace;
            row.Extends    = _extends;
            row.FieldList  = _fieldList;
            row.MethodList = _methodList;
            return(row);
        }
        public MethodSemanticsRow CreateMethodSemanticsRow(MethodSemanticsAttributes _semantics, uint _method, MetadataToken _association)
        {
            MethodSemanticsRow row = new MethodSemanticsRow();

            row.Semantics   = _semantics;
            row.Method      = _method;
            row.Association = _association;
            return(row);
        }
        public MethodImplRow CreateMethodImplRow(uint _class, MetadataToken _methodBody, MetadataToken _methodDeclaration)
        {
            MethodImplRow row = new MethodImplRow();

            row.Class             = _class;
            row.MethodBody        = _methodBody;
            row.MethodDeclaration = _methodDeclaration;
            return(row);
        }
        public ManifestResourceRow CreateManifestResourceRow(uint _offset, ManifestResourceAttributes _flags, uint _name, MetadataToken _implementation)
        {
            ManifestResourceRow row = new ManifestResourceRow();

            row.Offset         = _offset;
            row.Flags          = _flags;
            row.Name           = _name;
            row.Implementation = _implementation;
            return(row);
        }
        public GenericParamConstraintRow CreateGenericParamConstraintRow(uint _owner, MetadataToken _constraint)
        {
            GenericParamConstraintRow row = new GenericParamConstraintRow();

            row.Owner      = _owner;
            row.Constraint = _constraint;
            return(row);
        }
        public GenericParamRow CreateGenericParamRow(ushort _number, GenericParameterAttributes _flags, MetadataToken _owner, uint _name)
        {
            GenericParamRow row = new GenericParamRow();

            row.Number = _number;
            row.Flags  = _flags;
            row.Owner  = _owner;
            row.Name   = _name;
            return(row);
        }
Esempio n. 16
0
 public GenericParamConstraintRow CreateGenericParamConstraintRow(uint _owner, MetadataToken _constraint)
 {
     GenericParamConstraintRow row = new GenericParamConstraintRow ();
     row.Owner = _owner;
     row.Constraint = _constraint;
     return row;
 }
Esempio n. 17
0
		void WriteMetadataToken (MetadataToken token, CodedIndex ci)
		{
			WriteByIndexSize (Utilities.CompressMetadataToken (ci, token),
				Utilities.GetCodedIndexSize (ci, m_counter, m_ciCache));
		}
Esempio n. 18
0
 public ImplMapRow CreateImplMapRow(PInvokeAttributes _mappingFlags, MetadataToken _memberForwarded, uint _importName, uint _importScope)
 {
     ImplMapRow row = new ImplMapRow ();
     row.MappingFlags = _mappingFlags;
     row.MemberForwarded = _memberForwarded;
     row.ImportName = _importName;
     row.ImportScope = _importScope;
     return row;
 }
Esempio n. 19
0
 public ConstantRow CreateConstantRow(ElementType _type, MetadataToken _parent, uint _value)
 {
     ConstantRow row = new ConstantRow ();
     row.Type = _type;
     row.Parent = _parent;
     row.Value = _value;
     return row;
 }
Esempio n. 20
0
 public ManifestResourceRow CreateManifestResourceRow(uint _offset, ManifestResourceAttributes _flags, uint _name, MetadataToken _implementation)
 {
     ManifestResourceRow row = new ManifestResourceRow ();
     row.Offset = _offset;
     row.Flags = _flags;
     row.Name = _name;
     row.Implementation = _implementation;
     return row;
 }
Esempio n. 21
0
 public CustomAttributeRow CreateCustomAttributeRow(MetadataToken _parent, MetadataToken _type, uint _value)
 {
     CustomAttributeRow row = new CustomAttributeRow ();
     row.Parent = _parent;
     row.Type = _type;
     row.Value = _value;
     return row;
 }
Esempio n. 22
0
 public MethodImplRow CreateMethodImplRow(uint _class, MetadataToken _methodBody, MetadataToken _methodDeclaration)
 {
     MethodImplRow row = new MethodImplRow ();
     row.Class = _class;
     row.MethodBody = _methodBody;
     row.MethodDeclaration = _methodDeclaration;
     return row;
 }
Esempio n. 23
0
 public DeclSecurityRow CreateDeclSecurityRow(SecurityAction _action, MetadataToken _parent, uint _permissionSet)
 {
     DeclSecurityRow row = new DeclSecurityRow ();
     row.Action = _action;
     row.Parent = _parent;
     row.PermissionSet = _permissionSet;
     return row;
 }
Esempio n. 24
0
 public MethodSpecRow CreateMethodSpecRow(MetadataToken _method, uint _instantiation)
 {
     MethodSpecRow row = new MethodSpecRow ();
     row.Method = _method;
     row.Instantiation = _instantiation;
     return row;
 }
Esempio n. 25
0
 public EventRow CreateEventRow(EventAttributes _eventFlags, uint _name, MetadataToken _eventType)
 {
     EventRow row = new EventRow ();
     row.EventFlags = _eventFlags;
     row.Name = _name;
     row.EventType = _eventType;
     return row;
 }
Esempio n. 26
0
 public TypeRefRow CreateTypeRefRow(MetadataToken _resolutionScope, uint _name, uint _namespace)
 {
     TypeRefRow row = new TypeRefRow ();
     row.ResolutionScope = _resolutionScope;
     row.Name = _name;
     row.Namespace = _namespace;
     return row;
 }
Esempio n. 27
0
 public ExportedTypeRow CreateExportedTypeRow(TypeAttributes _flags, uint _typeDefId, uint _typeName, uint _typeNamespace, MetadataToken _implementation)
 {
     ExportedTypeRow row = new ExportedTypeRow ();
     row.Flags = _flags;
     row.TypeDefId = _typeDefId;
     row.TypeName = _typeName;
     row.TypeNamespace = _typeNamespace;
     row.Implementation = _implementation;
     return row;
 }
Esempio n. 28
0
		MetadataToken GetStandAloneSignatureToken (uint signature)
		{
			MetadataToken token;
			if (standalone_signatures.TryGetValue (signature, out token))
				return token;

			token = new MetadataToken (TokenType.Signature, metadata.AddStandAloneSignature (signature));
			standalone_signatures.Add (signature, token);
			return token;
		}
Esempio n. 29
0
 public FieldMarshalRow CreateFieldMarshalRow(MetadataToken _parent, uint _nativeType)
 {
     FieldMarshalRow row = new FieldMarshalRow ();
     row.Parent = _parent;
     row.NativeType = _nativeType;
     return row;
 }
Esempio n. 30
0
		public static uint CompressMetadataToken (CodedIndex cidx, MetadataToken token)
		{
			uint ret = 0;
			if (token.RID == 0)
				return ret;
			switch (cidx) {
			case CodedIndex.TypeDefOrRef :
				ret = token.RID << 2;
				switch (token.TokenType) {
				case TokenType.TypeDef :
					return ret | 0;
				case TokenType.TypeRef :
					return ret | 1;
				case TokenType.TypeSpec :
					return ret | 2;
				default :
					throw new MetadataFormatException("Non valid Token for TypeDefOrRef");
				}
			case CodedIndex.HasConstant :
				ret = token.RID << 2;
				switch (token.TokenType) {
				case TokenType.Field :
					return ret | 0;
				case TokenType.Param :
					return ret | 1;
				case TokenType.Property :
					return ret | 2;
				default :
					throw new MetadataFormatException("Non valid Token for HasConstant");
				}
			case CodedIndex.HasCustomAttribute :
				ret = token.RID << 5;
				switch (token.TokenType) {
				case TokenType.Method :
					return ret | 0;
				case TokenType.Field :
					return ret | 1;
				case TokenType.TypeRef :
					return ret | 2;
				case TokenType.TypeDef :
					return ret | 3;
				case TokenType.Param :
					return ret | 4;
				case TokenType.InterfaceImpl :
					return ret | 5;
				case TokenType.MemberRef :
					return ret | 6;
				case TokenType.Module :
					return ret | 7;
				case TokenType.Permission :
					return ret | 8;
				case TokenType.Property :
					return ret | 9;
				case TokenType.Event :
					return ret | 10;
				case TokenType.Signature :
					return ret | 11;
				case TokenType.ModuleRef :
					return ret | 12;
				case TokenType.TypeSpec :
					return ret | 13;
				case TokenType.Assembly :
					return ret | 14;
				case TokenType.AssemblyRef :
					return ret | 15;
				case TokenType.File :
					return ret | 16;
				case TokenType.ExportedType :
					return ret | 17;
				case TokenType.ManifestResource :
					return ret | 18;
				case TokenType.GenericParam :
					return ret | 19;
				default :
					throw new MetadataFormatException("Non valid Token for HasCustomAttribute");
				}
			case CodedIndex.HasFieldMarshal :
				ret = token.RID << 1;
				switch (token.TokenType) {
				case TokenType.Field :
					return ret | 0;
				case TokenType.Param :
					return ret | 1;
				default :
					throw new MetadataFormatException("Non valid Token for HasFieldMarshal");
				}
			case CodedIndex.HasDeclSecurity :
				ret = token.RID << 2;
				switch (token.TokenType) {
				case TokenType.TypeDef :
					return ret | 0;
				case TokenType.Method :
					return ret | 1;
				case TokenType.Assembly :
					return ret | 2;
				default :
					throw new MetadataFormatException("Non valid Token for HasDeclSecurity");
				}
			case CodedIndex.MemberRefParent :
				ret = token.RID << 3;
				switch (token.TokenType) {
				case TokenType.TypeDef :
					return ret | 0;
				case TokenType.TypeRef :
					return ret | 1;
				case TokenType.ModuleRef :
					return ret | 2;
				case TokenType.Method :
					return ret | 3;
				case TokenType.TypeSpec :
					return ret | 4;
				default :
					throw new MetadataFormatException("Non valid Token for MemberRefParent");
				}
			case CodedIndex.HasSemantics :
				ret = token.RID << 1;
				switch (token.TokenType) {
				case TokenType.Event :
					return ret | 0;
				case TokenType.Property :
					return ret | 1;
				default :
					throw new MetadataFormatException("Non valid Token for HasSemantics");
				}
			case CodedIndex.MethodDefOrRef :
				ret = token.RID << 1;
				switch (token.TokenType) {
				case TokenType.Method :
					return ret | 0;
				case TokenType.MemberRef :
					return ret | 1;
				default :
					throw new MetadataFormatException("Non valid Token for MethodDefOrRef");
				}
			case CodedIndex.MemberForwarded :
				ret = token.RID << 1;
				switch (token.TokenType) {
				case TokenType.Field :
					return ret | 0;
				case TokenType.Method :
					return ret | 1;
				default :
					throw new MetadataFormatException("Non valid Token for MemberForwarded");
				}
			case CodedIndex.Implementation :
				ret = token.RID << 2;
				switch (token.TokenType) {
				case TokenType.File :
					return ret | 0;
				case TokenType.AssemblyRef :
					return ret | 1;
				case TokenType.ExportedType :
					return ret | 2;
				default :
					throw new MetadataFormatException("Non valid Token for Implementation");
				}
			case CodedIndex.CustomAttributeType :
				ret = token.RID << 3;
				switch (token.TokenType) {
				case TokenType.Method :
					return ret | 2;
				case TokenType.MemberRef :
					return ret | 3;
				default :
					throw new MetadataFormatException("Non valid Token for CustomAttributeType");
				}
			case CodedIndex.ResolutionScope :
				ret = token.RID << 2;
				switch (token.TokenType) {
				case TokenType.Module :
					return ret | 0;
				case TokenType.ModuleRef :
					return ret | 1;
				case TokenType.AssemblyRef :
					return ret | 2;
				case TokenType.TypeRef :
					return ret | 3;
				default :
					throw new MetadataFormatException("Non valid Token for ResolutionScope");
				}
			case CodedIndex.TypeOrMethodDef :
				ret = token.RID << 1;
				switch (token.TokenType) {
				case TokenType.TypeDef :
					return ret | 0;
				case TokenType.Method :
					return ret | 1;
				default :
					throw new MetadataFormatException("Non valid Token for TypeOrMethodDef");
				}
			default :
				throw new MetadataFormatException ("Non valid CodedIndex");
			}
		}
        public ExportedTypeRow CreateExportedTypeRow(TypeAttributes _flags, uint _typeDefId, uint _typeName, uint _typeNamespace, MetadataToken _implementation)
        {
            ExportedTypeRow row = new ExportedTypeRow();

            row.Flags          = _flags;
            row.TypeDefId      = _typeDefId;
            row.TypeName       = _typeName;
            row.TypeNamespace  = _typeNamespace;
            row.Implementation = _implementation;
            return(row);
        }