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); }
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); }
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(); }
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); } } }
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); } } } } }
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); } }
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; }
internal static IEnumerable <ZipEntry> GetEntriesFromDirectory(DirectoryList directory) => GetEntriesFromDirectory(directory, SearchOption.AllDirectories);
private void Huh_RequestOpen(DirectoryList obj) { this._currentDirectory = obj; this.GenerateListCurrent(); }
public ItemViewDirectory(DirectoryList self, string iconID, bool excluded, string dirname) : base(null, dirname, iconID, true) { this.IsExcluded = excluded; this.myrealself = self; }
public ItemViewDirectory(DirectoryList self, string dirname) : this(self, "Folder", false, dirname) { }