示例#1
0
        private void BroadcastChange(
            Dictionary <string, IProjectRuleSnapshotModel>?projectSnapshot = null,
            Dictionary <string, IProjectRuleSnapshotModel>?sourceSnapshot  = null,
            bool disableFastUpToDateCheck = false)
        {
            projectSnapshot ??= new Dictionary <string, IProjectRuleSnapshotModel>();

            if (!projectSnapshot.ContainsKey(ConfigurationGeneral.SchemaName))
            {
                projectSnapshot[ConfigurationGeneral.SchemaName] = new IProjectRuleSnapshotModel
                {
                    Properties = ImmutableStringDictionary <string> .EmptyOrdinal
                                 .Add("MSBuildProjectFullPath", _msBuildProjectFullPath)
                                 .Add("MSBuildProjectDirectory", _msBuildProjectDirectory)
                                 .Add("MSBuildAllProjects", _msBuildAllProjects)
                                 .Add("OutputPath", _outputPath)
                                 .Add("DisableFastUpToDateCheck", disableFastUpToDateCheck.ToString())
                };
            }

            var value = IProjectVersionedValueFactory.Create(
                Tuple.Create(
                    CreateUpdate(projectSnapshot),
                    CreateUpdate(sourceSnapshot),
                    IProjectItemSchemaFactory.Create(_itemTypes)),
                identity: ProjectDataSources.ConfiguredProjectVersion,
                version: _projectVersion);

            _buildUpToDateCheck.OnChanged(value);

            return;
        private void BroadcastChange(
            Dictionary <string, IProjectRuleSnapshotModel> projectSnapshot = null,
            Dictionary <string, IProjectRuleSnapshotModel> sourceSnapshot  = null,
            bool disableFastUpToDateCheck = false)
        {
            projectSnapshot = projectSnapshot ?? new Dictionary <string, IProjectRuleSnapshotModel>();

            if (!projectSnapshot.ContainsKey(ConfigurationGeneral.SchemaName))
            {
                projectSnapshot[ConfigurationGeneral.SchemaName] = new IProjectRuleSnapshotModel
                {
                    Properties = ImmutableStringDictionary <string> .EmptyOrdinal
                                 .Add("MSBuildProjectFullPath", _msBuildProjectFullPath)
                                 .Add("MSBuildProjectDirectory", _msBuildProjectDirectory)
                                 .Add("MSBuildAllProjects", _msBuildAllProjects)
                                 .Add("OutputPath", _outputPath)
                                 .Add("DisableFastUpToDateCheck", disableFastUpToDateCheck.ToString())
                };
            }

            var value = IProjectVersionedValueFactory <
                Tuple <
                    IProjectSubscriptionUpdate,
                    IProjectSubscriptionUpdate,
                    IProjectItemSchema> > .Create(
                Tuple.Create(
                    CreateUpdate(projectSnapshot),
                    CreateUpdate(sourceSnapshot),
                    IProjectItemSchemaFactory.Create(_itemTypes)),
                identity : ProjectDataSources.ConfiguredProjectVersion,
                version : _projectVersion);

            _buildUpToDateCheck.OnChanged(value);

            return;

            IProjectSubscriptionUpdate CreateUpdate(Dictionary <string, IProjectRuleSnapshotModel> snapshotBySchemaName)
            {
                var snapshots = ImmutableDictionary <string, IProjectRuleSnapshot> .Empty;
                var changes   = ImmutableDictionary <string, IProjectChangeDescription> .Empty;

                if (snapshotBySchemaName != null)
                {
                    foreach ((string schemaName, IProjectRuleSnapshotModel model) in snapshotBySchemaName)
                    {
                        var change = new IProjectChangeDescriptionModel
                        {
                            After      = model,
                            Difference = new IProjectChangeDiffModel {
                                AnyChanges = true
                            }
                        };

                        snapshots = snapshots.Add(schemaName, model.ToActualModel());
                        changes   = changes.Add(schemaName, change.ToActualModel());
                    }
                }
                return(IProjectSubscriptionUpdateFactory.Implement(snapshots, changes));
            }
        }