public ManagedFolder CreateFolder(string foldername) { var folder = new ManagedFolder($"{_path}\\{foldername}"); SubFolders.Add(folder); return(folder); }
AddSubFolder(TFolderMetaData subFolderMetaData) { ComponentFolder <TId, TFolderMetaData, TComponentMetaData> subFolder = new ComponentFolder <TId, TFolderMetaData, TComponentMetaData>(subFolderMetaData); SubFolders.Add(subFolder); return(subFolder); }
public FolderViewModel(string path, FolderViewModel parent = null) { Path = path; Parent = parent; if (!string.IsNullOrEmpty(path) && Directory.GetDirectories(Path).Any()) { SubFolders.Add(new FolderViewModel(string.Empty, this)); } }
//public Folder() // : this("C:") { } public Folder() { if (SubFolders == null) { SubFolders = new ObservableCollection <Folder>(); } foreach (var dir in Directory.GetLogicalDrives()) { Folder folder = new Folder(dir); SubFolders.Add(folder); } }
public void CreateSubDirectory(string subfolder) { var subdir = Path.Combine(BaseDir, subfolder); SubFolders.Add(subdir); if (!Directory.Exists(subdir)) { Directory.CreateDirectory(subdir); Logger($"Directory '{subdir}' has been created!"); } }
/// <summary> /// Selects the folder to Filter. /// </summary> internal void SelectFolder() { using (WF.FolderBrowserDialog fbd = new WF.FolderBrowserDialog()) { if (!string.IsNullOrEmpty(Properties.Settings.Default.LastTracked)) { if (Directory.Exists(Properties.Settings.Default.LastTracked)) { fbd.SelectedPath = Properties.Settings.Default.LastTracked; } } fbd.ShowNewFolderButton = false; var dr = fbd.ShowDialog(); switch (dr) { case WF.DialogResult.OK: case WF.DialogResult.Yes: WatchedFolder = fbd.SelectedPath; if (Directory.Exists(WatchedFolder)) { Status = _normalStates[1]; DirectoryInfo dInf = new DirectoryInfo(WatchedFolder); foreach (var subDir in dInf.GetDirectories("*", SearchOption.TopDirectoryOnly)) { var folder = new FolderExclude(subDir.Name, subDir.FullName) { Exclude = false }; folder.PropertyChanged += Folder_PropertyChanged; SubFolders.Add(folder); } Properties.Settings.Default.LastTracked = WatchedFolder; Properties.Settings.Default.Save(); BorderColor = Brushes.Green; } else { BorderColor = Brushes.Red; } break; default: break; } } }
/// <summary> /// Adds the subfolder structure to the subfolder list. /// </summary> private void fillSubfolders() { foreach (var child in Info.GetDirectories()) { try { SubFolders.Add(new Folder(child.FullName)); } catch (UnauthorizedAccessException) { UnavailableFolders.Add(child.FullName); } } }
private void GetSubFolders(bool value) { if (value && SubFolders.Any(o => string.IsNullOrEmpty(o.FolderName))) { SubFolders.Clear(); var subfolders = Directory.GetDirectories(Path); foreach (var item in subfolders) { try { SubFolders.Add(new FolderViewModel(item, this)); } catch (Exception e) { } } } }
public void LoadSubFolders(bool loadChild) { SubFolders.Clear(); try { foreach (var subFolderPath in _model.GetSubDirectories()) { var subFolder = new FolderViewModel(subFolderPath); if (loadChild) { subFolder.LoadSubFolders(false); } SubFolders.Add(subFolder); } } catch (Exception ex) { } }
public void AddElement(ProjectElementBase element) { if (element is Project) { Projects.Add(element as Project); element.Parent = this; return; } if (element is SolutionFolder) { SubFolders.Add(element as SolutionFolder); element.Parent = this; return; } throw new Exception("Not correct type of item"); }
public UserDirectory(string path, PackageComponentsComponentItemsFolder parentItemsFolder, bool isTopLevel) : base(path, parentItemsFolder) { IsTopLevel = isTopLevel; if (Path.Length <= 256) { if (System.IO.Directory.Exists(Path)) { foreach (var dir in System.IO.Directory.EnumerateDirectories(Path)) { SubFolders.Add(new UserDirectory(dir, parentItemsFolder, false)); } foreach (var file in System.IO.Directory.EnumerateFiles(path)) { Files.Add(new UserFile(file, parentItemsFolder)); } } } }
public void AddElementRange(IList <ProjectElementBase> elements) { foreach (ProjectElementBase e in elements) { if (e is Project) { Projects.Add(e as Project); e.Parent = this; continue; } if (e is SolutionFolder) { SubFolders.Add(e as SolutionFolder); e.Parent = this; continue; } throw new Exception("Not correct type of item"); } }
private void LoadSubFolders(DirectoryInfo dir) { SubFolders.Clear(); var securityTmp = dir.GetAccessControl(); if (!securityTmp.AreAccessRulesProtected || !securityTmp.AreAuditRulesProtected) { var subDirs = dir.GetDirectories(); if (subDirs.Length > 0) { for (int i = 0; i < subDirs.Length; i++) { if ((subDirs[i].Attributes & FileAttributes.Hidden) != FileAttributes.Hidden) { FolderElement tmpFolder = new FolderElement(new DirectoryInfo(subDirs[i].FullName)); tmpFolder.Parent = this; SubFolders.Add(tmpFolder); } } } } }
private void FillInnerFoldersList() { IEnumerable <string> dirs = null; dirs = Directory.EnumerateDirectories(Path, "*", SearchOption.TopDirectoryOnly); if (dirs != null) { try { var exceptions = new ConcurrentQueue <Exception>(); Parallel.ForEach(dirs, directory => { try { FolderItem baseFolder = new FolderItem(directory); SubFolders.Add(baseFolder); foreach (var item in baseFolder.log) { log.Add(item); } } catch (Exception e) { exceptions.Enqueue(e); } }); if (exceptions.Count > 0) { throw new AggregateException(exceptions); } } catch (AggregateException e) { throw e; } } }
public void AddItem(IFolder folder) { SubFolders.Add(folder); }
public bool CreateFolder(string name) { return(SubFolders.Add(name) != null); }