コード例 #1
0
 /// <summary>
 /// Robert Forbes
 /// 2017/02/02
 ///
 /// Constructor for the window
 /// </summary>
 /// <param name="orderId">The orderID that the packages should relate to</param>
 public frmProductOrderPackages(int orderId)
 {
     _orderId        = orderId;
     _packageManager = new PackageManager();
     _orderManager   = new ProductOrderManager();
     InitializeComponent();
 }
コード例 #2
0
        /// <summary>
        /// Creates a new <see cref="SelectionCandidate"/> provider.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        /// <param name="languages">The preferred languages for the implementation.</param>
        public SelectionCandidateProvider([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, [NotNull] LanguageSet languages)
        {
            #region Sanity checks
            if (config == null)
            {
                throw new ArgumentNullException(nameof(config));
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException(nameof(feedManager));
            }
            if (store == null)
            {
                throw new ArgumentNullException(nameof(store));
            }
            if (packageManager == null)
            {
                throw new ArgumentNullException(nameof(packageManager));
            }
            if (languages == null)
            {
                throw new ArgumentNullException(nameof(languages));
            }
            #endregion

            _config         = config;
            _feedManager    = feedManager;
            _isCached       = BuildCacheChecker(store);
            _packageManager = packageManager;
            _comparer       = new TransparentCache <FeedUri, SelectionCandidateComparer>(id => new SelectionCandidateComparer(config, _isCached, _interfacePreferences[id].StabilityPolicy, languages));
        }
コード例 #3
0
        /// <summary>
        /// Creates a new simple solver.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        /// <param name="handler">A callback object used when the the user needs to be asked questions or informed about download and IO tasks.</param>
        public BacktrackingSolver([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager, [NotNull] ITaskHandler handler)
        {
            #region Sanity checks
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException("feedManager");
            }
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }
            if (handler == null)
            {
                throw new ArgumentNullException("handler");
            }
            #endregion

            _config         = config;
            _store          = store;
            _packageManager = packageManager;
            _feedManager    = feedManager;
            _handler        = handler;
        }
コード例 #4
0
ファイル: VsPackageManagerUI.cs プロジェクト: jsschultz/PTVS
        public async Task<bool> ShouldElevateAsync(IPackageManager sender, string operation) {
            if (_alwaysElevate) {
                return true;
            }

            return ShouldElevate(_site, sender.Factory.Configuration, operation);
        }
コード例 #5
0
ファイル: VsPackageManagerUI.cs プロジェクト: JoshVarty/PTVS
 public void OnOperationFinished(IPackageManager sender, string operation, bool success)
 {
     if (_options.ShowOutputWindowForPackageInstallation)
     {
         _outputWindow.ShowAndActivate();
     }
 }
コード例 #6
0
ファイル: VsPackageManagerUI.cs プロジェクト: JoshVarty/PTVS
 public void OnOperationStarted(IPackageManager sender, string operation)
 {
     if (_options.ShowOutputWindowForPackageInstallation)
     {
         _outputWindow.ShowAndActivate();
     }
 }
コード例 #7
0
 //damcomment
 public UserController(IUserManager _userMngr, IProjectManager _projectMngr, IPackageManager _packageMngr, IWebHostEnvironment environment)
 {
     hostingEnvironment = environment;
     userMngr           = _userMngr;
     projectMngr        = _projectMngr;
     packageMngr        = _packageMngr;
 }
コード例 #8
0
        public void FetchPackage_VersionSpecified_CorrectVersionSelected()
        {
            string          sourceNuGetRoot = TestUtils.CreateTestDirectory(this.TestContext, ".nuget.source");
            string          targetNuGetRoot = TestUtils.CreateTestDirectory(this.TestContext, ".nuget.target");
            IPackageManager mgr             = CreatePackageManager(sourceNuGetRoot);

            AddPackage(mgr, "package.id.1", "0.8.0");
            AddPackage(mgr, "package.id.1", "1.0.0-rc1");
            AddPackage(mgr, "package.id.1", "2.0.0");

            AddPackage(mgr, "dummy.package.1", "0.8.0");

            AddPackage(mgr, "package.id.1", "0.9.0");
            AddPackage(mgr, "package.id.1", "1.0.0");

            NuGetPackageHandler handler = new NuGetPackageHandler(sourceNuGetRoot, new TestLogger());

            // Check for specific versions
            IPackage actual = handler.FetchPackage("package.id.1", new SemanticVersion("0.8.0"), targetNuGetRoot);

            AssertExpectedPackage(actual, "package.id.1", "0.8.0");

            actual = handler.FetchPackage("package.id.1", new SemanticVersion("1.0.0-rc1"), targetNuGetRoot);
            AssertExpectedPackage(actual, "package.id.1", "1.0.0-rc1");

            actual = handler.FetchPackage("package.id.1", new SemanticVersion("2.0.0"), targetNuGetRoot);
            AssertExpectedPackage(actual, "package.id.1", "2.0.0");
        }
コード例 #9
0
        public PackageService(IPackageManager packageManager, INotifier notifier)
        {
            _packageManager = packageManager;
            _notifier = notifier;

            T = NullLocalizer.Instance;
        }
