示例#1
0
            public Task <T> Find <T>(PackageDescriptor descriptor) where T : class, IPackage
            {
                if (_package is T package)
                {
                    return(Task.FromResult(package));
                }

                return(default);
示例#2
0
        public Package2(
            PackageDescriptor descriptor,
            IDirectoryAccessor directoryAccessor)
        {
            _descriptor = descriptor ?? throw new ArgumentNullException(nameof(descriptor));

            DirectoryAccessor = directoryAccessor ?? throw new ArgumentNullException(nameof(directoryAccessor));
        }
示例#3
0
        public Task <PackageBuilder> Locate(PackageDescriptor packageDescriptor, Budget budget)
        {
            var directory = new DirectoryInfo(Path.Combine(
                                                  Package.DefaultPackagesDirectory.FullName, packageDescriptor.Name));

            if (directory.Exists)
            {
                var packageBuilder = new PackageBuilder(packageDescriptor.Name);
                packageBuilder.CreateRebuildablePackage = _createRebuildablePackage;
                return(Task.FromResult(packageBuilder));
            }

            return(Task.FromResult <PackageBuilder>(null));
        }
示例#4
0
        public Task <PackageBuilder> Locate(
            PackageDescriptor packageDescriptor,
            Budget budget = null)
        {
            var projectFile = packageDescriptor.Name;
            var extension   = Path.GetExtension(projectFile);

            if ((extension == ".csproj" || extension == ".fsproj") && File.Exists(projectFile))
            {
                PackageBuilder packageBuilder = new PackageBuilder(packageDescriptor.Name);
                packageBuilder.CreateRebuildablePackage = _createRebuildablePackage;
                packageBuilder.Directory = new DirectoryInfo(Path.GetDirectoryName(projectFile));
                return(Task.FromResult(packageBuilder));
            }

            return(Task.FromResult <PackageBuilder>(null));
        }