示例#1
0
        public ProjectManager(ILoggerFactory loggerFactory,
                              MSBuildOptions options,
                              IEventEmitter eventEmitter,
                              IFileSystemWatcher fileSystemWatcher,
                              MetadataFileReferenceCache metadataFileReferenceCache,
                              PackageDependencyChecker packageDependencyChecker,
                              ProjectLoader projectLoader,
                              OmniSharpWorkspace workspace,
                              ImmutableArray <IMSBuildEventSink> eventSinks)
        {
            _logger                     = loggerFactory.CreateLogger <ProjectManager>();
            _options                    = options ?? new MSBuildOptions();
            _eventEmitter               = eventEmitter;
            _fileSystemWatcher          = fileSystemWatcher;
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _packageDependencyChecker   = packageDependencyChecker;
            _projectFiles               = new ProjectFileInfoCollection();
            _failedToLoadProjectFiles   = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            _projectsRequestedOnDemand  = new ConcurrentDictionary <string, int>(StringComparer.OrdinalIgnoreCase);
            _projectLoader              = projectLoader;
            _workspace                  = workspace;
            _eventSinks                 = eventSinks;

            _queue = new BufferBlock <ProjectToUpdate>();
            _processLoopCancellation = new CancellationTokenSource();
            _processLoopTask         = Task.Run(() => ProcessLoopAsync(_processLoopCancellation.Token));

            _onDirectoryFileChanged = OnDirectoryFileChanged;

            if (_options.LoadProjectsOnDemand)
            {
                _workspace.AddWaitForProjectModelReadyHandler(WaitForProjectModelReadyAsync);
            }
        }
 public void Add(FileSystemNotificationCallback callback)
 {
     if (_callbackSet.Add(callback))
     {
         _callbacks.Add(callback);
     }
 }
        public void Watch(string fileOrDirectoryPath, FileSystemNotificationCallback callback)
        {
            lock (_gate)
            {
                if (_callbacks.TryGetValue(fileOrDirectoryPath, out var existingCallback))
                {
                    callback = callback + existingCallback;
                }

                _callbacks[fileOrDirectoryPath] = callback;
            }
        }
        public void Watch(string pathOrExtension, FileSystemNotificationCallback callback)
        {
            lock (_gate)
            {
                if (_callbacks.TryGetValue(pathOrExtension, out var existingCallback))
                {
                    callback = callback + existingCallback;
                }

                _callbacks[pathOrExtension] = callback;
            }
        }
        public ProjectManager(ILoggerFactory loggerFactory, IEventEmitter eventEmitter, IFileSystemWatcher fileSystemWatcher, MetadataFileReferenceCache metadataFileReferenceCache, PackageDependencyChecker packageDependencyChecker, ProjectLoader projectLoader, OmniSharpWorkspace workspace)
        {
            _logger                     = loggerFactory.CreateLogger <ProjectManager>();
            _eventEmitter               = eventEmitter;
            _fileSystemWatcher          = fileSystemWatcher;
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _packageDependencyChecker   = packageDependencyChecker;
            _projectFiles               = new ProjectFileInfoCollection();
            _projectLoader              = projectLoader;
            _workspace                  = workspace;

            _queue = new BufferBlock <ProjectToUpdate>();
            _processLoopCancellation = new CancellationTokenSource();
            _processLoopTask         = Task.Run(() => ProcessLoopAsync(_processLoopCancellation.Token));

            _onDirectoryFileChanged = OnDirectoryFileChanged;
        }
示例#6
0
        public ProjectManager(ILoggerFactory loggerFactory, IEventEmitter eventEmitter, IFileSystemWatcher fileSystemWatcher, MetadataFileReferenceCache metadataFileReferenceCache, PackageDependencyChecker packageDependencyChecker, ProjectLoader projectLoader, OmniSharpWorkspace workspace, ImmutableArray <IMSBuildEventSink> eventSinks)
        {
            _logger                     = loggerFactory.CreateLogger <ProjectManager>();
            _eventEmitter               = eventEmitter;
            _fileSystemWatcher          = fileSystemWatcher;
            _metadataFileReferenceCache = metadataFileReferenceCache;
            _packageDependencyChecker   = packageDependencyChecker;
            _projectFiles               = new ProjectFileInfoCollection();
            _failedToLoadProjectFiles   = new HashSet <string>(StringComparer.OrdinalIgnoreCase);
            _projectLoader              = projectLoader;
            _workspace                  = workspace;
            _eventSinks                 = eventSinks;

            _queue = new BufferBlock <ProjectToUpdate>();
            _processLoopCancellation = new CancellationTokenSource();
            _processLoopTask         = Task.Run(() => ProcessLoopAsync(_processLoopCancellation.Token));

            _onDirectoryFileChanged = OnDirectoryFileChanged;
        }
示例#7
0
        public void Watch(string pathOrExtension, FileSystemNotificationCallback callback)
        {
            if (pathOrExtension == null)
            {
                throw new ArgumentNullException(nameof(pathOrExtension));
            }

            if (callback == null)
            {
                throw new ArgumentNullException(nameof(callback));
            }

            lock (_gate)
            {
                if (!_callbacksMap.TryGetValue(pathOrExtension, out var callbacks))
                {
                    callbacks = new Callbacks();
                    _callbacksMap.Add(pathOrExtension, callbacks);
                }

                callbacks.Add(callback);
            }
        }
 public void WatchDirectories(FileSystemNotificationCallback callback)
 {
 }
 public void Watch(string pathOrExtension, FileSystemNotificationCallback callback)
 {
 }
示例#10
0
 public void WatchDirectories(FileSystemNotificationCallback callback)
 {
     _folderCallbacks.Add(callback);
 }