Exemple #1
0
        public async Task SendAsync(T value)
        {
            EnsureInitialized(true);

            _version++;
            await _broadcastBlock.SendAsync(new ProjectVersionedValue <T>(
                                                value,
                                                ImmutableDictionary <NamedIdentity, IComparable> .Empty.Add(DataSourceKey, _version)));
        }
        private async Task ProcessProjectChanged(IProjectVersionedValue <IProjectSubscriptionUpdate> projectSnapshot)
        {
            if (projectSnapshot.Value.CurrentState.TryGetValue(PotentialEditorConfigFiles.SchemaName, out IProjectRuleSnapshot ruleSnapshot))
            {
                var builder = ImmutableList.CreateBuilder <string>();
                foreach (var item in ruleSnapshot.Items)
                {
                    IImmutableDictionary <string, string> metadata = item.Value;
                    string fileFullPath = metadata.TryGetValue("DefiningProjectDirectory", out string definingProjectDirectory)
                        ? MakeRooted(definingProjectDirectory, item.Key)
                        : _project.UnconfiguredProject.MakeRooted(item.Key);

                    builder.Add(fileFullPath);
                }

                var fileWatchProvider = new FileWatchData(this, builder.ToImmutable(), FileWatchChangeKinds.Added | FileWatchChangeKinds.Removed);
                _version++;
                ImmutableDictionary <NamedIdentity, IComparable> dataSources = ImmutableDictionary <NamedIdentity, IComparable> .Empty.Add(DataSourceKey, DataSourceVersion);

                await _broadcastBlock.SendAsync(new ProjectVersionedValue <FileWatchData>(fileWatchProvider, dataSources));
            }
        }