public ExplorerTopBarViewModel(ExplorerSettingsContainer settings, ITypeFactory typeFactory, IUIVisualizerService uIVisualizerService, INuGetConfigurationService configurationService, INuGetCacheManager nuGetCacheManager, IPleaseWaitService pleaseWaitService, IMessageService messageService, IMessageMediator messageMediator) { Argument.IsNotNull(() => typeFactory); Argument.IsNotNull(() => uIVisualizerService); Argument.IsNotNull(() => configurationService); Argument.IsNotNull(() => settings); Argument.IsNotNull(() => nuGetCacheManager); Argument.IsNotNull(() => pleaseWaitService); Argument.IsNotNull(() => messageService); Argument.IsNotNull(() => messageMediator); _typeFactory = typeFactory; _uIVisualizerService = uIVisualizerService; _configurationService = configurationService; _nuGetCacheManager = nuGetCacheManager; _pleaseWaitService = pleaseWaitService; _messageService = messageService; _messageMediator = messageMediator; Settings = settings; Title = "Manage NuGet Packages"; CommandInitialize(); }
public PackageInstallationService(IServiceLocator serviceLocator, ITypeFactory typeFactory, IFrameworkNameProvider frameworkNameProvider, ISourceRepositoryProvider sourceRepositoryProvider, INuGetProjectConfigurationProvider nuGetProjectConfigurationProvider, INuGetProjectContextProvider nuGetProjectContextProvider, IDirectoryService directoryService, IFileService fileService, IApiPackageRegistry apiPackageRegistry, IFileSystemService fileSystemService, ILogger logger) { Argument.IsNotNull(() => frameworkNameProvider); Argument.IsNotNull(() => sourceRepositoryProvider); Argument.IsNotNull(() => nuGetProjectConfigurationProvider); Argument.IsNotNull(() => nuGetProjectContextProvider); Argument.IsNotNull(() => directoryService); Argument.IsNotNull(() => fileService); Argument.IsNotNull(() => apiPackageRegistry); Argument.IsNotNull(() => fileSystemService); Argument.IsNotNull(() => logger); _serviceLocator = serviceLocator; _typeFactory = typeFactory; _frameworkNameProvider = frameworkNameProvider; _sourceRepositoryProvider = sourceRepositoryProvider; _nuGetProjectConfigurationProvider = nuGetProjectConfigurationProvider; _nuGetProjectContextProvider = nuGetProjectContextProvider; _directoryService = directoryService; _fileService = fileService; _apiPackageRegistry = apiPackageRegistry; _fileSystemService = fileSystemService; _nugetLogger = logger; _nuGetCacheManager = new NuGetCacheManager(_directoryService, _fileService); if (serviceLocator.IsTypeRegistered <IDownloadingProgressTrackerService>()) { _downloadingProgressTrackerService = serviceLocator.ResolveType <IDownloadingProgressTrackerService>(); } _installerPathResolver = new VersionFolderPathResolver(DefaultNuGetFolders.GetGlobalPackagesFolder()); }
/// <summary> /// Executes the command. /// </summary> public override void ExecuteCommand() { //Probably need some better return code logic here... if (Arguments[0] == null) { return; } try { if (Source.Count == 1 && !NoFeedSpecificCache && !NoCache) { _cacheManager = new NuGetCacheManager(Console); _cacheManager.SetFeedSpecificCacheDirectory(_sources[0]); } if (!NoCache) { if (_cacheRepository == null) { _cacheRepository = MachineCache.Default; } } //TODO This needs injecting.... if (_packageCache == null) { _packageCache = new MemoryBasedPackageCache(Console); } _repository = GetRepository(); _packageResolutionManager = new PackageResolutionManager(Console, Latest, _packageCache); //HACK need to inject somehow... _packageResolutionManager = _packageResolutionManager ?? new PackageResolutionManager(Console, Latest, new MemoryBasedPackageCache(Console)); //Working on a package.config if (string.IsNullOrEmpty(_baseDirectory)) { _baseDirectory = Environment.CurrentDirectory; } var target = Arguments[0] == Path.GetFullPath(Arguments[0]) ? Arguments[0] : Path.GetFullPath(Path.Combine(_baseDirectory, Arguments[0])); if (Path.GetFileName(target).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { OutputFileSystem = CreateFileSystem(Path.GetPathRoot(target)); GetByPackagesConfig(OutputFileSystem, target); } else { OutputFileSystem = CreateFileSystem(Directory.GetParent(target).FullName); GetByDirectoryPath(OutputFileSystem, target); } } catch (Exception e) { //HACK big catch here, but if anything goes wrong we want to log it and ensure a non-zero exit code... throw new CommandLineException(String.Format("GET Failed: {0}", e.Message), e); } }
public ExplorerPageViewModel(ExplorerPage page, IPackageLoaderService packagesLoaderService, IModelProvider <ExplorerSettingsContainer> settingsProvider, IPackageMetadataMediaDownloadService packageMetadataMediaDownloadService, INuGetFeedVerificationService nuGetFeedVerificationService, ICommandManager commandManager, IDispatcherService dispatcherService, IRepositoryContextService repositoryService, ITypeFactory typeFactory, IDefferedPackageLoaderService defferedPackageLoaderService, IPackageOperationContextService packageOperationContextService, INuGetCacheManager nuGetCacheManager, INuGetConfigurationService nuGetConfigurationService, IDispatcherProviderService dispatcherProviderService) { Argument.IsNotNull(() => packagesLoaderService); Argument.IsNotNull(() => settingsProvider); Argument.IsNotNull(() => packageMetadataMediaDownloadService); Argument.IsNotNull(() => commandManager); Argument.IsNotNull(() => nuGetFeedVerificationService); Argument.IsNotNull(() => dispatcherService); Argument.IsNotNull(() => repositoryService); Argument.IsNotNull(() => typeFactory); Argument.IsNotNull(() => defferedPackageLoaderService); Argument.IsNotNull(() => packageOperationContextService); Argument.IsNotNull(() => nuGetCacheManager); Argument.IsNotNull(() => nuGetConfigurationService); Argument.IsNotNull(() => dispatcherProviderService); _dispatcherService = dispatcherService; _packageMetadataMediaDownloadService = packageMetadataMediaDownloadService; _nuGetFeedVerificationService = nuGetFeedVerificationService; _repositoryService = repositoryService; _defferedPackageLoaderService = defferedPackageLoaderService; _packageOperationContextService = packageOperationContextService; _typeFactory = typeFactory; _packagesLoaderService = packagesLoaderService; _nuGetCacheManager = nuGetCacheManager; _nuGetConfigurationService = nuGetConfigurationService; _dispatcherProviderService = dispatcherProviderService; Settings = settingsProvider.Model; LoadNextPackagePage = new TaskCommand(LoadNextPackagePageExecuteAsync); CancelPageLoading = new TaskCommand(CancelPageLoadingExecuteAsync); RefreshCurrentPage = new TaskCommand(RefreshCurrentPageExecuteAsync); commandManager.RegisterCommand(nameof(RefreshCurrentPage), RefreshCurrentPage, this); Title = page.Parameters.Tab.Name; _initialSearchParams = page.Parameters.InitialSearchParameters; //if null, standard Settings will not be overriden if (Title != "Browse") { #pragma warning disable IDISP004 // Don't ignore created IDisposable. _packagesLoaderService = this.GetServiceLocator().ResolveType <IPackageLoaderService>(Title); #pragma warning restore IDISP004 // Don't ignore created IDisposable. } if (!Enum.TryParse(Title, out _pageType)) { Log.Error("Unrecognized page type"); } CanBatchProjectActions = _pageType != MetadataOrigin.Installed; Page = page; }
/// <summary> /// Executes the command. /// </summary> public override void ExecuteCommand() { //Probably need some better return code logic here... if (Arguments[0] == null) return; try { if (Source.Count == 1 && !NoFeedSpecificCache && !NoCache) { _cacheManager = new NuGetCacheManager(Console); _cacheManager.SetFeedSpecificCacheDirectory(_sources[0]); } if (!NoCache) if (_cacheRepository == null) _cacheRepository = MachineCache.Default; //TODO This needs injecting.... if (_packageCache == null) _packageCache = new MemoryBasedPackageCache(Console); _repository = GetRepository(); _packageResolutionManager = new PackageResolutionManager(Console, Latest, _packageCache); //HACK need to inject somehow... _packageResolutionManager = _packageResolutionManager ?? new PackageResolutionManager(Console, Latest, new MemoryBasedPackageCache(Console)); //Working on a package.config if (string.IsNullOrEmpty(_baseDirectory)) _baseDirectory = Environment.CurrentDirectory; var target = Arguments[0] == Path.GetFullPath(Arguments[0]) ? Arguments[0] : Path.GetFullPath(Path.Combine(_baseDirectory, Arguments[0])); if (Path.GetFileName(target).Equals(Constants.PackageReferenceFile, StringComparison.OrdinalIgnoreCase)) { OutputFileSystem = CreateFileSystem(Path.GetPathRoot(target)); GetByPackagesConfig(OutputFileSystem, target); } else { OutputFileSystem = CreateFileSystem(Directory.GetParent(target).FullName); GetByDirectoryPath(OutputFileSystem, target); } } catch (Exception e) { //HACK big catch here, but if anything goes wrong we want to log it and ensure a non-zero exit code... throw new CommandLineException(String.Format("GET Failed: {0}",e.Message),e); } }