コード例 #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
                {
                    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();
        }