コード例 #10
0
        /// <summary>
        /// Creates a new <see cref="SelectionCandidate"/> provider.
        /// </summary>
        /// <param name="config">User settings controlling network behaviour, solving, etc.</param>
        /// <param name="feedManager">Provides access to remote and local <see cref="Feed"/>s. Handles downloading, signature verification and caching.</param>
        /// <param name="store">Used to check which <see cref="Implementation"/>s are already cached.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        public SelectionCandidateProvider([NotNull] Config config, [NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager)
        {
            #region Sanity checks
            if (config == null)
            {
                throw new ArgumentNullException("config");
            }
            if (feedManager == null)
            {
                throw new ArgumentNullException("feedManager");
            }
            if (store == null)
            {
                throw new ArgumentNullException("store");
            }
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }
            #endregion

            _config         = config;
            _isCached       = BuildCacheChecker(store);
            _packageManager = packageManager;
            _comparer       = new TransparentCache <FeedUri, SelectionCandidateComparer>(id => new SelectionCandidateComparer(config, _isCached, _interfacePreferences[id].StabilityPolicy, CultureInfo.CurrentUICulture));
            _feeds          = new TransparentCache <FeedUri, Feed>(feedManager.GetFeed);
        }
コード例 #11
0
        public PackageManagerTest()
        {
            IMapper mapper = AutoMapperConfiguration.Configure().CreateMapper();

            _mockPackageService = new Mock <IPackageService>();
            _packageManager     = new PackageManager(_mockPackageService.Object, mapper);
        }
コード例 #12
0
ファイル: ActionsViewModel.cs プロジェクト: henjuv/Mg2
        public ActionsViewModel(IPackageManager packageManager, List<PackageAction> actions)
        {
            DisplayName = "";

            List = new ObservableCollection<PackageAction>(actions);
            List.CollectionChanged += (sender, args) => RaisePropertyChanged(() => OrderedList);

            var eventHandler = new PropertyChangedEventHandler((sender, args) =>
            {
                if (List.Any(n => n.Progress != 100))
                    return;

                CanClose = true;
                RaisePropertyChanged(() => CanClose);

                // TODO: if autoclose in options: TryClose(true)
            });

            actions.ForEach(n => n.SubscribeToPropertyChanged(eventHandler));

            foreach (var action in actions)
            {
                action.ActionAdded += a => DispatcherHelper.CheckBeginInvokeOnUI(() => List.Add(a));
            }

            CloseCommand = new RelayCommand(() => TryClose(true));

            packageManager.Execute(actions.ToArray());
        }
コード例 #13
0
 public StartCommand(IActionDispatch actionDispatch, IPackageManager packageManager,
                     IPackageUrlParser packageUrlParser)
 {
     this.m_ActionDispatch = actionDispatch;
     this.m_PackageManager = packageManager;
     _packageUrlParser     = packageUrlParser;
 }
コード例 #14
0
        bool TryInitialize()
        {
            try
            {
                _dte = SiteManager.GetGlobalService<DTE>();
                _running = _dte != null;
            }
            catch
            {
                _running = false;
            }
            if (!_running) return false;
            // TODO:  seen in the wild, _dte.Solution is null (?), need to schedule and restart initialization for those scenarios.
            _solution = new DteSolution(_dte.Solution);
            _solution.ProjectChanged += HandleProjectChange;
            var environment = ServiceLocator.GetService<IEnvironment>();
            _packageManager = ServiceLocator.GetService<IPackageManager>();

            _assembliesChanged = new EventWaitHandle(false, EventResetMode.AutoReset, System.Diagnostics.Process.GetCurrentProcess().Id + ASSEMBLY_NOTIFY);
            _rootDirectory = environment.DescriptorFile.Parent;
            _projectRepository = environment.ProjectRepository;
            RegisterFileListener();
            RefreshProjects();
            _timer = new Timer(_ => RefreshProjects(), null, Timeout.Infinite, Timeout.Infinite);
            return true;
        }
コード例 #15
0
        public static void RegisterAutoLoadPackages(this IPackageManager manager, IMafPackage package, Action loadAction)
        {
            if (package.LoadOption != PackageLoadOption.OnContextActivated)
            {
                return;
            }

            var attributes = package.GetType().GetAttributes <PackageAutoLoadAttribute>(true);

            foreach (var attribute in attributes)
            {
                var uiContext = UiContext.FromUiContextGuid(attribute.LoadGuid);
                if (Mapping.ContainsKey(attribute.LoadGuid))
                {
                    Mapping[attribute.LoadGuid].Add(package.Id);
                }
                else
                {
                    Mapping.Add(attribute.LoadGuid, new HashSet <Guid> {
                        package.Id
                    });
                }
                uiContext.WhenActivated(loadAction);
            }
        }
