示例#1
0
 public DirectoryList(string name, string fullname, DirectoryList parent)
 {
     this.Parent   = parent;
     this.Name     = name;
     this.Fullname = fullname;
     this.Files    = new FileCollection();
     this.dirs     = new Dictionary <string, DirectoryList>(StringComparer.OrdinalIgnoreCase);
 }
示例#2
0
 public TreeItemsList(VFile file, Typeface fontface, double fontsize)
 {
     this._fontsize    = fontsize;
     this.typeface     = fontface;
     this.myfile       = file;
     this.root         = new DirectoryList(string.Empty, "<Root>", null);
     this.cacheViews   = new Dictionary <DirectoryList, List <ItemViewModel> >();
     this._directories = new Dictionary <string, DirectoryList>(StringComparer.OrdinalIgnoreCase);
     this._directories.Add(string.Empty, this.root);
 }
示例#3
0
        public void SelectDirectory(string[] dir)
        {
            DirectoryList currentDir = this.root;

            for (int i = 0; i < dir.Length; i++)
            {
                currentDir = currentDir[dir[i]];
            }
            this._currentDirectory = currentDir;
            this.GenerateListCurrent();
        }
示例#4
0
 public DirectoryList this[string directoryname]
 {
     get
     {
         if (this.dirs.ContainsKey(directoryname))
         {
             return(this.dirs[directoryname]);
         }
         else
         {
             var dir = new DirectoryList(directoryname, this.Fullname + Path.DirectorySeparatorChar + directoryname, this);
             this.dirs.Add(directoryname, dir);
             return(dir);
         }
     }
 }
示例#5
0
 public void SelectDirectory(string path)
 {
     if (string.IsNullOrEmpty(path))
     {
         this._currentDirectory = this.root;
         this.GenerateListCurrent();
     }
     else
     {
         if (this._directories.ContainsKey(path))
         {
             this._currentDirectory = this._directories[path];
             this.GenerateListCurrent();
         }
         else if ((path.IndexOf('/') == -1) && (path.IndexOf('\\') == -1))
         {
             this._currentDirectory = this.root[path];
             this.GenerateListCurrent();
         }
         else
         {
             if (path == "/" || path == "\\")
             {
                 this._currentDirectory = this.root;
                 this.GenerateListCurrent();
             }
             else
             {
                 string[] dirs = GetFolders(path);
                 if (dirs.Length == 0)
                 {
                     this._currentDirectory = this.root;
                     this.GenerateListCurrent();
                 }
                 else
                 {
                     this.SelectDirectory(dirs);
                 }
             }
         }
     }
 }
示例#6
0
 internal static IEnumerable <ZipEntry> GetEntriesFromDirectory(DirectoryList directory, SearchOption searchOption)
 {
     if (searchOption == SearchOption.AllDirectories && (directory.Directories.Count != 0))
     {
         List <ZipEntry> entries = new List <ZipEntry>();
         if (directory.Files.Count != 0)
         {
             entries.AddRange(directory.Files.Values);
         }
         foreach (DirectoryList dir in directory.Directories)
         {
             entries.AddRange(GetEntriesFromDirectory(dir, searchOption));
         }
         return(entries);
     }
     else
     {
         return(directory.Files.Values);
     }
 }
示例#7
0
        public void Init()
        {
            DirectoryList currentDir;

            string[] dir;
            int      i = 0;
            string   key;

            foreach (var item in this.myfile)
            {
                if (!item.IsDirectory)
                {
                    /*
                     * if (item.Key.StartsWith(".."))
                     *  key = item.Key.TrimStart('.', '/', '\\');
                     * else
                     *  key = item.Key;
                     * //*/
                    key = item.Key;
                    if ((key.IndexOf('/') == -1) && (key.IndexOf('\\') == -1))
                    {
                        this.root.Files.Add(Path.GetFileName(key), item);
                    }
                    else
                    {
                        dir        = GetFolders(key);
                        currentDir = this.root;
                        for (i = 0; i < (dir.Length - 1); i++)
                        {
                            currentDir = currentDir[dir[i]];
                            if (!this._directories.ContainsKey(currentDir.Fullname))
                            {
                                this._directories.Add(currentDir.Fullname, currentDir);
                            }
                        }
                        currentDir.Files.Add(dir[dir.Length - 1], item);
                    }
                }
            }
            this._currentDirectory = this.root;
        }
示例#8
0
 internal static IEnumerable <ZipEntry> GetEntriesFromDirectory(DirectoryList directory) => GetEntriesFromDirectory(directory, SearchOption.AllDirectories);
示例#9
0
 private void Huh_RequestOpen(DirectoryList obj)
 {
     this._currentDirectory = obj;
     this.GenerateListCurrent();
 }
示例#10
0
 public ItemViewDirectory(DirectoryList self, string iconID, bool excluded, string dirname) : base(null, dirname, iconID, true)
 {
     this.IsExcluded = excluded;
     this.myrealself = self;
 }
示例#11
0
 public ItemViewDirectory(DirectoryList self, string dirname) : this(self, "Folder", false, dirname)
 {
 }