Ejemplo n.º 1
0
        IEnumerable <DirectoryInfo> GetRootFoldersFromDirectory(FolderIconInfo iconInfo)
        {
            var allRoots       = iconInfo.GetRoots();
            var folderIconInfo = FolderIconInfo.Get(iconInfo);

            //TODO: Remove ToArray() and strPaths
            var roots = new [] { iconInfo.Directory }
            .Concat(iconInfo
                    .GetRoots()
                    .Select(x => DirectoriesIO.GetInfo(Directories.Roots.Library, x)))
            .ToArray();
            var strPaths = roots
                           //.Where(p=>Paths.Exists(p.FullName))
                           .Select(p => p.FullName)
                           .ToArray();

            return(roots);
        }
Ejemplo n.º 2
0
        static IconReference GetCurrentIconFromDirectory(DirectoryInfo current, FolderIconInfo iconInfo, IconReference parentIcon)
        {
            var baseDirectory   = Path.Combine(LibSetting.Directories.Library, current.GetFullNameWithoutRoot());
            var testDirectories = new[]
            {
                current.FullName,
                //Path.Combine(baseDirectory, current.Name),
                baseDirectory
            };

            var testFileNames      = new[] { current.Name, Path.Combine(current.Name, current.Name), "", "current" };
            var testFileExtensions = new[] { ".ico", ".icl" };

            var roots = iconInfo
                        .GetRoots()
                        .Select(x => Path.Combine(LibSetting.Directories.Library, x))
                        .ToArray();

            foreach (var name in testFileNames)
            {
                foreach (var directory in roots.Concat(testDirectories))
                {
                    foreach (var extension in testFileExtensions)
                    {
                        var testPath = string.IsNullOrEmpty(name)
                            ? directory + name + extension
                            : Path.Combine(directory, name + extension);
                        var testFile = new FileInfo(testPath);
                        var message  = current.FullName.Suffix(": ").PadRight(50) + testFile?.FullName;

                        if (testFile.Exists && testFile.FullName != parentIcon.Icon?.FullName)
                        {
                            Debug.WriteLine("*** " + message);
                            return(IconReference.FromFile(testFile));
                        }

                        // Debug.WriteLine("    " + message);
                    }
                }
            }
            Debug.WriteLine("xxx " + current.FullName.Suffix(": ").PadRight(50) + parentIcon.Icon?.FullName);
            return(IconReference.Empty);
        }
Ejemplo n.º 3
0
        IEnumerable <DirectoryInfo> GetRootFoldersFromDirectory(FolderIconInfo iconInfo)
        {
            //var debug = IsDebug(iconInfo);
            //var allRoots = iconInfo.GetRoots();
            //var folderIconInfo = FolderIconInfo.GetExisting(iconInfo);


            var iconRoots = iconInfo
                            .GetRoots()
                            .Select(x => DirectoriesIO.GetInfo(Directories.Roots.Library, x));
            var roots = new [] { iconInfo.Current }
            .Concat(iconRoots);

            //.ToArray()
            //var strPaths = roots
            //    //.Where(p=>Paths.Exists(p.FullName))
            //    .Select(p => p.FullName)
            //    .ToArray();
            return(roots);
        }