Ejemplo n.º 1
0
        public void Clear()
        {
            FileCheckedCount = 0;

            NewFiles.Clear();
            NewFilesForGroom.Clear();
            ChangedFiles.Clear();
            MissingFiles.Clear();
            LastModifiedDateFiles.Clear();
            ErrorFiles.Clear();
            IgnoredFiles.Clear();
            NewlyIgnoredFiles.Clear();
            IgnoredFilesForGroom.Clear();
            MovedFiles.Clear();
            MovedFileOrder.Clear();
            DuplicateFiles.Clear();
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Returns FileScans that are not consistent with the FileList
        /// </summary>
        /// <returns></returns>
        public List <FileScan> Scan()
        {
            int             listCount        = FileList.Count;
            List <FileScan> scanResults      = ScanDirectory(DirectoryToMonitor);
            List <FileScan> outOfDateResults = new List <FileScan>(scanResults.Count);

            bool[] accountedFor = new bool[listCount];
            for (int i = 0; i < listCount; i++)
            {
                accountedFor[i] = false;
            }

            // Find all out of date and deleted files
            int index;

            for (int i = 0; i < scanResults.Count; i++)
            {
                FileScan scanResult = scanResults[i];
                index = FindInList(scanResult.FileName);
                if (index < 0)
                {
                    outOfDateResults.Add(scanResult);
                }
                else
                if (LazyMode)
                {
                    if (FileList[index].ProcessedBytes < scanResult.Bytes ||
                        FileList[index].Bytes != scanResult.Bytes ||
                        FileList[index].TimeOfModification != scanResult.TimeOfModification)
                    {
                        scanResult.ProcessedBytes = FileList[index].ProcessedBytes;
                        outOfDateResults.Add(scanResult);
                        accountedFor[index] = true;
                    }
                    else
                    {
                        accountedFor[index] = true;
                    }
                }
                else
                {
                    if (FileList[index].ProcessedBytes < scanResult.Bytes ||
                        FileList[index].Hash != scanResult.Hash)
                    {
                        scanResult.ProcessedBytes = FileList[index].ProcessedBytes;
                        outOfDateResults.Add(scanResult);
                        accountedFor[index] = true;
                    }
                    else
                    {
                        accountedFor[index] = true;
                    }
                }
            }

            MissingFiles.Clear();
            for (int i = 0; i < listCount; i++)
            {
                if (!accountedFor[i])
                {
                    MissingFiles.Add(FileList[i]);
                }
            }
            return(outOfDateResults);
        }