Ejemplo n.º 1
0
        IEnumerable <IconGenerationResult> GetCurrentIconsFromName_DebugSteps(DirectoryInfo current)
        {
            //var debug = IsDebug(current);
            //TODO: xRemove folderIconInfo
            var folderIconInfo = FolderIconInfo.GetExisting(current);

            var sidecarIcon = ResolveCurrentSidecarIcon(folderIconInfo, current);

            if (sidecarIcon != null)
            {
                return(new[] { sidecarIcon });
            }

            //TODO: xRemove roots and strRoots
            var roots = GetRootFoldersFromDirectory(folderIconInfo)
                        .DistinctPaths()
                        .ToArray();
            var strRoots = roots
                           //.Where(p=>Paths.Exists(p.FullName))
                           .OrderBy(p => p.FullName)
                           .Select(p => p.FullName)
                           .ToArray();

            //TODO: xRemove paths and strPaths
            var allPaths = GetCurrentIconFoldersFromRoots(roots)
                           .OrderBy(x => x.Priorities, ArrayComparer <double> .Default)
                           .ThenBy(x => x.Directory.FullName)
                           .ToArray();
            var paths = allPaths
                        .Distinct()
                        .ToArray();
            var strPaths = paths
                           .Select(p => p.Directory.FullName)
                           .ToArray();

            //TODO: xReplace GetAllCurrentIconsFromPaths(current, paths) and above code with GetAllCurrentIconsFromName(current)
            //TODO: xRemove ToArray()
            var icons = GetAllCurrentIconsFromPaths(current, paths)
                        .OrderBy(x => x.Priorities, ArrayComparer <double> .Default)
                        .ThenBy(x => x.Directory.FullName)
                        .Distinct()
                        .ToArray();

            //TODO: xRemove ToArray()
            var existingIcons = icons
                                .Where(x => x.Icon.Exists)
                                .ToArray();

            return(existingIcons);
        }
Ejemplo n.º 2
0
        IEnumerable <IconGenerationResult> GetCurrentIconsFromName(DirectoryInfo current)
        {
            //var debug = IsDebug(current);
            var folderIconInfo = FolderIconInfo.GetExisting(current);

            var sidecarIcon = ResolveCurrentSidecarIcon(folderIconInfo, current);

            if (sidecarIcon != null)
            {
                return new[] { sidecarIcon }
            }
            ;

            return(GetAllCurrentIconsFromName(folderIconInfo)
                   .OrderBy(x => x.Priorities, ArrayComparer <double> .Default)
                   .ThenBy(x => x.Directory.FullName)
                   .Distinct()
                   .Where(x => x.Icon.Exists));
        }

        IconGenerationResult ResolveCurrentSidecarIcon(FolderIconInfo iconInfo, DirectoryInfo current)
        {
            var icon = iconInfo.GetIconReference(current);

            return(GetIconGenerationResultFromReference(icon, -100, checkIconExists: true));
        }

        IconGenerationResult ResolveCurrentGeneratedIcon(DirectoryInfo current)
        {
            var ini = ResolveCurrentIcon(current);

            if (ini == null)
            {
                return(null);
            }
            var icon      = ini.Icon;
            var directory = ini.Directory;

            return(GetIconGenerationResultFromReference(icon, 100, directory));
        }
Ejemplo n.º 3
0
        IEnumerable <DirectoryInfo> GetRootFoldersFromDirectory(DirectoryInfo current)
        {
            var folderIconInfo = FolderIconInfo.GetExisting(current);

            return(GetRootFoldersFromDirectory(folderIconInfo));
        }