Example #1
0
        static void GetLatestNugetPackge(string feedUrl, string packageID, string extractionFolder)
        {
            NuGet.IPackageRepository repo =
                NuGet.PackageRepositoryFactory.Default.CreateRepository(
                    feedUrl);


            var package = repo.FindPackage(packageID);

            File.AppendAllText(logFile, DateTime.Now.ToLongDateString() + "  " + string.Format("PackageID:{0} Version:{1}", packageID, package.Version) + Environment.NewLine);

            extractionFolder = Path.Combine(extractionFolder, packageID, package.Version.ToString());

            if (!Directory.Exists(extractionFolder))
            {
                Directory.CreateDirectory(extractionFolder);
            }

            package.ExtractContents(new PhysicalFileSystem(extractionFolder), extractionFolder);

            DeleteFiles(extractionFolder, "*.exe.config");
            DeleteFiles(extractionFolder, "Web.config");

            File.AppendAllText(logFile, "  Nuget Copleted");
        }
Example #2
0
        public PackageManager(PackageManagerEnvironment workEnvironment, PackageSetup packageSetup)
        {
            // If no external package setup is provided, load it from the config file
            if (packageSetup == null)
            {
                string configFilePath = workEnvironment.ConfigFilePath;
                if (!File.Exists(configFilePath))
                {
                    packageSetup = new PackageSetup();
                    packageSetup.Save(configFilePath);
                }
                else
                {
                    try
                    {
                        packageSetup = PackageSetup.Load(configFilePath);
                    }
                    catch (Exception e)
                    {
                        Logs.Editor.WriteError(
                            "Failed to load PackageManager config file '{0}': {1}",
                            configFilePath,
                            LogFormat.Exception(e));
                    }
                }
            }

            // Assign work environment and package setup to work with
            this.env   = workEnvironment;
            this.setup = packageSetup;

            // Create internal package management objects
            IPackageRepository[] repositories = this.setup.RepositoryUrls
                                                .Select(x => this.CreateRepository(x))
                                                .Where(x => x != null)
                                                .ToArray();
            this.repository = new AggregateRepository(repositories);
            this.manager    = new NuGet.PackageManager(this.repository, this.env.RepositoryPath);
            this.manager.PackageInstalling  += this.manager_PackageInstalling;
            this.manager.PackageInstalled   += this.manager_PackageInstalled;
            this.manager.PackageUninstalled += this.manager_PackageUninstalled;
            this.cache = new PackageCache(
                this.repository,
                repositories.OfType <LocalPackageRepository>().Any());

            this.logger         = new PackageManagerLogger();
            this.manager.Logger = this.logger;

            this.dependencyWalker = new PackageDependencyWalker(this.GetPackage);

            // Retrieve information about local packages
            this.RetrieveLocalPackageInfo();
        }
Example #3
0
        static void GetSpecficPackage(string[] args)
        {
            string feedUrl;
            string packageID;
            string version;
            string extractionFolder;


            feedUrl          = "http://*****:*****@"C:\webjob";

            if (args.Any())
            {
                File.AppendAllText(@"C:\args.txt", string.Join(",", args));

                feedUrl          = args[0];
                packageID        = args[1];
                version          = args[2];
                extractionFolder = args[3];
            }

            if (!Directory.Exists(extractionFolder))
            {
                Directory.CreateDirectory(extractionFolder);
            }


            NuGet.IPackageRepository repo =
                NuGet.PackageRepositoryFactory.Default.CreateRepository(
                    feedUrl);


            var packages = repo.FindPackagesById(packageID);

            var package =
                packages
                .Where(x => x.Version == SemanticVersion.Parse(version))
                .FirstOrDefault();

            package.ExtractContents(new PhysicalFileSystem(extractionFolder), extractionFolder);

            File.AppendAllText(@"C:\args.txt", "Nuget Copleted");
        }
Example #4
0
        internal PackageManager(string rootPath = null, string dataTargetDir = null, string pluginTargetDir = null)
        {
            // Setup base parameters
            this.rootPath			= rootPath			?? Environment.CurrentDirectory;
            this.dataTargetDir		= dataTargetDir		?? DualityApp.DataDirectory;
            this.pluginTargetDir	= pluginTargetDir	?? DualityApp.PluginDirectory;

            // Load additional config parameters
            this.LoadConfig();

            // Create internal package management objects
            this.repository = NuGet.PackageRepositoryFactory.Default.CreateRepository(this.repositoryUrl.AbsoluteUri);
            this.manager = new NuGet.PackageManager(this.repository, LocalPackageDir);
            this.manager.PackageInstalled += this.manager_PackageInstalled;
            this.manager.PackageUninstalled += this.manager_PackageUninstalled;

            // Update local repository file mappings
            this.UpdateFileMappings();
        }
