IEnumerable <DirectoryInfo> _getRootPaths(DirectoryInfo current)
        {
            yield return(Roots.Icons);

            yield return(Roots.Content);

            yield return(Roots.GetActionRoot(current));

            yield return(Roots.Action);

            yield return(current.GetExistingPath());
        }
Exemple #2
0
/*
 *      bool GetCurrentIconFromIni(DirectoryInfo current, IconReference currentIcon, IconReference parentIcon, FolderIconInfo iconInfo, out IconReference finalIcon)
 *      {
 *          if (currentIcon.Resource != parentIcon.Resource && !currentIcon.IsEmpty)
 *          {
 *              finalIcon = currentIcon;
 *              return true;
 *          }
 *          //TODO: Evaluate use of FolderIconInfo.Main vs FolderIconInfo.Icon/GetIconResource()
 *          if (!string.IsNullOrEmpty(iconInfo.Main))
 *          {
 *              finalIcon = currentIcon;
 *              return false;
 *          }
 *          finalIcon = GetCurrentIconFromDirectory(current, iconInfo, parentIcon);
 *          if (finalIcon.IsEmpty)
 *          {
 *              finalIcon = currentIcon;
 *              return false;
 *          }
 *          return true;
 *      }
 */

        IEnumerable <IconGenerationSource> GetRootPathsGenerator(DirectoryInfo current, IconGenerationRoot root)
        {
            yield return(new IconGenerationSource(root, 5, Roots.Icons));

            yield return(new IconGenerationSource(root, 2, Roots.Content));

            yield return(new IconGenerationSource(root, 4, Roots.GetActionRoot(current)));

            yield return(new IconGenerationSource(root, 3, Roots.Action));

            yield return(new IconGenerationSource(root, 1, current.GetExistingPath()));
        }
Exemple #3
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));
                }
            }
        }
        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);
                }
            }
        }