Beispiel #1
0
        public static bool Phase2Test(RvFile dbFile, RvFile testFile, EScanLevel eScanLevel, string fullDir, ThreadWorker thWrk, ref bool fileErrorAbort, out bool MatchedAlt)
        {
            MatchedAlt = false;
            //Debug.WriteLine("Comparing Dat File " + dbFile.TreeFullName);
            //Debug.WriteLine("Comparing File     " + testFile.TreeFullName);

            int retv = DBHelper.CompareName(dbFile, testFile);

            if (retv != 0)
            {
                return(false);
            }

            FileType dbfileType = dbFile.FileType;
            FileType dbtestFile = testFile.FileType;

            if (dbfileType != FileType.File || dbtestFile != FileType.File)
            {
                return(false);
            }

            Populate.FromAFile(testFile, fullDir, eScanLevel, thWrk, ref fileErrorAbort);
            if (fileErrorAbort)
            {
                return(false);
            }

            if (testFile.GotStatus == GotStatus.FileLocked)
            {
                return(false);
            }

            return(CompareWithAlt(dbFile, testFile, out MatchedAlt));
        }
Beispiel #2
0
        private static bool NewFileFound(RvFile fileChild, RvFile dbDir, int dbIndex)
        {
            if (fileChild == null)
            {
                ReportError.SendAndShow("Error in File Scanning Code.");
                return(true);
            }

            // this could be an unknown file, or dirctory.
            // if item is a directory add the directory and call back in again

            // add the newly found item
            switch (fileChild.FileType)
            {
            case FileType.Zip:
            case FileType.SevenZip:
                dbDir.ChildAdd(fileChild, dbIndex);
                CheckADir(fileChild, false);
                return(true);

            case FileType.Dir:
                dbDir.ChildAdd(fileChild, dbIndex);
                CheckADir(fileChild, true);
                return(true);

            case FileType.File:
                // if we have not read the files CRC in the checking code, we need to read it now.
                if (fileChild.GotStatus != GotStatus.FileLocked)
                {
                    if (!Utils.IsDeepScanned(fileChild))
                    {
                        Populate.FromAFile(fileChild, dbDir.FullName, EScanLevel, _thWrk, ref _fileErrorAbort);
                    }
                }
                dbDir.ChildAdd(fileChild, dbIndex);
                return(true);

            case FileType.ZipFile:
                dbDir.ChildAdd(fileChild, dbIndex);
                return(true);

            case FileType.SevenZipFile:
                if (fileChild.Name.EndsWith("/"))
                {
                    return(false);
                }
                dbDir.ChildAdd(fileChild, dbIndex);
                return(true);

            default:
                throw new Exception("Unsuported file type " + fileChild.FileType);
            }
        }