Example #5
0
        internal PackageManager(string rootPath = null, string dataTargetDir = null, string pluginTargetDir = null)
        {
            // Setup base parameters
            this.rootPath        = rootPath ?? Environment.CurrentDirectory;
            this.dataTargetDir   = dataTargetDir ?? DualityApp.DataDirectory;
            this.pluginTargetDir = pluginTargetDir ?? DualityApp.PluginDirectory;

            // Load additional config parameters
            this.LoadConfig();

            // Create internal package management objects
            this.repository = NuGet.PackageRepositoryFactory.Default.CreateRepository(this.repositoryUrl.AbsoluteUri);
            this.manager    = new NuGet.PackageManager(this.repository, LocalPackageDir);
            this.manager.PackageInstalled   += this.manager_PackageInstalled;
            this.manager.PackageUninstalled += this.manager_PackageUninstalled;

            // Retrieve information about local packages
            this.RetrieveLocalPackageInfo();
        }
Example #6
0
        internal PackageManager(string rootPath = null, string dataTargetDir = null, string sourceTargetDir = null, string pluginTargetDir = null)
        {
            // Setup base parameters
            this.rootPath			= rootPath			?? Environment.CurrentDirectory;
            this.dataTargetDir		= dataTargetDir		?? DualityApp.DataDirectory;
            this.sourceTargetDir	= sourceTargetDir	?? EditorHelper.SourceCodeDirectory;
            this.pluginTargetDir	= pluginTargetDir	?? DualityApp.PluginDirectory;

            // Load additional config parameters
            this.LoadConfig();

            // Create internal package management objects
            IPackageRepository[] repositories = this.repositoryUrls.Select(x => this.CreateRepository(x)).Where(x => x != null).ToArray();
            this.hasLocalRepo = repositories.OfType<LocalPackageRepository>().Any();
            this.repository = new AggregateRepository(repositories);
            this.manager = new NuGet.PackageManager(this.repository, LocalPackageDir);
            this.manager.PackageInstalled += this.manager_PackageInstalled;
            this.manager.PackageUninstalled += this.manager_PackageUninstalled;
            this.manager.PackageUninstalling += this.manager_PackageUninstalling;

            // Retrieve information about local packages
            this.RetrieveLocalPackageInfo();
        }
Example #7
0
        internal PackageManager(string rootPath = null, string dataTargetDir = null, string sourceTargetDir = null, string pluginTargetDir = null)
        {
            // Setup base parameters
            this.rootPath        = rootPath ?? Environment.CurrentDirectory;
            this.dataTargetDir   = dataTargetDir ?? DualityApp.DataDirectory;
            this.sourceTargetDir = sourceTargetDir ?? EditorHelper.SourceCodeDirectory;
            this.pluginTargetDir = pluginTargetDir ?? DualityApp.PluginDirectory;

            // Load additional config parameters
            this.LoadConfig();

            // Create internal package management objects
            IPackageRepository[] repositories = this.repositoryUrls.Select(x => this.CreateRepository(x)).Where(x => x != null).ToArray();
            this.hasLocalRepo                 = repositories.OfType <LocalPackageRepository>().Any();
            this.repository                   = new AggregateRepository(repositories);
            this.manager                      = new NuGet.PackageManager(this.repository, LocalPackageDir);
            this.manager.PackageInstalled    += this.manager_PackageInstalled;
            this.manager.PackageUninstalled  += this.manager_PackageUninstalled;
            this.manager.PackageUninstalling += this.manager_PackageUninstalling;

            // Retrieve information about local packages
            this.RetrieveLocalPackageInfo();
        }
Example #8
0
 void IVsPackageInstaller.InstallPackage(NuGet.IPackageRepository repository, Project project, string packageId, string version, bool ignoreDependencies, bool skipAssemblyReferences)
 {
     throw new NotImplementedException();
 }
Example #9
0
 public PackageCache(NuGet.IPackageRepository repository, bool isPartiallyLocalRepo)
 {
     this.repository   = repository;
     this.hasLocalRepo = isPartiallyLocalRepo;
 }