public async Task ListingDirectoryAsync(string target_directory) { root_directory = target_directory; await Task.Run(() => prelistingFolder(target_directory)); directory_list.Sort(); node = new FileIndexorNode(target_directory, 0); await Task.Run(() => createNodes()); }
private void createNodes() { for (; index < directory_list.Count - 1; index++) { FileIndexorNode _node = new FileIndexorNode(directory_list[index].Item1, directory_list[index].Item2, listing_files); if (directory_list[index + 1].Item1.Contains(directory_list[index].Item1)) { node.AddItem(_node); index += 1; createNodesRecursize(ref _node); break; } } }
public FileIndexorNode GetPathNode(string path) { string[] seperated = path.Split('\\'); string section = ""; FileIndexorNode n = node; for (int i = 0; i < seperated.Length; i++) { section += seperated[i] + '\\'; foreach (FileIndexorNode nd in n.Nodes) { if (nd.Path == section) { n = nd; break; } } } return(n); }
private void createNodesRecursize(ref FileIndexorNode parent_node) { for (; index < directory_list.Count; index++) { if (directory_list[index].Item1.Contains(parent_node.Path)) { FileIndexorNode m = new FileIndexorNode(directory_list[index].Item1, directory_list[index].Item2, listing_files); parent_node.AddItem(m); if (index < directory_list.Count - 1 && directory_list[index + 1].Item1.Contains(directory_list[index].Item1)) { index++; createNodesRecursize(ref m); } parent_node.Size += m.Size; } else { index--; break; } } }
public void AddItem(FileIndexorNode node) { nodes.Add(node); }
public void Clear() { directory_list.Clear(); error_list.Clear(); node = null; }