private bool IsExposed(int index) { //TODO: return true when base type is NUnit.Framework.Assertion or NUnit.Framework.TestCase var token = SimpleIndex.MakeToken(TableId.TypeDef, index + 1); var rows = Metadata.LookupRows(TableId.CustomAttribute, Schema.CustomAttribute.Parent, token, false); return(rows.Select(x => CustomAttributes.GetFullName(Loader, x)).Any(name => ExposeAttributes.Contains(name))); }
public InternalModule(AssemblyLoader loader, MetadataRow row, int index) { _loader = loader; MetadataToken = SimpleIndex.MakeToken(TableId.Module, index + 1); Name = row[Schema.Module.Name].String; Version = row[Schema.Module.Mvid].Guid; CustomAttributes = new CustomAttributes(_loader, this); }
protected override IAssembly ParseRow(MetadataRow row, int index) { var token = SimpleIndex.MakeToken(TableId.AssemblyRef, index + 1); var name = new AssemblyReference { Version = GetVersion(row, 0), Flags = ((AssemblyFlags)row[Schema.AssemblyRef.Flags].Value), PublicKeyToken = row[Schema.AssemblyRef.PublicKeyOrToken].Blob.ToArray(), Name = row[Schema.AssemblyRef.Name].String, Culture = row[Schema.AssemblyRef.Culture].Culture, HashValue = row[Schema.AssemblyRef.HashValue].Blob.ToArray(), MetadataToken = token }; return(Loader.ResolveAssembly(name)); }
public GenericParameterImpl(AssemblyLoader loader, MetadataRow row, int index, long id) { _loader = loader; MetadataToken = SimpleIndex.MakeToken(TableId.GenericParam, index + 1); Name = row[Schema.GenericParam.Name].String; Id = id; var position = (int)row[Schema.GenericParam.Number].Value; _flags = (GenericParamAttributes)row[Schema.GenericParam.Flags].Value; _owner = row[Schema.GenericParam.Owner].Value; _constraints = new ConstraintsImpl(this); _info = new GenericParameterInfo(position, Variance, SpecialConstraints); }
protected override IManifestFile ParseRow(MetadataRow row, int index) { var flags = (FileFlags)row[Schema.File.Flags].Value; var token = SimpleIndex.MakeToken(TableId.File, index + 1); var file = new ManifestFile { Name = row[Schema.File.Name].String, HashValue = row[Schema.File.HashValue].Blob.ToArray(), ContainsMetadata = flags == FileFlags.ContainsMetadata, MetadataToken = token }; file.CustomAttributes = new CustomAttributes(Loader, file); return(file); }
protected override IModule ParseRow(MetadataRow row, int index) { string name = row[Schema.ModuleRef.Name].String; //var f = GetFile(name); //var res = GetResource(name); var token = SimpleIndex.MakeToken(TableId.ModuleRef, index + 1); var mod = new Module { Name = name, MetadataToken = token }; Loader.Assembly.Modules.Add(mod); return(mod); }
protected override IManifestResource ParseRow(MetadataRow row, int index) { string name = row[Schema.ManifestResource.Name].String; var offset = (int)row[Schema.ManifestResource.Offset].Value; var flags = (ManifestResourceAttributes)row[Schema.ManifestResource.Flags].Value; var isPublic = (flags & ManifestResourceAttributes.VisibilityMask) == ManifestResourceAttributes.Public; var token = SimpleIndex.MakeToken(TableId.ManifestResource, index + 1); var resource = new ManifestResource { Name = name, Offset = offset, IsPublic = isPublic, MetadataToken = token }; resource.CustomAttributes = new CustomAttributes(Loader, resource); SimpleIndex impl = row[Schema.ManifestResource.Implementation].Value; if (impl == 0) { } else { switch (impl.Table) { case TableId.File: resource.Data = Metadata.GetResourceStream(offset); break; case TableId.AssemblyRef: throw new NotSupportedException(); } } return(resource); }
protected MemberBase(AssemblyLoader loader, TableId table, int index) { Loader = loader; MetadataToken = SimpleIndex.MakeToken(table, index + 1); }