public OpenFolderRoot GetComputer()
        {
            OpenFolderRoot root = new OpenFolderRoot();

            root.Name  = "Computer";
            root.Image = FileInfoHelper.GetComputerImage(false);

            List <OpenFolderItem> items = new List <OpenFolderItem>();

            DriveInfo[] drives = DriveInfo.GetDrives();
            foreach (var drive in drives)
            {
                if (drive.IsReady)
                {
                    StringBuilder sb = new StringBuilder();
                    sb.Append(drive.DriveType);
                    sb.Append(" (");
                    sb.Append(drive.Name, 0, drive.Name.Length - 1);
                    sb.Append(") ");
                    sb.Append(drive.VolumeLabel);

                    OpenFolderItem item = new OpenFolderItem(drive.Name);
                    item.Name  = sb.ToString();
                    item.Image = FileInfoHelper.GetSmallImage(item.Path, false);
                    items.Add(item);
                }
            }

            root.Children = items;

            return(root);
        }
Esempio n. 2
0
        public OpenFolderRoot GetLibraries()
        {
            OpenFolderRoot root = new OpenFolderRoot();

            root.Name  = "Libraries";
            root.Image = FileInfoHelper.GetLibrariesImage(false);

            if (PlatformHelper.IsMinWin7)
            {
                //IKnownFolder folder = ShellLibrary.LibrariesKnownFolder;

                //root.Path = folder.Path;

                //List<OpenFolderItem> items = new List<OpenFolderItem>();
                //foreach(var lib in folder)
                //{
                //	OpenFolderItem item = new OpenFolderItem();
                //	item.Name = lib.Name;
                //	item.Path = Path.Combine(root.Path, item.Name);
                //	//item.Image = ImageLoader.GetSmallImage(item.Path);
                //	items.Add(item);
                //}
                //root.Children = items;
            }

            return(root);
        }
Esempio n. 3
0
        public OpenFolderRoot GetFavorites()
        {
            OpenFolderRoot root = new OpenFolderRoot();

            root.Name  = "Favorites";
            root.Image = FileInfoHelper.GetFavoritesImage(false);
            root.Path  = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.UserProfile), "Links");

            if (Directory.Exists(root.Path))
            {
                List <OpenFolderItem> items = new List <OpenFolderItem>();
                foreach (string file in Directory.GetFiles(root.Path))
                {
                    if (ShortcutHelper.IsShortcut(file))
                    {
                        OpenFolderItem item     = new OpenFolderItem();
                        string         resolved = ShortcutHelper.ResolveShortcut(file);
                        item.Path  = resolved;
                        item.Name  = Path.GetFileNameWithoutExtension(file);
                        item.Image = FileInfoHelper.GetImage(file, false);
                        items.Add(item);
                    }
                }
                root.Children = items;
            }
            return(root);
        }
Esempio n. 4
0
        public OpenFolderRoot GetNetwork()
        {
            OpenFolderRoot root = new OpenFolderRoot();

            root.Name  = "Network";
            root.Image = FileInfoHelper.GetNetworkNeighborhoodImage(false);

            return(root);
        }