Example #1
0
        public IList <DirectoryConfig> GetEnabledDirectories(IEnumerable <string> enabledGroups = null)
        {
            var rootsByName = Roots.ToDictionary(_ => _.Name, Str.Comparer);

            foreach (var directory in Directories)
            {
                if (!string.IsNullOrEmpty(directory.Root))
                {
                    directory.Path = Path.Combine(rootsByName[directory.Root].Path, directory.Path).NullIfEmpty();

                    directory.Exclude = string.Join(";",
                                                    Sequence.From(rootsByName[directory.Root].Exclude, directory.Exclude)
                                                    .Where(exclude => !string.IsNullOrEmpty(exclude)));
                }

                directory.Path = directory.Path.ToAppRootedPath();
            }

            if (EnabledGroups == null)
            {
                return(Directories);
            }

            var groups = new HashSet <string>(enabledGroups ?? EnabledGroups.Split(';', ' ', ',', '|'));

            return(Directories
                   .Where(_ => groups.Contains(_.Group ?? string.Empty))
                   .ToList());
        }
Example #2
0
        public IList <DirectoryConfig> GetEnabledDirectories(IEnumerable <string> enabledGroups = null)
        {
            foreach (var directory in Directories)
            {
                directory.Path = directory.Path.ToAppRootedPath();
            }

            if (EnabledGroups == null)
            {
                return(Directories);
            }

            var groups = new HashSet <string>(enabledGroups ?? EnabledGroups.Split(';', ' ', ',', '|'));

            return(Directories
                   .Where(_ => groups.Contains(_.Group ?? string.Empty))
                   .ToList());
        }