示例#1
0
        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());
        }
示例#2
0
 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;
         }
     }
 }
示例#3
0
        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);
        }
示例#4
0
 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;
         }
     }
 }
示例#5
0
 public void AddItem(FileIndexorNode node)
 {
     nodes.Add(node);
 }
示例#6
0
 public void Clear()
 {
     directory_list.Clear();
     error_list.Clear();
     node = null;
 }