public override void LoadDirectories()
 {
     try
     {
         List<FolderInfo> list = new List<FolderInfo>();
         foreach (TemplateFolderDescription item in Description)
         {
             string folderPath = item.Path;
             FolderInfo fi = new FolderInfo(Parent, item.DisplayName, folderPath);
             list.Add(fi);
         }
         Directories = list.ToArray();
     }
     catch (UnauthorizedAccessException)
     {
         HasErrors = true;
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         IsDirectoriesLoaded = true;
     }
 }
 public override void LoadDirectories()
 {
     try
     {
         List<FolderInfo> list = new List<FolderInfo>();
         string[] folderNames = System.Enum.GetNames(typeof(Environment.SpecialFolder));
         foreach (string folderName in folderNames)
         {
             Environment.SpecialFolder member = (Environment.SpecialFolder)System.Enum.Parse(typeof(Environment.SpecialFolder), folderName, true);
             string folderPath = Environment.GetFolderPath(member);
             FolderInfo fi = new FolderInfo(Parent, member.ToString(), folderPath);
             list.Add(fi);
         }
         Directories = list.ToArray();
     }
     catch (UnauthorizedAccessException)
     {
         HasErrors = true;
     }
     catch (Exception)
     {
         throw;
     }
     finally
     {
         IsDirectoriesLoaded = true;
     }
 }
 /// <summary>
 /// Returns MyDocuments folder item
 /// </summary>
 /// <param name="load">load info immediately</param>
 /// <returns>MyDocuments folder item</returns>
 internal FolderInfo GetMyDocuments(bool load = false)
 {
     string folderPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments);
     string name = Path.GetFileName(folderPath);
     FolderInfo folderInfo = new FolderInfo(this, name, folderPath, load);
     return folderInfo;
 }
 internal FileSystemInfo(FileSystemManager parent, string name, string path, bool loadDirectories = false, bool loadFiles = false)
 {
     Parent = parent;
     Name = name;
     Path = path;
     Drives = new DrvInfo[0];
     Directories = new FolderInfo[0];
     Files = new FiInfo[0];
     if (loadDirectories)
         LoadDirectories();
     if (loadFiles)
         LoadFiles();
 }
Beispiel #5
0
        public override void LoadDirectories()
        {
            try
            {
                if (Exists)
                {
                    DirectoryInfo dirInfo = new DirectoryInfo(Path);
                    DirectoryInfo[] dirs = dirInfo.GetDirectories("*.*", SearchOption.TopDirectoryOnly);

                    List<FolderInfo> list = new List<FolderInfo>();
                    for (int i = 0; i < dirs.Length; i++)
                    {
                        if (!dirs[i].Attributes.HasFlag(FileAttributes.System))
                        {
                            string name = dirs[i].Name;
                            string path = dirs[i].FullName;
                            list.Add(new FolderInfo(Parent, name, path, false));
                        }
                    }
                    Directories = list.ToArray();
                }
                else
                {
                    Directories = new FolderInfo[0];
                }
            }
            catch (UnauthorizedAccessException)
            {
                HasErrors = true;
            }
            catch (Exception)
            {
                throw;
            }
            finally
            {
                IsDirectoriesLoaded = true;
            }
        }
 public override bool AllowShowFolder(FolderInfo folder)
 {
     return true;
 }
 public virtual bool AllowShowFolder(FolderInfo folder)
 {
     return GetRuntimeValue("AllowBrowseFolders");
 }
Beispiel #8
0
 public override bool AllowShowFolder(FolderInfo folder)
 {
     return(true);
 }
        private void AddNewDirectory(string folder)
        {
            var settings = GetCurrentSettings();
            if (settings.GetRuntimeValue("AllowBrowseFolders") == false)
                return;
            string folderName = System.IO.Path.GetFileNameWithoutExtension(folder);
            FolderInfo info = new FolderInfo(FileSystemHandler, folderName, folder);
            ListViewItem item = ListView1.Items.Add(info.Name);
            if (TreeView1.SelectedNode != null)
            {
                if (TreeView1.SelectedNode != null && TreeView1.SelectedNode.Nodes[0].Text != "?:")
                {
                    TreeNode node = TreeView1.SelectedNode.Nodes.Insert(0, folderName);
                    node.Tag = new FolderInfo(FileSystemHandler, folderName, folder);
                }

            }
            item.ImageIndex = 1;
            item.Tag = info;
        }
Beispiel #10
0
 public virtual bool AllowShowFolder(FolderInfo folder)
 {
     return(GetRuntimeValue("AllowBrowseFolders"));
 }