internal InstallPackageCommand( ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IHttpClientEvents httpClientEvents, IProductUpdateService productUpdateService, IVsCommonOperations vsCommonOperations, IDeleteOnRestartManager deleteOnRestartManager, bool networkAvailable) : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager) { _productUpdateService = productUpdateService; _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; DependencyVersion = DependencyVersion.Lowest; if (networkAvailable) { _isNetworkAvailable = isNetworkAvailable(); } else { _isNetworkAvailable = false; } }
public GetPackageCommand(IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IPackageRepository recentPackagesRepository, IHttpClientEvents httpClientEvents, IProductUpdateService productUpdateService) : base(solutionManager, packageManagerFactory, httpClientEvents) { if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (recentPackagesRepository == null) { throw new ArgumentNullException("recentPackagesRepository"); } _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; _recentPackagesRepository = recentPackagesRepository; _productUpdateService = productUpdateService; }
internal PackageRestoreManager( DTE dte, ISolutionManager solutionManager, IFileSystemProvider fileSystemProvider, IPackageRepositoryFactory packageRepositoryFactory, IVsPackageSourceProvider packageSourceProvider, IVsPackageManagerFactory packageManagerFactory, IVsPackageInstallerEvents packageInstallerEvents, IPackageRepository localCacheRepository, IVsThreadedWaitDialogFactory waitDialogFactory, ISettings settings) { Debug.Assert(solutionManager != null); _dte = dte; _fileSystemProvider = fileSystemProvider; _solutionManager = solutionManager; _packageRepositoryFactory = packageRepositoryFactory; _packageSourceProvider = packageSourceProvider; _waitDialogFactory = waitDialogFactory; _packageManagerFactory = packageManagerFactory; _localCacheRepository = localCacheRepository; _settings = settings; _solutionManager.ProjectAdded += OnProjectAdded; _solutionManager.SolutionOpened += OnSolutionOpenedOrClosed; _solutionManager.SolutionClosed += OnSolutionOpenedOrClosed; packageInstallerEvents.PackageReferenceAdded += OnPackageReferenceAdded; }
public PackageSourcesOptionsControl(IVsPackageSourceProvider packageSourceProvider, IServiceProvider serviceProvider) { InitializeComponent(); _serviceProvider = serviceProvider; _packageSourceProvider = packageSourceProvider; SetupEventHandlers(); }
public FindPackageCommand(IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IHttpClientEvents httpClientEvents) : base(repositoryFactory, packageSourceProvider, solutionManager, packageManagerFactory, httpClientEvents, null) { }
public VsPackageManagerFactory(ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, IRecentPackageRepository recentPackagesRepository, VsPackageInstallerEvents packageEvents) : this(solutionManager, repositoryFactory, packageSourceProvider, fileSystemProvider, repositorySettings, recentPackagesRepository, packageEvents, MachineCache.Default) { }
public VsPackageManagerFactory(ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IVsFrameworkMultiTargeting frameworkMultiTargeting, IMachineWideSettings machineWideSettings) { if (solutionManager == null) { throw new ArgumentNullException("solutionManager"); } if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (fileSystemProvider == null) { throw new ArgumentNullException("fileSystemProvider"); } if (repositorySettings == null) { throw new ArgumentNullException("repositorySettings"); } if (packageEvents == null) { throw new ArgumentNullException("packageEvents"); } if (activePackageSourceRepository == null) { throw new ArgumentNullException("activePackageSourceRepository"); } _fileSystemProvider = fileSystemProvider; _repositorySettings = repositorySettings; _solutionManager = solutionManager; _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; _packageEvents = packageEvents; _activePackageSourceRepository = activePackageSourceRepository; _frameworkMultiTargeting = frameworkMultiTargeting; _machineWideSettings = machineWideSettings; _solutionManager.SolutionClosing += (sender, e) => { _repositoryInfo = null; }; }
public PackageInstallBaseCommand( IVsPackageSourceProvider packageSourceProvider, IPackageRepositoryFactory packageRepositoryFactory, SVsServiceProvider svcServiceProvider, IVsPackageManagerFactory packageManagerFactory, ISolutionManager solutionManager, IHttpClientEvents clientEvents) : base(packageSourceProvider, packageRepositoryFactory, svcServiceProvider, packageManagerFactory, solutionManager, clientEvents, PackageActionType.Install) { this.PackageSourceProvider = packageSourceProvider; }
protected PowerShellHost(string name, IRunspaceManager runspaceManager) { _runspaceManager = runspaceManager; // TODO: Take these as ctor arguments _packageSourceProvider = ServiceLocator.GetInstance<IVsPackageSourceProvider>(); _solutionManager = ServiceLocator.GetInstance<ISolutionManager>(); _name = name; IsCommandEnabled = true; }
public VsSourceRepositoryManager(IVsPackageSourceProvider sourceProvider, IPackageRepositoryFactory repoFactory) { _sourceProvider = sourceProvider; _sourceProvider.PackageSourcesSaved += (sender, e) => { if (PackageSourcesChanged != null) { PackageSourcesChanged(this, EventArgs.Empty); } }; _repoFactory = repoFactory; }
public VsPackageManagerFactory(ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, IRecentPackageRepository recentPackagesRepository, VsPackageInstallerEvents packageEvents, IPackageRepository cacheRepository) { if (solutionManager == null) { throw new ArgumentNullException("solutionManager"); } if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } if (fileSystemProvider == null) { throw new ArgumentNullException("fileSystemProvider"); } if (repositorySettings == null) { throw new ArgumentNullException("repositorySettings"); } if (cacheRepository == null) { throw new ArgumentNullException("cacheRepository"); } if (packageEvents == null) { throw new ArgumentNullException("packageEvents"); } _fileSystemProvider = fileSystemProvider; _repositorySettings = repositorySettings; _solutionManager = solutionManager; _repositoryFactory = repositoryFactory; _recentPackageRepository = recentPackagesRepository; _packageSourceProvider = packageSourceProvider; _packageEvents = packageEvents; _cacheRepository = cacheRepository; _solutionManager.SolutionClosing += (sender, e) => { _repositoryInfo = null; }; }
public UpdatePackageCommand(ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IHttpClientEvents httpClientEvents, IProductUpdateService productUpdateService, IVsCommonOperations vsCommonOperations) : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations) { _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; _productUpdateService = productUpdateService; }
public PackageSourcesOptionsControl(IVsPackageSourceProvider packageSourceProvider, IServiceProvider serviceProvider) { InitializeComponent(); if (!VsVersionHelper.IsVisualStudio2010) { MoveUpButton.ImageList = MoveDownButton.ImageList = removeButton.ImageList = imageList2; MoveUpButton.Padding = MoveDownButton.Padding = removeButton.Padding = new Padding(3); } _serviceProvider = serviceProvider; _packageSourceProvider = packageSourceProvider; SetupEventHandlers(); }
public PackageActionBaseCommand( IVsPackageSourceProvider packageSourceProvider, IPackageRepositoryFactory packageRepositoryFactory, SVsServiceProvider svcServiceProvider, IVsPackageManagerFactory packageManagerFactory, ISolutionManager solutionManager, IHttpClientEvents clientEvents, PackageActionType actionType) : base(packageSourceProvider, packageRepositoryFactory, svcServiceProvider, packageManagerFactory, solutionManager, clientEvents) { _actionType = actionType; _vsCommonOperations = ServiceLocator.GetInstance<IVsCommonOperations>(); _deleteOnRestartManager = ServiceLocator.GetInstance<IDeleteOnRestartManager>(); }
public VsPackageSourceRepository(IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider) { if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; }
public InstallPackageCommand( ISolutionManager solutionManager, IVsPackageManagerFactory packageManagerFactory, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IHttpClientEvents httpClientEvents, IProductUpdateService productUpdateService, IVsCommonOperations vsCommonOperations, IDeleteOnRestartManager deleteOnRestartManager) : base(solutionManager, packageManagerFactory, httpClientEvents, vsCommonOperations, deleteOnRestartManager) { _productUpdateService = productUpdateService; _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; }
public static bool IsHttpSource(string source, IVsPackageSourceProvider packageSourceProvider) { if (source != null) { if (UriHelper.IsHttpSource(source)) { return true; } var packageSource = packageSourceProvider.GetEnabledPackageSourcesWithAggregate() .FirstOrDefault(p => p.Name.Equals(source, StringComparison.CurrentCultureIgnoreCase)); return (packageSource != null) ? UriHelper.IsHttpSource(packageSource.Source) : false; } return IsHttpSource(packageSourceProvider); }
public OpenPackagePageCommand(IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider) : base(null, null, null) { if (repositoryFactory == null) { throw new ArgumentNullException("repositoryFactory"); } if (packageSourceProvider == null) { throw new ArgumentNullException("packageSourceProvider"); } _repositoryFactory = repositoryFactory; _packageSourceProvider = packageSourceProvider; }
public static bool IsHttpSource(IVsPackageSourceProvider packageSourceProvider) { var activeSource = packageSourceProvider.ActivePackageSource; if (activeSource == null) { return false; } if (activeSource.IsAggregate()) { return packageSourceProvider.GetEnabledPackageSources().Any(s => UriHelper.IsHttpSource(s.Source)); } else { return UriHelper.IsHttpSource(activeSource.Source); } }
public VsPackageManagerFactory(ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IMachineWideSettings machineWideSettings) : this(solutionManager, repositoryFactory, packageSourceProvider, fileSystemProvider, repositorySettings, packageEvents, activePackageSourceRepository, ServiceLocator.GetGlobalService<SVsFrameworkMultiTargeting, IVsFrameworkMultiTargeting>(), machineWideSettings) { }
public PackageRestoreManager( ISolutionManager solutionManager, IFileSystemProvider fileSystemProvider, IPackageRepositoryFactory packageRepositoryFactory, IVsPackageManagerFactory packageManagerFactory, IVsPackageSourceProvider packageSourceProvider, IVsPackageInstallerEvents packageInstallerEvents, ISettings settings) : this(ServiceLocator.GetInstance<DTE>(), solutionManager, fileSystemProvider, packageRepositoryFactory, packageSourceProvider, packageManagerFactory, packageInstallerEvents, MachineCache.Default, ServiceLocator.GetGlobalService<SVsThreadedWaitDialogFactory, IVsThreadedWaitDialogFactory>(), settings) { }
public static bool IsHttpSource(IVsPackageSourceProvider packageSourceProvider) { var activeSource = packageSourceProvider.ActivePackageSource; if (activeSource == null) { return false; } if (activeSource.IsAggregate()) { return packageSourceProvider.GetEnabledPackageSources().Any(s => IsHttpSource(s.Source)); } // For API V3, the source could be a local .json file. else if (activeSource.Source.EndsWith(".json", StringComparison.OrdinalIgnoreCase)) { return true; } else { return IsHttpSource(activeSource.Source); } }
public PackageSourcesOptionsControl(IVsPackageSourceProvider packageSourceProvider, IServiceProvider serviceProvider) { InitializeComponent(); if (!VsVersionHelper.IsVisualStudio2010) { // update the button icons to use grayscale versions foreach (Control child in tableLayoutPanel2.Controls) { var button = child as Button; if (button != null) { button.ImageList = imageList2; button.Padding = new Padding(3); } } } _serviceProvider = serviceProvider; _packageSourceProvider = packageSourceProvider; SetupEventHandlers(); }
private void StartWorker() { var componentModel = _workspace.GetVsService<SComponentModel, IComponentModel>(); _packageInstallerServices = componentModel.GetExtensions<IVsPackageInstallerServices>().FirstOrDefault(); _packageInstaller = componentModel.GetExtensions<IVsPackageInstaller>().FirstOrDefault(); _packageUninstaller = componentModel.GetExtensions<IVsPackageUninstaller>().FirstOrDefault(); _packageSourceProvider = componentModel.GetExtensions<IVsPackageSourceProvider>().FirstOrDefault(); if (!this.IsEnabled) { return; } // Start listening to workspace changes. _workspace.WorkspaceChanged += OnWorkspaceChanged; _packageSourceProvider.SourcesChanged += OnSourceProviderSourcesChanged; OnSourceProviderSourcesChanged(null, EventArgs.Empty); }
public IEnumerable <KeyValuePair <string, string> > GetSources(bool includeUnOfficial, bool includeDisabled) { IVsPackageSourceProvider packageSourceProvider = VisualStudioObjectProviders.GetComponentModelService <IVsPackageSourceProvider>(); return(packageSourceProvider.GetSources(includeUnOfficial, includeDisabled)); }
public static bool IsAnySourceAvailable(IVsPackageSourceProvider packageSourceProvider, bool checkHttp) { //If any of the enabled sources is http, return true if (checkHttp) { bool isHttpSource; isHttpSource = UriHelper.IsHttpSource(packageSourceProvider); if (isHttpSource) { return true; } } if (packageSourceProvider != null) { //If any of the active sources is UNC share or local folder and is available, return true IEnumerable<PackageSource> sources = null; PackageSource activeSource = packageSourceProvider.ActivePackageSource; if (activeSource.IsAggregate()) { sources = packageSourceProvider.GetEnabledPackageSources(); foreach (PackageSource s in sources) { if (IsLocal(s.Source) || IsUNC(s.Source)) return true; } } else { if (IsLocal(activeSource.Source) || IsUNC(activeSource.Source)) return true; } } //If none of the above matched, return false return false; }
private PackageRestoreManager CreateInstance( DTE dte = null, ISolutionManager solutionManager = null, IFileSystemProvider fileSystemProvider = null, IPackageRepositoryFactory packageRepositoryFactory = null, IVsThreadedWaitDialogFactory waitDialogFactory = null, IVsPackageManagerFactory packageManagerFactory = null, IPackageRepository localCache = null, IVsPackageSourceProvider packageSourceProvider = null, ISettings settings = null) { if (dte == null) { dte = new Mock<DTE>().Object; } if (solutionManager == null) { solutionManager = new Mock<ISolutionManager>().Object; } if (fileSystemProvider == null) { fileSystemProvider = new Mock<IFileSystemProvider>().Object; } if (packageRepositoryFactory == null) { packageRepositoryFactory = new Mock<IPackageRepositoryFactory>().Object; } if (waitDialogFactory == null) { var mockWaitDialogFactory = new Mock<IVsThreadedWaitDialogFactory>(); var mockWaitDialog = new Mock<IVsThreadedWaitDialog2>(); mockWaitDialog.Setup(p => p.StartWaitDialog( It.IsAny<string>(), It.IsAny<string>(), It.IsAny<string>(), It.IsAny<object>(), It.IsAny<string>(), It.IsAny<int>(), It.IsAny<bool>(), It.IsAny<bool>())); int canceled; mockWaitDialog.Setup(p => p.EndWaitDialog(out canceled)).Returns(0); var waitDialog = mockWaitDialog.Object; mockWaitDialogFactory.Setup(p => p.CreateInstance(out waitDialog)).Returns(0); waitDialogFactory = mockWaitDialogFactory.Object; } if (packageManagerFactory == null) { packageManagerFactory = new Mock<IVsPackageManagerFactory>().Object; } if (localCache == null) { localCache = new MockPackageRepository(); } if (packageSourceProvider == null) { packageSourceProvider = new Mock<IVsPackageSourceProvider>().Object; } if (settings == null) { settings = Mock.Of<ISettings>(); } return new PackageRestoreManager( dte, solutionManager, fileSystemProvider, packageRepositoryFactory, packageSourceProvider, packageManagerFactory, new VsPackageInstallerEvents(), localCache, waitDialogFactory, settings); }
public TestVsPackageManagerFactory( ISolutionManager solutionManager, IPackageRepositoryFactory repositoryFactory, IVsPackageSourceProvider packageSourceProvider, IFileSystemProvider fileSystemProvider, IRepositorySettings repositorySettings, VsPackageInstallerEvents packageEvents, IPackageRepository activePackageSourceRepository, IVsFrameworkMultiTargeting frameworkMultiTargeting, IMachineWideSettings machineWideSettings) : base(solutionManager, repositoryFactory, packageSourceProvider, fileSystemProvider, repositorySettings, packageEvents, activePackageSourceRepository, frameworkMultiTargeting, machineWideSettings) { }
private PackageRestoreManager CreateInstance( DTE dte = null, ISolutionManager solutionManager = null, IFileSystemProvider fileSystemProvider = null, IPackageRepositoryFactory packageRepositoryFactory = null, IVsThreadedWaitDialogFactory waitDialogFactory = null, IVsPackageManagerFactory packageManagerFactory = null, IPackageRepository localCache = null, IVsPackageSourceProvider packageSourceProvider = null, ISettings settings = null) { if (dte == null) { dte = new Mock <DTE>().Object; } if (solutionManager == null) { solutionManager = new Mock <ISolutionManager>().Object; } if (fileSystemProvider == null) { fileSystemProvider = new Mock <IFileSystemProvider>().Object; } if (packageRepositoryFactory == null) { packageRepositoryFactory = new Mock <IPackageRepositoryFactory>().Object; } if (waitDialogFactory == null) { var mockWaitDialogFactory = new Mock <IVsThreadedWaitDialogFactory>(); var mockWaitDialog = new Mock <IVsThreadedWaitDialog2>(); mockWaitDialog.Setup(p => p.StartWaitDialog( It.IsAny <string>(), It.IsAny <string>(), It.IsAny <string>(), It.IsAny <object>(), It.IsAny <string>(), It.IsAny <int>(), It.IsAny <bool>(), It.IsAny <bool>())); int canceled; mockWaitDialog.Setup(p => p.EndWaitDialog(out canceled)).Returns(0); var waitDialog = mockWaitDialog.Object; mockWaitDialogFactory.Setup(p => p.CreateInstance(out waitDialog)).Returns(0); waitDialogFactory = mockWaitDialogFactory.Object; } if (packageManagerFactory == null) { packageManagerFactory = new Mock <IVsPackageManagerFactory>().Object; } if (localCache == null) { localCache = new MockPackageRepository(); } if (packageSourceProvider == null) { packageSourceProvider = new Mock <IVsPackageSourceProvider>().Object; } if (settings == null) { settings = Mock.Of <ISettings>(); } return(new PackageRestoreManager( dte, solutionManager, fileSystemProvider, packageRepositoryFactory, packageSourceProvider, packageManagerFactory, new VsPackageInstallerEvents(), localCache, waitDialogFactory, settings)); }
public PackageServicesProxy(IVsPackageInstallerServices packageInstallerServices, IVsPackageInstaller packageInstaller, IVsPackageUninstaller packageUninstaller, IVsPackageSourceProvider packageSourceProvider) { _packageInstallerServices = packageInstallerServices; _packageInstaller = packageInstaller; _packageUninstaller = packageUninstaller; _packageSourceProvider = packageSourceProvider; }
public static bool IsAnySourceLocal(IVsPackageSourceProvider packageSourceProvider, out string localSource) { localSource = string.Empty; if (packageSourceProvider != null) { //If any of the active sources is local folder and is available, return true IEnumerable<PackageSource> sources = null; PackageSource activeSource = packageSourceProvider.ActivePackageSource; if (activeSource.IsAggregate()) { sources = packageSourceProvider.GetEnabledPackageSources(); foreach (PackageSource s in sources) { if (IsLocal(s.Source)) { localSource = s.Source; return true; } } } else { if (IsLocal(activeSource.Source)) return true; } } return false; }