Esempio n. 1
0
        public void AddFileToScan(string file, AddinScanFolderInfo folderInfo, AddinScanData scanData)
        {
            FileToScan di = new FileToScan();

            di.File = file;
            di.AddinScanFolderInfo = folderInfo;
            di.ScanDataMD5         = scanData?.MD5;
            FilesToScan.Add(di);
            RegisterModifiedFolderInfo(folderInfo);
        }
Esempio n. 2
0
        void RegisterFileToScan(IProgressStatus monitor, string file, AddinScanFolderInfo folderInfo, AddinScanData scanData)
        {
            AddinFileInfo finfo = folderInfo.GetAddinFileInfo(file);
            bool          added = false;

            if (finfo != null && (!finfo.IsAddin || finfo.Domain == folderInfo.GetDomain(finfo.IsRoot)) && !finfo.HasChanged(FileSystem, scanData?.MD5) && !scanResult.RegenerateAllData)
            {
                if (finfo.ScanError)
                {
                    // Always schedule the file for scan if there was an error in a previous scan.
                    // However, don't set ChangesFound=true, in this way if there isn't any other
                    // change in the registry, the file won't be scanned again.
                    scanResult.AddFileToScan(file, folderInfo, scanData);
                    added = true;
                }

                if (!finfo.IsAddin)
                {
                    return;
                }

                if (database.AddinDescriptionExists(finfo.Domain, finfo.AddinId))
                {
                    // It is an add-in and it has not changed. Paths in the ignore list
                    // are still valid, so they can be used.
                    if (finfo.IgnorePaths != null)
                    {
                        scanResult.ScanContext.AddPathsToIgnore(finfo.IgnorePaths);
                    }
                    return;
                }
            }

            scanResult.ChangesFound = true;

            if (!scanResult.CheckOnly && !added)
            {
                scanResult.AddFileToScan(file, folderInfo, scanData);
            }
        }