Пример #1
0
        public async Task LoadExtensionsFromDirectory(IDirectoryAccessor directory, KernelInvocationContext context,
                                                      IEnumerable <string> additionalDependencies = null)
        {
            var extensionsDirectory = directory.GetDirectoryAccessorForRelativePath(_assemblyExtensionsPath);

            await new KernelExtensionLoader().LoadFromAssembliesInDirectory(extensionsDirectory, context.HandlingKernel, context, additionalDependencies);
        }
Пример #2
0
        public static IDirectoryAccessor GetDirectoryAccessorFor(this IDirectoryAccessor directory, DirectoryInfo directoryInfo)
        {
            var relative = PathUtilities.GetRelativePath(
                directory.GetFullyQualifiedRoot().FullName,
                directoryInfo.FullName);

            return(directory.GetDirectoryAccessorForRelativePath(new RelativeDirectoryPath(relative)));
        }
Пример #3
0
        public Task <T> Find <T>(PackageDescriptor descriptor)
            where T : IPackage
        {
            if (!descriptor.IsPathSpecified)
            {
                if (_directoryAccessor.DirectoryExists(descriptor.Name))
                {
                    var directoryAccessor = _directoryAccessor.GetDirectoryAccessorForRelativePath(descriptor.Name);

                    var pkg = new Package2(
                        descriptor,
                        directoryAccessor);

                    if (pkg is T t)
                    {
                        return(Task.FromResult(t));
                    }
                }
            }

            return(Task.FromResult <T>(default));
Пример #4
0
        public async Task <T> Find <T>(PackageDescriptor descriptor)
            where T : class, IPackage
        {
            if (!descriptor.IsPathSpecified)
            {
                if (_directoryAccessor.DirectoryExists(descriptor.Name))
                {
                    var directoryAccessor = _directoryAccessor.GetDirectoryAccessorForRelativePath(descriptor.Name);

                    var pkg = new Package2(
                        descriptor,
                        directoryAccessor);

                    pkg.Add(new ProjectAsset(directoryAccessor));

                    if (pkg is T t)
                    {
                        return(t);
                    }
                }
            }

            return(default);
Пример #5
0
        public async Task LoadExtensionsInDirectory(IDirectoryAccessor directory, KernelInvocationContext context)
        {
            var extensionsDirectory = directory.GetDirectoryAccessorForRelativePath(_assemblyExtensionsPath);

            await new KernelExtensionLoader().LoadFromAssembliesInDirectory(extensionsDirectory, context.HandlingKernel, context);
        }
Пример #6
0
 public static IDirectoryAccessor GetDirectoryAccessorForRelativePath(
     this IDirectoryAccessor directoryAccessor,
     string relativePath) =>
 directoryAccessor.GetDirectoryAccessorForRelativePath(new RelativeDirectoryPath(relativePath));