示例#1
0
文件: Layers.cs 项目: srix/duffx
 private void radioButtonFNSimilar_CheckedChanged(object sender, EventArgs e)
 {
     if (((RadioButton)(sender)).Checked == true)
     {
         dlgCompare += compare.CompareSimilarFileName;
     }
     else
     {
         dlgCompare -= compare.CompareSimilarFileName;
     }
 }
示例#2
0
        public static T GetMax <T>(T[] items, DelegateCompare <T> del)
        {
            T max = items[0];

            for (var i = 0; i < items.Length; i++)
            {
                if (del(max, items[i]) < 0)
                {
                    max = items[i];
                }
            }
            return(max);
        }
示例#3
0
文件: Compare.cs 项目: srix/duffx
        public ArrayList Run(ArrayList files, DelegateCompare dlgCompare)
        {
            ArrayList dupFiles     = new ArrayList();
            bool      hasDuplicate = false;

            int count = files.Count;

            while (count > 1)//perform compare only if there is more than 1 file
            {
                int firstNode = 0;
                hasDuplicate = false;
                for (int j = firstNode + 1; j < count; j++)
                {
                    if (dlgCompare(((FileMetaData)files[firstNode]), ((FileMetaData)files[j]), 2) == true)
                    {
                        FileMetaData curFile = (FileMetaData)files[firstNode];
                        curFile.AddDupFiles((FileMetaData)files[j]);

                        files[firstNode] = curFile;

                        //remove duplicate file from search list
                        files.RemoveAt(j);

                        //Adjust count
                        count--;

                        //Adjust index j
                        // if (j == (i + 1))
                        j--;
                        hasDuplicate = true;
                    }
                }

                //Add the files with duplicates to dupfile arraylist
                if (true == hasDuplicate)
                {
                    dupFiles.Add(files[firstNode]);
                }

                //remove searched file from the list
                files.RemoveAt(firstNode);
                //Adjust count
                count--;
            }

            return(dupFiles);
        }
示例#4
0
文件: Layers.cs 项目: srix/duffx
 private void checkBoxFileName_CheckedChanged(object sender, EventArgs e)
 {
     radioButtonFNequal.Checked = true;
     dlgCompare += compare.CompareFileName;
 }
示例#5
0
    public void Sort(DelegateCompare shouldSwap)
    {
        bool swapped;
        int iterationCount = 0;
        do {
            iterationCount++;
            swapped = false;
            for (int i = 0; i < listModel.Count - 1; ++i) {
                if (shouldSwap(listModel[i], listModel[i + 1])) {
                    Swap(i, i + 1);
                    swapped = true;
                }
            }
        } while (swapped && iterationCount < listModel.Count);

        RemakeView();
    }