コード例 #16
0
        bool TryInitialize()
        {
            try
            {
                _dte     = SiteManager.GetGlobalService <DTE>();
                _running = _dte != null;
            }
            catch
            {
                _running = false;
            }
            if (!_running)
            {
                return(false);
            }
            // TODO:  seen in the wild, _dte.Solution is null (?), need to schedule and restart initialization for those scenarios.
            _solution = new DteSolution(_dte.Solution);
            _solution.ProjectChanged += HandleProjectChange;
            var environment = ServiceLocator.GetService <IEnvironment>();

            _packageManager = ServiceLocator.GetService <IPackageManager>();

            _assembliesChanged = new EventWaitHandle(false, EventResetMode.AutoReset, System.Diagnostics.Process.GetCurrentProcess().Id + ASSEMBLY_NOTIFY);
            _rootDirectory     = environment.DescriptorFile.Parent;
            _projectRepository = environment.ProjectRepository;
            RegisterFileListener();
            RefreshProjects();
            _timer = new Timer(_ => RefreshProjects(), null, Timeout.Infinite, Timeout.Infinite);
            return(true);
        }
コード例 #17
0
 public CellService(IClientManager clientManager, IUserManager userManager, IClientTypeManager typeManager, IPackageManager packageManager)
 {
     _clientManager  = clientManager;
     _userManager    = userManager;
     _typeManager    = typeManager;
     _packageManager = packageManager;
 }
コード例 #18
0
        private async Task <bool> HandleUpdate(
            ScheduledPackageUpdate update,
            IPackageManager packages
            )
        {
            bool shouldUpdate = false;

            switch (update.Milestone)
            {
            case PackageUpdateMilestone.StartOfWeek:
            case PackageUpdateMilestone.Dependencies:
                shouldUpdate = DateTime.UtcNow.Date >= update.Week.WeekStart;
                break;

            case PackageUpdateMilestone.EndOfWeek:
                shouldUpdate = DateTime.UtcNow.Date >= update.Week.WeekEnd;
                break;

            default: break;
            }

            if (!shouldUpdate)
            {
                return(false);
            }

            await packages.UpdatePackageAsync(update.Package, update.Week, update.Milestone);

            return(true);
        }
コード例 #19
0
 /// <summary>
 /// Robert Forbes
 /// Created: 2017/03/09
 ///
 /// Creates the window using the passed orderId
 /// </summary>
 /// <param name="orderId"></param>
 public frmCreateDeliveryForOrder(int orderId)
 {
     InitializeComponent();
     _orderId         = orderId;
     _packageManager  = new PackageManager();
     _deliveryManager = new DeliveryManager();
 }
コード例 #20
0
ファイル: TrashWorker.cs プロジェクト: rcarz/fusion
        /// <summary>
        /// Attempts to delete files and directories in the trash.
        /// </summary>
        /// <param name="pkgmgr">package manager reference</param>
        public static void Purge(IPackageManager pkgmgr)
        {
            List<string> deleted = new List<string>();

            foreach (string p in pkgmgr.Trash.OrderBy(i => i)) {
                try {
                    if (File.Exists(p))
                        File.Delete(p);
                    else if (Directory.Exists(p) && pkgmgr.CheckPathOwned(p)) {
                        /* this can be removed from the trash */
                    } else if (Directory.Exists(p) && Directory.GetFiles(p).Length > 0)
                        continue;
                    else if (Directory.Exists(p))
                        Directory.Delete(p);
                    else {
                        /* orphaned file? */
                    }

                    deleted.Add(p);
                } catch {
                    continue;
                }
            }

            pkgmgr.DeleteTrashItems(deleted.ToArray());
        }
コード例 #21
0
 public void OnOperationStarted(IPackageManager sender, string operation)
 {
     if (_showAndActiveOutputWindow)
     {
         _outputWindow.ShowAndActivate();
     }
 }
コード例 #22
0
ファイル: InterpretersNode.cs プロジェクト: PeezoSlug/PTVS
        public InterpretersNode(
            PythonProjectNode project,
            IPythonInterpreterFactory factory,
            bool isInterpreterReference,
            bool canDelete,
            bool isGlobalDefault = false,
            bool?canRemove       = null
            )
            : base(project, MakeElement(project))
        {
            ExcludeNodeFromScc = true;

            _interpreterService = project.Site.GetComponentModel().GetService <IInterpreterRegistryService>();
            _factory            = factory;
            _isReference        = isInterpreterReference;
            _canDelete          = canDelete;
            _isGlobalDefault    = isGlobalDefault;
            _canRemove          = canRemove.HasValue ? canRemove.Value : !isGlobalDefault;
            _captionSuffix      = isGlobalDefault ? Strings.GlobalDefaultSuffix : "";

            var interpreterOpts = project.Site.GetComponentModel().GetService <IInterpreterOptionsService>();

            _packageManager = interpreterOpts?.GetPackageManagers(factory).FirstOrDefault();
            if (_packageManager != null)
            {
                _packageManager.InstalledPackagesChanged += InstalledPackagesChanged;
                _packageManager.EnableNotifications();
            }
        }
