public void LoadPlugin(string assemblyPath)
        {
            var path = fileSystem.Path.GetFullPath(assemblyPath);
            var dll  = assemblyWrapper.LoadFile(path);

            foreach (var type in assemblyWrapper.GetExportedTypes(dll))
            {
                if (!type.GetInterfaces().Contains(typeof(IPlugin)))
                {
                    continue;
                }

                if (!List.ContainsKey(type))
                {
                    List.Add(type, (IPlugin)Activator.CreateInstance(type));
                    var version = versionWrapper.GetVersion(dll);
                    reporter.Report($"Loaded plugin: '{type.FullName}', Version: '{version}'");
                }
                else
                {
                    reporter.Report($"Already loaded plugin with type '{type.FullName}'");
                }
            }
        }
Esempio n. 2
0
        public void LoadPlugin(string assemblyPath)
        {
            var path = _fileSystem.Path.GetFullPath(assemblyPath);
            var dll  = _assemblyWrapper.LoadFile(path);

            foreach (var type in _assemblyWrapper.GetExportedTypes(dll))
            {
                if (!type.GetInterfaces().Contains(typeof(IPlugin)))
                {
                    continue;
                }

                if (!List.ContainsKey(type))
                {
                    List.Add(type, (IPlugin)Activator.CreateInstance(type));

                    _reporter.Report($"\nLoaded plugin '{type.FullName}'\n");
                }
                else
                {
                    _reporter.Report($"\nAlready loaded plugin with type '{type.FullName}'\n");
                }
            }
        }