Example #1
0
        /// <summary>
        /// Loads the PE assembly.
        /// </summary>
        /// <param name="file">The file.</param>
        /// <returns></returns>
        private IMetadataModule LoadPEAssembly(string file)
        {
            if (!File.Exists(file))
            {
                return(null);
            }

            string codeBase = CreateFileCodeBase(file);

            return(PortableExecutableImage.Load(new FileStream(file, FileMode.Open, FileAccess.Read), codeBase));
        }
Example #2
0
        private IMetadataModule LoadAssembly(string file)
        {
            if (!File.Exists(file))
            {
                return(null);
            }

            IMetadataModule result = PortableExecutableImage.Load(_loadedImages.Count, new FileStream(file, FileMode.Open, FileAccess.Read));

            if (null != result)
            {
                lock (_loadedImages) {
                    _loadedImages.Add(result);
                }

                _typeLoader.AssemblyLoaded(result);
            }

            return(result);
        }