private void WireUpCacheEvictionEvents(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy)
        {
            cacheEventHelper.OnEvictFromCache += (sender, args) =>
            {
                if (!args.FileOnDiskHasChanged)
                {
                    return;
                }

                FileReaderAsync dummy;

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

            cacheEventHelper.OnClearCache += (sender, args) =>
            {
                _fileCache = new ConcurrentDictionary <FilePath, FileReaderAsync>();

                _log.InfoFormat("Cleared Cache");
            };

            visualStudioEventProxy.OnProjectItemAdded +=
                (sender, args) => TryEagerlyLoadFile(args.ClassFullPath);

            visualStudioEventProxy.OnProjectItemRenamed +=
                (sender, args) => TryEagerlyLoadFile(args.ClassFullPath);
        }
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);
        }
        public VisualStudioFileCache(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy, IFileWrapper fileWrapper, IVisualStudioOpenDocumentManager openDocumentManager)
        {
            _fileWrapper         = fileWrapper;
            _openDocumentManager = openDocumentManager;

            WireUpCacheEvictionEvents(cacheEventHelper, visualStudioEventProxy);
        }
Exemplo n.º 4
0
        public VisualStudioFileCache(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy, IFileWrapper fileWrapper, IVisualStudioOpenDocumentManager openDocumentManager)
        {
            _fileWrapper = fileWrapper;
            _openDocumentManager = openDocumentManager;

            WireUpCacheEvictionEvents(cacheEventHelper, visualStudioEventProxy);
        }
Exemplo n.º 5
0
        public CSharpFileFactory(IFileReader fileReader, ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy, IVisualStudioOpenDocumentManager openDocumentManager)
        {
            _fileReader          = fileReader;
            _openDocumentManager = openDocumentManager;

            WireUpCacheEvictionEvents(cacheEventHelper, visualStudioEventProxy);
        }
Exemplo n.º 6
0
        public CSharpFileFactory(IFileReader fileReader, ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy, IVisualStudioOpenDocumentManager openDocumentManager)
        {
            _fileReader = fileReader;
            _openDocumentManager = openDocumentManager;

            WireUpCacheEvictionEvents(cacheEventHelper, visualStudioEventProxy);
        }
 public CodeGeneratorFileWrapper(ICacheEventHelper cacheEventHelper) : base(cacheEventHelper)
 {
 }
Exemplo n.º 8
0
 public CodeGeneratorFileWrapper(ICacheEventHelper cacheEventHelper)
     : base(cacheEventHelper)
 {
 }
Exemplo n.º 9
0
        private void WireUpCacheEvictionEvents(ICacheEventHelper cacheEventHelper, IVisualStudioEventProxy visualStudioEventProxy)
        {
            cacheEventHelper.OnEvictFromCache += (sender, args) =>
            {
                if (!args.FileOnDiskHasChanged)
                    return;

                FileReaderAsync dummy;

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

            cacheEventHelper.OnClearCache += (sender, args) =>
            {
                _fileCache = new ConcurrentDictionary<FilePath, FileReaderAsync>();

                _log.InfoFormat("Cleared Cache");
            };

            visualStudioEventProxy.OnProjectItemAdded +=
                (sender, args) => TryEagerlyLoadFile(args.ClassFullPath);

            visualStudioEventProxy.OnProjectItemRenamed +=
                (sender, args) => TryEagerlyLoadFile(args.ClassFullPath);
        }
Exemplo n.º 10
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.º 11
0
 public FileWrapper(ICacheEventHelper cacheEventHelper)
 {
     _cacheEventHelper = cacheEventHelper;
 }