void RegisterFileToScan(IProgressStatus monitor, string file, AddinScanResult scanResult, AddinScanFolderInfo folderInfo)
        {
            if (scanResult.LocateAssembliesOnly)
            {
                return;
            }

            AddinFileInfo finfo = folderInfo.GetAddinFileInfo(file);
            bool          added = false;

            if (finfo != null && File.GetLastWriteTime(file) == finfo.LastScan && !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);
                    added = true;
                }

                if (finfo.AddinId == null || finfo.AddinId.Length == 0)
                {
                    return;
                }
                if (!finfo.IsRoot)
                {
                    if (database.AddinDescriptionExists(finfo.AddinId))
                    {
                        return;
                    }
                }
                else
                {
                    if (database.HostDescriptionExists(finfo.AddinId, file))
                    {
                        return;
                    }
                }
            }

            scanResult.ChangesFound = true;

            if (!scanResult.CheckOnly && !added)
            {
                scanResult.AddFileToScan(file, folderInfo);
            }
        }
Ejemplo n.º 2
0
        void RegisterFileToScan(IProgressStatus monitor, string file, AddinScanResult scanResult, AddinScanFolderInfo folderInfo)
        {
            if (scanResult.LocateAssembliesOnly)
            {
                return;
            }

            AddinFileInfo finfo = folderInfo.GetAddinFileInfo(file);
            bool          added = false;

            if (finfo != null && (!finfo.IsAddin || finfo.Domain == folderInfo.GetDomain(finfo.IsRoot)) && File.GetLastWriteTime(file) == finfo.LastScan && !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);
                    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.AddPathsToIgnore(finfo.IgnorePaths);
                    }
                    return;
                }
            }

            scanResult.ChangesFound = true;

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