예제 #1
0
        public TypeNameMapGenerator(IEnumerable <string> assemblies, Action <string, object []> logMessage)
        {
            if (assemblies == null)
            {
                throw new ArgumentNullException("assemblies");
            }
            if (logMessage == null)
            {
                throw new ArgumentNullException(nameof(logMessage));
            }

            Log = logMessage;
            var Assemblies = assemblies.ToList();
            var rp         = new ReaderParameters();

            Resolver = new DirectoryAssemblyResolver(Log, loadDebugSymbols: true, loadReaderParameters: rp);
            foreach (var assembly in Assemblies)
            {
                var directory = Path.GetDirectoryName(assembly);
                if (string.IsNullOrEmpty(directory))
                {
                    continue;
                }
                if (!Resolver.SearchDirectories.Contains(directory))
                {
                    Resolver.SearchDirectories.Add(directory);
                }
            }
            foreach (var assembly in Assemblies)
            {
                Resolver.Load(Path.GetFullPath(assembly));
            }

            Types = JavaTypeScanner.GetJavaTypes(Assemblies, Resolver, logMessage);
        }
        public TypeNameMapGenerator(IEnumerable <string> assemblies, Action <TraceLevel, string> logger, IMetadataResolver resolver)
        {
            if (assemblies == null)
            {
                throw new ArgumentNullException("assemblies");
            }
            if (logger == null)
            {
                throw new ArgumentNullException(nameof(logger));
            }

            Cache = resolver ?? new TypeDefinitionCache();
            Log   = logger;
            var Assemblies = assemblies.ToList();
            var rp         = new ReaderParameters();

            Resolver = new DirectoryAssemblyResolver(Log, loadDebugSymbols: true, loadReaderParameters: rp);
            foreach (var assembly in Assemblies)
            {
                var directory = Path.GetDirectoryName(assembly);
                if (string.IsNullOrEmpty(directory))
                {
                    continue;
                }
                if (!Resolver.SearchDirectories.Contains(directory))
                {
                    Resolver.SearchDirectories.Add(directory);
                }
            }
            foreach (var assembly in Assemblies)
            {
                Resolver.Load(Path.GetFullPath(assembly));
            }

            Scanner = new JavaTypeScanner(Log, Cache)
            {
                ErrorOnCustomJavaObject = false,
            };
            Types = Scanner.GetJavaTypes(Assemblies, Resolver);
        }
예제 #3
0
        public TypeNameMapGenerator(IEnumerable <string> assemblies, Action <string, object []> logMessage)
        {
            if (assemblies == null)
            {
                throw new ArgumentNullException("assemblies");
            }
            if (logMessage == null)
            {
                throw new ArgumentNullException(nameof(logMessage));
            }

            Log = logMessage;
            var Assemblies = assemblies.ToList();
            var resolver   = new DirectoryAssemblyResolver(Log, loadDebugSymbols: true);

            foreach (var assembly in Assemblies)
            {
                resolver.Load(Path.GetFullPath(assembly));
            }

            Types = JavaTypeScanner.GetJavaTypes(Assemblies, resolver, logMessage);
        }