コード例 #1
0
        private void Candidates_AfterSelect(object sender, TreeViewEventArgs e)
        {
            Files.Items.Clear();
            Where.Nodes.Clear();
            _checked.Clear();
            List <string> folders  = new List <string>();
            long          count    = 0;
            string        selected = '/' + e.Node.FullPath;

            if (src.DuplicatesGroupByPath.ContainsKey(selected))
            {
                foreach (long group in src.DuplicatesGroupByPath[selected])
                {
                    foreach (DuplicateFileInfo s in src.DuplicatesByGroup[group])
                    {
                        if (s.FullPath.StartsWith(selected))
                        {
                            count++;
                            if (folders.Contains(s.FileName) == false && s.FileName != null)
                            {
                                folders.Add(s.FileName);
                            }
                        }
                    }
                }
            }

            OnItemStatusUpdate?.Invoke(this, string.Format("{0} duplicate(s)", count));

            Files.Items.AddRange(folders.ToArray());
            Files.SelectedIndex = -1;
        }
コード例 #2
0
        private void Files_SelectedIndexChanged(object sender, EventArgs e)
        {
            string status = string.Empty;

            Where.Nodes.Clear();
            _checked.Clear();
            if (Files.SelectedItem != null)
            {
                if (src.DuplicatesGroupByName.ContainsKey((string)Files.SelectedItem))
                {
                    foreach (long index in src.DuplicatesGroupByName[(string)Files.SelectedItem])
                    {
                        foreach (DuplicateFileInfo s in src.DuplicatesByGroup[index])
                        {
                            if (s.FileName == Files.Text)
                            {
                                status = (string)Files.SelectedItem + " " + s.Length.ToFileSizeString();
                                Where.Add(s.FullPath);
                                foreach (DuplicateFileInfo o in src.DuplicatesByGroup[index])
                                {
                                    Where.Add(o.FullPath);
                                }
                            }
                        }
                    }
                }
                Where.ExpandAll();
            }
            OnItemStatusUpdate?.Invoke(this, status);
        }