コード例 #23
0
        public IEnumerable <IPackageManager> GetPackageManagers(IPythonInterpreterFactory factory)
        {
            if (ExperimentalOptions.UseCondaPackageManager)
            {
                if (!Directory.Exists(Path.Combine(factory.Configuration.PrefixPath, "conda-meta")))
                {
                    yield break;
                }

                var condaPath = CondaUtils.GetCondaExecutablePath(factory.Configuration.PrefixPath);
                if (string.IsNullOrEmpty(condaPath))
                {
                    // conda.bat is no longer present in a conda 4.4 environment,
                    // so find a global conda.exe to use.
                    condaPath = _latestCondaExe.Value;
                }

                if (string.IsNullOrEmpty(condaPath))
                {
                    yield break;
                }

                IPackageManager pm = null;
                try {
                    pm = new CondaPackageManager(factory, condaPath);
                } catch (NotSupportedException) {
                    pm = null;
                }
                if (pm != null)
                {
                    yield return(pm);
                }
            }
        }
コード例 #24
0
 public DefaultModuleManager(IPackageRepository packageRepository, ICmsConfiguration cmsConfiguration)
 {
     this.packageRepository = PackageRepositoryFactory.Default.CreateRepository(cmsConfiguration.ModuleGallery.FeedUrl);
     this.packageManager = new PackageManager(
         this.packageRepository,
         cmsConfiguration.WorkingDirectoryRootPath) { Logger = null };
 }
コード例 #25
0
 public void OnOperationFinished(IPackageManager sender, string operation, bool success)
 {
     if (_showAndActiveOutputWindow)
     {
         _outputWindow.ShowAndActivate();
     }
 }
コード例 #26
0
ファイル: NuGetResolver.cs プロジェクト: masums/Dapplo.Addons
        /// <summary>
        ///     Retrieve the assembly for the supplied package, or null
        /// </summary>
        private static Assembly ReturnAssemblyFromRepository(IPackageManager packageManager, AssemblyName assemblyName)
        {
            if (assemblyName == null)
            {
                return(null);
            }
            var basePath = Path.GetFullPath(packageManager.LocalRepository.Source);

            if (!Directory.Exists(basePath))
            {
                return(null);
            }

            var dllPath = Directory.EnumerateFiles(basePath, assemblyName.Name + ".dll", SearchOption.AllDirectories).OrderBy(path => path).LastOrDefault();

            if (string.IsNullOrEmpty(dllPath))
            {
                return(null);
            }

            Log.Info().WriteLine("Dll found in Package {0}, installed here {1}", assemblyName.Name, dllPath);
            if (File.Exists(dllPath))
            {
                // The following doesn't work, as Fusion isn't called. See: http://blogs.msdn.com/b/suzcook/archive/2003/09/19/loadfile-vs-loadfrom.aspx
                // return Assembly.LoadFile(dllPath);
                return(Assembly.LoadFrom(dllPath));
            }
            return(null);
        }
コード例 #27
0
        private void AddPackage(IPackageManager manager, string id, string version)
        {
            string testDir       = TestUtils.EnsureTestDirectoryExists(this.TestContext, "source");
            string dummyTextFile = TestUtils.CreateTextFile(Guid.NewGuid().ToString(), testDir, "content");

            PackageBuilder builder = new PackageBuilder();

            builder.Id          = id;
            builder.Version     = new SemanticVersion(version);
            builder.Description = "dummy description";
            builder.Authors.Add("dummy author");

            PhysicalPackageFile file = new PhysicalPackageFile();

            file.SourcePath = dummyTextFile;
            file.TargetPath = "dummy.txt";
            builder.Files.Add(file);

            MemoryStream stream = new MemoryStream();

            builder.Save(stream);
            stream.Position = 0;

            ZipPackage pkg = new ZipPackage(stream);

            manager.InstallPackage(pkg, true, true);
        }
コード例 #28
0
        /// <summary>
        /// Installs the specified packages and the dependencies needed to run them
        /// </summary>
        /// <param name="packages">The list of packages to install</param>
        /// <returns>The list of paths of the installed assemblies</returns>
        public IEnumerable<string> InstallAssemblies(IEnumerable<NuGetPackageInfo> packages)
        {
            if (packageSource == null)
            {
                throw new ArgumentNullException("packageSource");
            }

            if (!packages.Any())
            {
                this.logger.LogInfo(RoslynResources.NoAnalyzerPackages);
                return Enumerable.Empty<string>();
            }

            this.logger.LogInfo(RoslynResources.InstallingPackages);

            this.logger.LogDebug(RoslynResources.CreatingRepository, this.packageSource);
            this.remoteRepository = PackageRepositoryFactory.Default.CreateRepository(this.packageSource);

            // Create the local NuGet cache
            Directory.CreateDirectory(this.localCacheDirectory);
            this.manager = new PackageManager(remoteRepository, this.localCacheDirectory);
            this.manager.Logger = new NuGetLoggerAdapter(this.logger);
            
            ISet<string> assemblyPaths = new HashSet<string>();

            foreach(NuGetPackageInfo package in packages)
            {
                ProcessPackage(package, assemblyPaths);
            }

            this.logger.LogInfo(RoslynResources.PackagesInstalled);

            return assemblyPaths;
        }
        public ExtensionManagerWindow(IPackageManager packageManager)
        {
            InitializeComponent();

            explorer.Providers.Add(new InstalledProvider(packageManager, Resources));
            explorer.Providers.Add(new GalleryProvider(packageManager, Resources));
            explorer.Providers.Add(new UpdatesProvider(packageManager, Resources));

            explorer.SelectedProvider = explorer.Providers[0];

            //explorer.BringExtensionIntoView();
            //explorer.CategorySelectionChanged+=
            explorer.IsDetailPaneVisible = true;
            explorer.IsLeftNavigationVisible = true;
            explorer.IsPageNavigatorVisible = true;
            explorer.IsProvidersListVisible = true;
            explorer.IsSearchVisible = true;
            //explorer.NoItemSelectedMessage = "Hello";
            //explorer.NoItemsMessage = "Hi";
            //explorer.PageNavigator
            //explorer.ProviderSelectionChanged
            //explorer.Providers
            //explorer.SelectedExtension
            //explorer.SelectedExtensionTreeNode
            //explorer.SelectedProvider
            //explorer.SelectedSortField
            //explorer.SetFocusOnSearchBox();
        }
