Inheritance: FileSegment
Esempio n. 1
0
 internal RangedDefinitionCollection(object owner, MetadataTable <TMember> table, int start, int next)
 {
     _owner = owner;
     _table = table;
     _start = Math.Min(start, table.Count + 1);
     _next  = Math.Min(next, table.Count + 1);
 }
 internal RangedDefinitionCollection(object owner, MetadataTable <TMember> table, int start, int next)
 {
     _owner = owner;
     _table = table;
     _start = start;
     _next  = next;
 }
Esempio n. 3
0
        public NetAssembly(WindowsAssembly assembly, string filePath)
        {
            WindowsAssembly = assembly;
            FilePath = filePath;

            var tableStream = WindowsAssembly.NetDirectory?.MetadataHeader?.GetStream<TableStream>();

            if (tableStream == null)
                throw new BadImageFormatException("File does not appear to be a .NET executable.");

            var assemblyDefTable = tableStream.GetTable<AsmResolver.Net.Metadata.AssemblyDefinition>();
            _typeTable = tableStream.GetTable<TypeDefinition>();
            Definition = assemblyDefTable[0];
        }
Esempio n. 4
0
        private MsCorLibTypeSignature CreateSignature(ElementType type, string name, bool isValueType)
        {
            MsCorLibTypeSignature signature;

            if (_isMsCorLib)
            {
                if (_typeDefinitions == null)
                    _typeDefinitions = _header.GetStream<TableStream>().GetTable<TypeDefinition>();
                signature= new MsCorLibTypeSignature(_typeDefinitions.First(x => x.Name == name), type, isValueType);
            }
            else
            {
                signature = new MsCorLibTypeSignature(new TypeReference(MsCorLibReference, "System", name)
                {
                    Header = _header
                }, type, isValueType);
            }

            _typesByName[name] = signature;
            _typesByElementType[type] = signature;
            return signature;
        }