private bool LoadViaMetaProvider(IMetaProvider metaProvider, string name, FourPartVersion asmVersion, IHostApi request)
        {
            var found = false;

            var instance = metaProvider.CreateProvider(name);

            if (instance != null)
            {
                // check if it's a Package Provider
                if (typeof(IPackageProvider).CanDynamicCastFrom(instance))
                {
                    try {
                        var packageProvider = RegisterPackageProvider(instance.As <IPackageProvider>(), asmVersion, request);
                        if (packageProvider != null)
                        {
                            found = true;
                            packageProvider.ProviderPath = metaProvider.GetProviderPath(name);
                        }
                    } catch (Exception e) {
                        e.Dump();
                    }
                }

                // check if it's a Services Provider
                if (typeof(IArchiver).CanDynamicCastFrom(instance))
                {
                    try {
                        var archiver = RegisterArchiver(instance.As <IArchiver>(), asmVersion, request);
                        if (archiver != null)
                        {
                            found = true;
                            archiver.ProviderPath = metaProvider.GetProviderPath(name);
                        }
                    } catch (Exception e) {
                        e.Dump();
                    }
                }

                if (typeof(IDownloader).CanDynamicCastFrom(instance))
                {
                    try {
                        var downloader = RegisterDownloader(instance.As <IDownloader>(), asmVersion, request);
                        if (downloader != null)
                        {
                            found = true;
                            downloader.ProviderPath = metaProvider.GetProviderPath(name);
                        }
                    } catch (Exception e) {
                        e.Dump();
                    }
                }
            }
            return(found);
        }
        private bool LoadViaMetaProvider(IMetaProvider metaProvider, string name, FourPartVersion asmVersion, IHostApi request ) {
            var found = false;

            var instance = metaProvider.CreateProvider(name);
            if (instance != null) {
                // check if it's a Package Provider
                if (typeof (IPackageProvider).CanDynamicCastFrom(instance)) {
                    try {
                        var packageProvider = RegisterPackageProvider(instance.As<IPackageProvider>(), name, asmVersion, request);
                        if (packageProvider != null) {
                            found = true;
                            packageProvider.IsLoaded = true;
                            packageProvider.ProviderPath = metaProvider.GetProviderPath(name);
                        }
                    } catch (Exception e) {
                        e.Dump();
                    }
                }

                // check if it's a Services Provider
                if (typeof (IArchiver).CanDynamicCastFrom(instance)) {
                    try {
                        var archiver = RegisterArchiver(instance.As<IArchiver>(), asmVersion, request);
                        if (archiver != null) {
                            found = true;
                            archiver.ProviderPath = metaProvider.GetProviderPath(name);
                            archiver.IsLoaded = true;
                        }
                    } catch (Exception e) {
                        e.Dump();
                    }
                }

                if (typeof (IDownloader).CanDynamicCastFrom(instance)) {
                    try {
                        var downloader = RegisterDownloader(instance.As<IDownloader>(), asmVersion, request);
                        if (downloader != null) {
                            found = true;
                            downloader.ProviderPath = metaProvider.GetProviderPath(name);
                            downloader.IsLoaded = true;
                        }
                    } catch (Exception e) {
                        e.Dump();
                    }
                }
            }
            return found;
        }