Esempio n. 1
0
 private void ClearFolder(DuplicatesFolder root)
 {
     root.Files.Clear();
     foreach (DuplicatesFolder f in root.Folders.Values)
     {
         ClearFolder(f);
     }
     root.Folders.Clear();
 }
Esempio n. 2
0
        public void Clear()
        {
            DuplicatesFolder root = this;

            while (root.Parent != null)
            {
                root = root.Parent;
            }
            ClearFolder(root);
        }
        private void BuildIndexes(long key, DuplicatesAggregate <string, long> bypath, DuplicatesAggregate <string, long> byname, DuplicatesFolder tree)
        {
            foreach (DuplicateFileInfo entry in _dupes[key])
            {
                if (entry.Path != null)
                {
                    bypath.Add(entry.Path, entry.Group);

                    DuplicatesFolder f    = tree;
                    string           path = string.Empty;
                    for (int n = 0; n < entry.FoldersInPath.Length; n++)
                    {
                        f     = f.Folders.addFolder(new DuplicatesFolder(entry.FoldersInPath[n], f));
                        path += "/" + (entry.FoldersInPath[n]);
                        //if (toc.ContainsKey(path) == false)
                        //{
                        //    toc.Add(path, f);
                        //}
                        if (path.Equals(entry.Path))
                        {
                            f.Files.Add(entry);

                            break;
                        }
                    }
                }
                else
                {
                    //identical file, but no matching path and/or name
                    var siblings = _dupes[key];
                }
                if (entry.FileName != null)
                {
                    byname.Add(entry.FileName, entry.Group);
                }
                else
                {
                    //identical file, but no matching path and/or name
                    var siblings = _dupes[key];
                }
            }
        }
Esempio n. 4
0
 internal DuplicatesFolder(string name, DuplicatesFolder parent)
 {
     _parent = parent;
     Name    = name;
     Folders = new DuplicatesFolders();
 }
        private void BuildIndexes(DuplicatesAggregate <string, long> bypath, DuplicatesAggregate <string, long> byname, DuplicatesFolder tree, Func <DuplicateFileInfo, bool> predicate = null)
        {
            bypath.Clear();
            byname.Clear();
            tree.Clear();

            if (predicate == null)
            {
                foreach (long key in _dupes.Keys)
                {
                    BuildIndexes(key, bypath, byname, tree);
                }
            }
            else
            {
                foreach (long key in _dupes.Keys)
                {
                    if (predicate(_dupes[key].First()))
                    {
                        BuildIndexes(key, bypath, byname, tree);
                    }
                }
            }
        }