Ejemplo n.º 1
0
        IEnumerable <IconGenerationPath> GetRelativePaths(DirectoryInfo current, DirectoryInfo rootDirectory, int priority)
        {
            //var debug = IsDebug(current);
            var generationRoot = new IconGenerationRoot(priority, rootDirectory);

            //TODO: xRemove ToArray()
            var roots = GetRootPaths(current, generationRoot)
                        .Distinct()
                        .ToArray()
            ;
            RelativePath relative = null;

            foreach (var root in roots)
            {
                if (!Roots.IsActionRoot(current))
                {
                    var actionRoot = Roots.GetActionRoot(current);
                    relative = current.ParseRelativePath(actionRoot, root.Directory);
                    yield return(new IconGenerationPath(root, 1, relative));
                }
                if (Roots.Action != null)
                {
                    relative = current.ParseRelativePath(Roots.Action, root.Directory);
                    yield return(new IconGenerationPath(root, 2, relative));
                }
            }
            if (relative == null)
            {
                yield break;
            }
            var label = relative.SubPath;

            var newLabels = Roots.GetAlternateRootLabels(label);

            //.ToArray()

            foreach (var newLabel in newLabels)
            {
                foreach (var root in roots)
                {
                    relative = root.Directory.CreateRelativePath(newLabel);
                    yield return(new IconGenerationPath(root, 3, relative));
                }
            }
        }
Ejemplo n.º 2
0
        IEnumerable <RelativePath> GetRelativePaths(DirectoryInfo current)
        {
            //TODO: Remove ToArray()
            var roots = GetRootPaths(current)
                        .NotNull()
                        .DistinctPaths()
                        .ToArray();
            RelativePath relative = null;
            var          debug    = IsDebug(current);

            foreach (var root in roots)
            {
                if (!Roots.IsActionRoot(current))
                {
                    relative = current.ParseRelativePath(Roots.GetActionRoot(current), root);
                    yield return(relative);
                }
                relative = current.ParseRelativePath(Roots.Action, root);
                yield return(relative);
            }
            if (relative == null)
            {
                yield break;
            }
            var label = relative.SubPath;
            //TODO: Remove ToArray()
            var newLabels = Roots.GetAlternateRootLabels(label).ToArray();

            foreach (var newLabel in newLabels)
            {
                foreach (var root in roots)
                {
                    relative = root.CreateRelativePath(newLabel);
                    yield return(relative);
                }
            }
        }