예제 #1
0
        static void FileProcessor(int threadIndex)
        {
            Tuple <FileInfo, DirectoryFingerprint> file;

            // int filesProcessedByThisThread = 0;

            while ((file = fst.NextFile()) != null)
            {
                FileInfo             fi = file.Item1;
                DirectoryFingerprint parentFingerprint = file.Item2;

                // TODO: check if file should be skipped

                string fileChecksum = ComputeFingerprint.FileChecksum(fi.FullName);
                if (fileChecksum == "")
                {
                    parentFingerprint.ChildFileSkipped();
                }
                else
                {
                    progress.FileCompleted(fi, fileChecksum);
                    parentFingerprint.FileCompleted(fileChecksum);

                    // filesProcessedByThisThread++;
                }
            }

            // Console.WriteLine("\nThread {0} completed - {1} files processed\n", threadIndex, filesProcessedByThisThread);
            progress.ThreadCompleted();
        }
예제 #2
0
        static void FileProcessor(int threadIndex)
        {
            Tuple <FileInfo, DirectoryFingerprint> file;

            // int filesProcessedByThisThread = 0;

            while ((file = fst.NextFile()) != null)
            {
                FileInfo             fi = file.Item1;
                DirectoryFingerprint parentFingerprint = file.Item2;

                // TODO: check if file should be skipped

                string fileChecksum = ComputeFingerprint.FileChecksum(fi.FullName);
                if (fileChecksum == "")
                {
                    parentFingerprint.ChildFileSkipped();
                }
                else
                {
                    string originalFilePath;
                    if (db.IsUniqueFile(fi, fileChecksum, volumeName, out originalFilePath))
                    {
                        string destinationFullName, category;
                        CopyUniqueFile.Copy(fi.FullName, out destinationFullName, out category);

                        progress.UniqueFileCompleted(fi, destinationFullName, fileChecksum, category);
                    }
                    else
                    {
                        progress.DuplicateFileCompleted(fi, originalFilePath, fileChecksum);
                    }

                    parentFingerprint.FileCompleted(fileChecksum);
                }
            }


            progress.ThreadCompleted();
        }