Exemplo n.º 1
0
        private void WireUpCacheEvictionEvents(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy)
        {
            cacheEventHelper.OnClearCache +=
                (sender, args) =>
            {
                _log.Info("Solution closing.  Clearing cache");
                _fileCache = new ConcurrentDictionary <FilePath, CSharpFile>();

                _fileByProjectIndex = new FileByProjectIndex();
            };

            cacheEventHelper.OnEvictFromCache +=
                (sender, args) =>
            {
                CSharpFile dummy;

                if (_fileCache.TryRemove(args.FileName, out dummy))
                {
                    _log.InfoFormat("Evicted [{0}]", args.FileName);
                }
            };

            visualStudioEventProxy.OnProjectRemoved +=
                (sender, args) => EvictAllFilesInProject(args.ProjectFullPath);

            //Evict files, their reference to the Project is no longer valid
            visualStudioEventProxy.OnProjectReferenceAdded +=
                (sender, args) => EvictAllFilesInProject(args.ProjectFullPath);

            //Evict files, their reference to the Project is no longer valid
            visualStudioEventProxy.OnProjectReferenceRemoved +=
                (sender, args) => EvictAllFilesInProject(args.ProjectFullPath);
        }
Exemplo n.º 2
0
        private void WireUpCacheEvictionEvents(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy)
        {
            cacheEventHelper.OnClearCache +=
                (sender, args) =>
                {
                    _log.Info("Solution closing.  Clearing cache");
                    _fileCache = new ConcurrentDictionary<FilePath, CSharpFile>();

                    _fileByProjectIndex = new FileByProjectIndex();
                };

            cacheEventHelper.OnEvictFromCache +=
                (sender, args) =>
                {
                    CSharpFile dummy;

                    if (_fileCache.TryRemove(args.FileName, out dummy))
                        _log.InfoFormat("Evicted [{0}]", args.FileName);
                };

            visualStudioEventProxy.OnProjectRemoved +=
                (sender, args) => EvictAllFilesInProject(args.ProjectFullPath);

            //Evict files, their reference to the Project is no longer valid
            visualStudioEventProxy.OnProjectReferenceAdded +=
                (sender, args) => EvictAllFilesInProject(args.ProjectFullPath);

            //Evict files, their reference to the Project is no longer valid
            visualStudioEventProxy.OnProjectReferenceRemoved +=
                (sender, args) => EvictAllFilesInProject(args.ProjectFullPath);
        }