Пример #1
0
        public virtual async Task <ICollection <Assembly> > LoadPluginAssembliesAsync()
        {
            var assemblies = new List <Assembly>();

            foreach (var nupkgFile in Directory.GetFiles(m_NuGetPackageManager.PackagesDirectory, "*.nupkg", SearchOption.AllDirectories))
            {
                var nupkgAssemblies = await m_NuGetPackageManager.LoadAssembliesFromNuGetPackageAsync(nupkgFile);

                assemblies.AddRange(nupkgAssemblies.Where(d => d.GetCustomAttribute <PluginMetadataAttribute>() != null));
            }

            return(assemblies);
        }
        public virtual async Task <ICollection <Assembly> > LoadPluginAssembliesAsync()
        {
            var assemblies = new List <Assembly>();

            foreach (var nupkgFile in Directory.GetFiles(m_NuGetPackageManager.PackagesDirectory, "*.nupkg",
                                                         SearchOption.AllDirectories))
            {
                try
                {
                    var nupkgAssemblies = await m_NuGetPackageManager.LoadAssembliesFromNuGetPackageAsync(nupkgFile);

                    assemblies.AddRange(nupkgAssemblies.Where(d =>
                                                              d.GetCustomAttribute <PluginMetadataAttribute>() != null));
                }
                catch (Exception ex)
                {
                    m_NuGetPackageManager.Logger.LogError($"Failed to load assemblies from nuget package: {nupkgFile}");
                    m_NuGetPackageManager.Logger.LogError(ex.ToString());
                }
            }

            return(assemblies);
        }
Пример #3
0
        private Task <IEnumerable <Assembly> > LoadPackageAsync(NuGetPackageManager packageManager, PackageIdentity identity)
        {
            var pkg = packageManager.GetNugetPackageFile(identity);

            return(packageManager.LoadAssembliesFromNuGetPackageAsync(pkg));
        }