コード例 #30
0
ファイル: RealPackageOperation.cs プロジェクト: rikoe/nuget
        public Operation(
            PackageOperation operation, 
            IProjectManager projectManager,
            IPackageManager packageManager)
            : base(operation.Package, operation.Action)
        {
            if (projectManager != null && packageManager != null)
            {
                throw new ArgumentException("Only one of packageManager and projectManager can be non-null");
            }

            if (operation.Target == PackageOperationTarget.PackagesFolder && packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            if (operation.Target == PackageOperationTarget.Project && projectManager == null)
            {
                throw new ArgumentNullException("projectManager");
            }

            Target = operation.Target;
            PackageManager = packageManager;
            ProjectManager = projectManager;
            if (ProjectManager != null)
            {
                _projectName = ProjectManager.Project.ProjectName;
            }
        }
コード例 #31
0
        public PackageService(IPackageManager packageManager, INotifier notifier)
        {
            _packageManager = packageManager;
            _notifier       = notifier;

            T = NullLocalizer.Instance;
        }
コード例 #32
0
        IPackageManager CreatePackageManager(IPackageRepository sourceRepository)
        {
            IPackageManager packageManager = packageManagerFactory.CreatePackageManager(sourceRepository, SolutionPackageRepository);

            packageManager.Logger = logger;
            return(packageManager);
        }
コード例 #33
0
 public PackagingController(
     IPackageManager packageManager,
     Lazy <IThemeRegistry> themeRegistry)
 {
     _packageManager = packageManager;
     _themeRegistry  = themeRegistry;
 }
コード例 #34
0
        /// <summary>
        /// Initializes a new instance of the <see cref="InstallationManager" /> class.
        /// </summary>
        /// <param name="httpClient">The HTTP client.</param>
        /// <param name="packageManager">The package manager.</param>
        /// <param name="jsonSerializer">The json serializer.</param>
        /// <param name="logger">The logger.</param>
        /// <param name="appHost">The app host.</param>
        /// <exception cref="System.ArgumentNullException">zipClient</exception>
        public InstallationManager(IHttpClient httpClient, IPackageManager packageManager, IJsonSerializer jsonSerializer, ILogger logger, IApplicationHost appHost)
        {
            if (packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }
            if (logger == null)
            {
                throw new ArgumentNullException("logger");
            }
            if (jsonSerializer == null)
            {
                throw new ArgumentNullException("jsonSerializer");
            }
            if (httpClient == null)
            {
                throw new ArgumentNullException("httpClient");
            }

            CurrentInstallations   = new List <Tuple <InstallationInfo, CancellationTokenSource> >();
            CompletedInstallations = new ConcurrentBag <InstallationInfo>();
            JsonSerializer         = jsonSerializer;
            HttpClient             = httpClient;
            ApplicationHost        = appHost;
            _packageManager        = packageManager;
            _logger = logger;
        }
コード例 #35
0
ファイル: RealPackageOperation.cs プロジェクト: Litee/NuGet
        public Operation(
            PackageOperation operation,
            IProjectManager projectManager,
            IPackageManager packageManager)
            : base(operation.Package, operation.Action)
        {
            if (projectManager != null && packageManager != null)
            {
                throw new ArgumentException("Only one of packageManager and projectManager can be non-null");
            }

            if (operation.Target == PackageOperationTarget.PackagesFolder && packageManager == null)
            {
                throw new ArgumentNullException("packageManager");
            }

            if (operation.Target == PackageOperationTarget.Project && projectManager == null)
            {
                throw new ArgumentNullException("projectManager");
            }

            Target         = operation.Target;
            PackageManager = packageManager;
            ProjectManager = projectManager;
            if (ProjectManager != null)
            {
                _projectName = ProjectManager.Project.ProjectName;
            }
        }
コード例 #36
0
        /// <summary>
        /// Install a package with locking to allow multiple concurrent extractions to work without disk contention.
        /// </summary>
        public static void InstallPackage(IPackageManager packageManager, IPackage package)
        {
            var uniqueToken = GenerateUniqueToken(packageManager, package.Id, package.Version);

            // Prerelease flag does not matter since we already have the package to install and we ignore dependencies and walk info
            ExecuteLocked(uniqueToken, () => packageManager.InstallPackage(package: package, ignoreDependencies: true, allowPrereleaseVersions: true, ignoreWalkInfo: true));
        }
コード例 #37
0
        public void RoslynPlugin_GenerateForDependencyAnalyzers_Succeeds()
        {
            // Arrange
            TestLogger logger           = new TestLogger();
            string     outputDir        = TestUtils.CreateTestDirectory(TestContext, ".out");
            string     dummyContentFile = TestUtils.CreateTextFile("dummy.txt", outputDir, "non-analyzer content file");

            // Create a valid analyzer package
            RoslynAnalyzer11.CSharpAnalyzer analyzer = new RoslynAnalyzer11.CSharpAnalyzer();

            string          fakeRemoteNuGetDir = TestUtils.CreateTestDirectory(TestContext, ".fakeRemoteNuGet");
            IPackageManager fakeRemotePkgMgr   = CreatePackageManager(fakeRemoteNuGetDir);
            IPackage        child1             = AddPackage(fakeRemotePkgMgr, "Analyzer.Child1", "1.1.0", analyzer.GetType().Assembly.Location);
            IPackage        child2             = AddPackage(fakeRemotePkgMgr, "Analyzer.Child2", "1.2.0", analyzer.GetType().Assembly.Location);
            IPackage        targetPkg          = AddPackage(fakeRemotePkgMgr, "Empty.Parent", "1.0.0", dummyContentFile, child1, child2);

            string localPackageDestination = TestUtils.CreateTestDirectory(TestContext, ".localpackages");

            // Act
            NuGetPackageHandler     nuGetHandler = new NuGetPackageHandler(fakeRemotePkgMgr.LocalRepository, localPackageDestination, logger);
            AnalyzerPluginGenerator apg          = new AnalyzerPluginGenerator(nuGetHandler, logger);
            ProcessedArgs           args         = new ProcessedArgs(targetPkg.Id, targetPkg.Version, "cs", null, false,
                                                                     true /* generate plugins for dependencies with analyzers*/, outputDir);
            bool result = apg.Generate(args);

            // Assert
            result.Should().BeTrue();

            // Expecting one plugin per dependency with analyzers
            CheckJarGeneratedForPackage(outputDir, analyzer, child1);
            CheckJarGeneratedForPackage(outputDir, analyzer, child2);
            AssertJarsGenerated(outputDir, 2);
        }
コード例 #38
0
        public void RoslynPlugin_GenerateForValidAnalyzer_Succeeds()
        {
            // Arrange
            TestLogger logger    = new TestLogger();
            string     outputDir = TestUtils.CreateTestDirectory(TestContext, ".out");

            // Create a valid analyzer package
            RoslynAnalyzer11.CSharpAnalyzer analyzer = new RoslynAnalyzer11.CSharpAnalyzer();

            string          packageId          = "Analyzer1.Pkgid1"; // package id is not all lowercase
            string          fakeRemoteNuGetDir = TestUtils.CreateTestDirectory(TestContext, ".fakeRemoteNuGet");
            IPackageManager fakeRemotePkgMgr   = CreatePackageManager(fakeRemoteNuGetDir);
            IPackage        analyzerPkg        = AddPackage(fakeRemotePkgMgr, packageId, "1.0.2", analyzer.GetType().Assembly.Location);

            string localPackageDestination = TestUtils.CreateTestDirectory(TestContext, ".localpackages");

            // Act
            NuGetPackageHandler     nuGetHandler = new NuGetPackageHandler(fakeRemotePkgMgr.LocalRepository, localPackageDestination, logger);
            AnalyzerPluginGenerator apg          = new AnalyzerPluginGenerator(nuGetHandler, logger);
            ProcessedArgs           args         = new ProcessedArgs(packageId, new SemanticVersion("1.0.2"), "cs", null, false, false, outputDir);
            bool result = apg.Generate(args);

            // Assert
            result.Should().BeTrue();

            // Expecting one plugin per dependency with analyzers
            CheckJarGeneratedForPackage(outputDir, analyzer, analyzerPkg);
            AssertJarsGenerated(outputDir, 1);
        }
コード例 #39
0
 public CellService()
 {
     _userManager    = new UserManager();
     _typeManager    = new ClientTypeManager();
     _clientManager  = new ClientManager();
     _packageManager = new PackageManager();
 }
コード例 #40
0
 public TestWrapCommand(IFileSystem fileSystem,IPackageResolver resolver, IEnvironment environment, IPackageExporter exporter, IPackageManager manager)
 {
     _fileSystem = fileSystem;
     _exporter = exporter;
     _manager = manager;
     _resolver = resolver;
     _environment = environment;
 }
コード例 #41
0
        /// <summary>
        /// We want to base the lock name off of the full path of the package, however, the Mutex looks for files on disk if a path is given.
        /// Additionally, it also fails if the string is longer than 256 characters. Therefore we obtain a base-64 encoded hash of the path.
        /// </summary>
        /// <seealso cref="http://social.msdn.microsoft.com/forums/en-us/clr/thread/D0B3BF82-4D23-47C8-8706-CC847157AC81"/>
        private static string GenerateUniqueToken(IPackageManager packageManager, string packageId, SemanticVersion version)
        {
            var packagePath = packageManager.FileSystem.GetFullPath(packageManager.PathResolver.GetPackageFileName(packageId, version));
            var pathBytes = Encoding.UTF8.GetBytes(packagePath);
            var hashProvider = new CryptoHashProvider("SHA256");

            return Convert.ToBase64String(hashProvider.CalculateHash(pathBytes)).ToUpperInvariant();
        }
コード例 #42
0
 public RepositoryService(IPackageRepository packageRepository, IPackageManager packageManager, IJsonSerializer jsonSerializer)
 {
     if (packageRepository == null) throw new ArgumentNullException("packageRepository");
     if (packageManager == null) throw new ArgumentNullException("packageManager");
     _packageRepository = packageRepository;
     _packageManager = packageManager;
     _jsonSerializer = jsonSerializer;
 }
 public PowerShellPackageFile(
     IProcess process, IPackageManager manager, IFileSystem fileSystem, string configurationPath)
 {
     this.process = process;
     this.manager = manager;
     this.fileSystem = fileSystem;
     this.configurationPath = configurationPath;
 }
コード例 #44
0
 public Ps1ScaffolderLocator(IPowershellCommandInvoker commandInvoker, IPackageManager packageManager, IPackagePathResolver pathResolver, FileSystem.IFileSystem fileSystem, IScaffoldingConfigStore configStore)
 {
     _commandInvoker = commandInvoker;
     _packageManager = packageManager;
     _pathResolver = pathResolver ?? packageManager.PathResolver;
     _fileSystem = fileSystem;
     _configStore = configStore;
 }
コード例 #45
0
 public InstallPackageCommand(
     IHostPlatformDetector hostPlatformDetector,
     IPackageManager packageManager,
     IFeatureManager featureManager)
 {
     this.m_HostPlatformDetector = hostPlatformDetector;
     this.m_PackageManager = packageManager;
     _featureManager = featureManager;
 }
コード例 #46
0
 public KnownToolProvider(
     IPackageGlobalTool packageGlobalTool,
     IPackageManager packageManager,
     IHostPlatformDetector hostPlatformDetector)
 {
     _packageGlobalTool = packageGlobalTool;
     _packageManager = packageManager;
     _hostPlatformDetector = hostPlatformDetector;
 }
コード例 #47
0
ファイル: NuGetFactory.cs プロジェクト: run00/NuProduct
        NuGet.IPackageManager INuGetFactory.GetPackageManager()
        {
            if (_packageManager != null)
                return _packageManager;

            var repo = ((INuGetFactory)this).GetPackageRepository();
            _packageManager = new PackageManager(repo, _arguments.GetInstallationDirectory());
            return _packageManager;
        }
コード例 #48
0
 public PluginBootstrapperTask(ILogger logger,
     IConfiguration configuration,
     IPackageRepository packageRepository,
     IPackageManager packageManager)
 {
     _logger = logger;
     _configuration = configuration;
     _packageRepository = packageRepository;
     _packageManager = packageManager;
 }
コード例 #49
0
ファイル: ModuleStep.cs プロジェクト: Higea/Orchard
        public ModuleStep(
            IPackagingSourceManager packagingSourceManager, 
            IPackageManager packageManager, 
            IExtensionManager extensionManager,
            RecipeExecutionLogger logger) : base(logger) {

            _packagingSourceManager = packagingSourceManager;
            _packageManager = packageManager;
            _extensionManager = extensionManager;
        }
コード例 #50
0
        public ExtensionManagerTests()
        {
            resharperApi = new FakeReSharperApi(Version.Parse("6.0.0.0"));

            localRepository = new FakePackageRepository(RepoPath);
            fileSystem = new FakeFileSystem(RepoPath);
            var pathResolver = new DefaultPackagePathResolver(fileSystem);
            packageManager = new PackageManager(new AggregateRepository(Enumerable.Empty<IPackageRepository>()), pathResolver, fileSystem, localRepository);
            manager = new ExtensionManager.Implementation.ExtensionManager(resharperApi, null, packageManager);
        }
コード例 #51
0
 public UpgradePackageCommand(
     IPackageManager packageManager,
     IHostPlatformDetector hostPlatformDetector,
     IPackageNameLookup packageNameLookup,
     IFeatureManager featureManager)
 {
     _packageManager = packageManager;
     _hostPlatformDetector = hostPlatformDetector;
     _packageNameLookup = packageNameLookup;
     _featureManager = featureManager;
 }
コード例 #52
0
        public ModuleRecipeHandler(
            IPackagingSourceManager packagingSourceManager, 
            IPackageManager packageManager, 
            IExtensionManager extensionManager) {
            _packagingSourceManager = packagingSourceManager;
            _packageManager = packageManager;
            _extensionManager = extensionManager;

            Logger = NullLogger.Instance;
            T = NullLocalizer.Instance;
        }
コード例 #53
0
		public NugetAssemblyResolver()
		{
			packageRepo = PackageRepositoryFactory.Default.CreateRepository(NugetFeedUri);

			packageInstallDir = Path.Combine(Path.GetTempPath(), "cecilnuget");
			Directory.CreateDirectory(packageInstallDir);

			packageManager = new PackageManager(packageRepo, packageInstallDir);
			packageManager.PackageInstalled += PackageManager_PackageInstalled;
			localPackageRepo = packageManager.LocalRepository;
		}
コード例 #54
0
ファイル: PluginEngine.cs プロジェクト: renini/hadouken
        public PluginEngine(ILogger logger, IPackageManager packageManager, IDevelopmentPluginInstaller devPluginInstaller, IPluginManagerFactory pluginManagerFactory)
        {
            if (logger == null) throw new ArgumentNullException("logger");
            if (packageManager == null) throw new ArgumentNullException("packageManager");
            if (devPluginInstaller == null) throw new ArgumentNullException("devPluginInstaller");
            if (pluginManagerFactory == null) throw new ArgumentNullException("pluginManagerFactory");

            _logger = logger;
            _packageManager = packageManager;
            _devPluginInstaller = devPluginInstaller;
            _pluginManagerFactory = pluginManagerFactory;
        }
コード例 #55
0
        /// <summary>
        /// Creates a new selections manager
        /// </summary>
        /// <param name="feedManager">Used to load <see cref="Feed"/>s containing the original <see cref="Implementation"/>s.</param>
        /// <param name="store">The locations to search for cached <see cref="Implementation"/>s.</param>
        /// <param name="packageManager">An external package manager that can install <see cref="PackageImplementation"/>s.</param>
        public SelectionsManager([NotNull] IFeedManager feedManager, [NotNull] IStore store, [NotNull] IPackageManager packageManager)
        {
            #region Sanity checks
            if (feedManager == null) throw new ArgumentNullException(nameof(feedManager));
            if (store == null) throw new ArgumentNullException(nameof(store));
            if (packageManager == null) throw new ArgumentNullException(nameof(packageManager));
            #endregion

            _feedManager = feedManager;
            _store = store;
            _packageManager = packageManager;
        }
コード例 #56
0
 public ActionDispatch(
     LightweightKernel lightweightKernel,
     IHostPlatformDetector hostPlatformDetector,
     IPackageManager packageManager,
     IModuleUtilities moduleUtilities,
     IFeatureManager featureManager)
 {
     this.m_LightweightKernel = lightweightKernel;
     this.m_HostPlatformDetector = hostPlatformDetector;
     this.m_PackageManager = packageManager;
     _moduleUtilities = moduleUtilities;
     _featureManager = featureManager;
 }
コード例 #57
0
        public MockPythonInterpreterFactory(
            InterpreterConfiguration config,
            bool withStatusUpdater = false,
            IPackageManager packageManager = null
        ) {
            _config = config;

            _isCurrent = false;
            IsCurrentReason = NoDatabaseReason;

            _useUpdater = withStatusUpdater;
            PackageManager = packageManager;
        }
コード例 #58
0
ファイル: ThemeStep.cs プロジェクト: Higea/Orchard
        public ThemeStep(
            IPackagingSourceManager packagingSourceManager, 
            IPackageManager packageManager,
            IExtensionManager extensionManager,
            IThemeService themeService,
            ISiteThemeService siteThemeService,
            RecipeExecutionLogger logger) : base(logger) {

            _packagingSourceManager = packagingSourceManager;
            _packageManager = packageManager;
            _extensionManager = extensionManager;
            _themeService = themeService;
            _siteThemeService = siteThemeService;
        }
コード例 #59
0
ファイル: ShellRunner.cs プロジェクト: nuxleus/openwrap
        public CecilStaticAssemblyResolver(IPackageManager packageManager, IEnvironment environment)
        {
            _packageManager = packageManager;
            _environment = environment;
            var allAssemblies = Enumerable.Empty<Exports.IAssembly>();

            if (_environment.ProjectRepository != null)
                allAssemblies = _packageManager.GetProjectAssemblyReferences(_environment.Descriptor, _environment.ProjectRepository, environment.ExecutionEnvironment, true);
            var selectedPackages = allAssemblies.Select(x => x.Package.Name).ToList();
            var systemAssemblies = _packageManager.GetSystemExports<Exports.IAssembly>(_environment.SystemRepository, environment.ExecutionEnvironment)
                .Where(x => selectedPackages.Contains(x.Key) == false)
                .SelectMany(x => x);
            _allAssemblies = allAssemblies.Concat(systemAssemblies).ToList();
        }
コード例 #60
0
ファイル: TrashWorker.cs プロジェクト: rcarz/fusion
        /// <summary>
        /// Adds the given file to the trash for later clean-up.
        /// </summary>
        /// <param name="path">absolute path of file</param>
        /// <param name="pkgmgr">package manager reference</param>
        public static void AddFile(string path, IPackageManager pkgmgr)
        {
            string newpath = null;

            if (File.Exists(path)) {
                newpath = Path.GetDirectoryName(path) + @"\" + Guid.NewGuid().ToString();
                File.Move(path, newpath);
                File.SetAttributes(newpath, FileAttributes.Hidden);
            } else if (Directory.Exists(path)) {
                newpath = path;
            } else
                return;

            pkgmgr.TrashFile(newpath);
        }