示例#1
0
        public PhysicalAppDataFolder(
            IPlatoFileSystem parentFileSystem,
            ILogger <PhysicalAppDataFolder> logger)
        {
            _logger = logger;

            if (!parentFileSystem.DirectoryExists(InternalRootPath))
            {
                parentFileSystem.CreateDirectory(InternalRootPath);
            }

            var root = parentFileSystem.GetDirectoryInfo(InternalRootPath).FullName;

            _fileSystem = new PlatoFileSystem(root, new PhysicalFileProvider(root), _logger);
        }
示例#2
0
        public PhysicalSitesFolder(
            IPlatoFileSystem parentFileSystem,
            ILogger <PhysicalSitesFolder> logger,
            IHostEnvironment hostEnvironment)
        {
            _logger          = logger;
            _hostEnvironment = hostEnvironment;

            if (!parentFileSystem.DirectoryExists(InternalRootPath))
            {
                parentFileSystem.CreateDirectory(InternalRootPath);
            }

            var root = parentFileSystem.GetDirectoryInfo(InternalRootPath).FullName;

            _fileSystem = new PlatoFileSystem(root, new PhysicalFileProvider(root), _logger);
        }
示例#3
0
        private async Task <List <Assembly> > LoadAssembliesInFolder(
            string path, List <Assembly> localList)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(localList);
            }

            // no bin folder within module
            if (!_fileSystem.DirectoryExists(path))
            {
                return(localList);
            }

            var folder = _fileSystem.GetDirectoryInfo(path);

            foreach (var file in folder.GetFiles())
            {
                if (file.Extension.ToLower() == AssemblyExtension)
                {
                    if (!IsAssemblyLoaded(Path.GetFileNameWithoutExtension(file.FullName)))
                    {
                        var assembly = LoadFromAssemblyPath(file.FullName);
                        if (assembly != null)
                        {
                            localList.Add(assembly);
                        }
                    }
                }
            }

            // Recursive lookup
            var subFolders = Directory.GetDirectories(path);

            for (var i = 0; i <= subFolders.Length - 1; i++)
            {
                await LoadAssembliesInFolder(subFolders.GetValue(i).ToString(), localList);
            }

            return(localList);
        }
示例#4
0
        public bool DeleteDirectory(string path)
        {
            if (String.IsNullOrEmpty(path))
            {
                throw new ArgumentNullException(nameof(path));
            }

            if (!_fileSystem.DirectoryExists(path))
            {
                return(false);
            }

            try
            {
                _fileSystem.DeleteDirectory(path);
            }
            catch (Exception)
            {
                return(false);
            }

            return(true);
        }
示例#5
0
 public bool DirectoryExists(string path)
 {
     return(_fileSystem.DirectoryExists(path));
 }