public static async Task <IEntityValue?> CreatePropertyPageValueAsync(
            IQueryExecutionContext queryExecutionContext,
            EntityIdentity id,
            IProjectService2 projectService,
            IProjectStateProvider projectStateProvider,
            QueryProjectPropertiesContext propertiesContext,
            string propertyPageName,
            IPropertyPagePropertiesAvailableStatus requestedProperties)
        {
            if (projectService.GetLoadedProject(propertiesContext.File) is UnconfiguredProject project)
            {
                project.GetQueryDataVersion(out string versionKey, out long versionNumber);
                queryExecutionContext.ReportInputDataVersion(versionKey, versionNumber);

                if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog &&
                    projectCatalog.GetSchema(propertyPageName) is Rule rule &&
                    !rule.PropertyPagesHidden)
                {
                    IProjectState projectState      = projectStateProvider.CreateState(project);
                    IEntityValue  propertyPageValue = CreatePropertyPageValue(queryExecutionContext, id, projectState, propertiesContext, rule, requestedProperties);
                    return(propertyPageValue);
                }
            }

            return(null);
        }
Beispiel #2
0
            static void assertEqual(IEntityValue entity, string expectedDisplayName, string expectedValue)
            {
                var supportedValueEntity = (SupportedValueValue)entity;

                Assert.Equal(expectedDisplayName, supportedValueEntity.DisplayName);
                Assert.Equal(expectedValue, supportedValueEntity.Value);
            }
Beispiel #3
0
            static void assertEqual(IEntityValue entity, string expectedName, string expectedDisplayName)
            {
                var categoryEntity = (CategoryValue)entity;

                Assert.Equal(expectedName, categoryEntity.Name);
                Assert.Equal(expectedDisplayName, categoryEntity.DisplayName);
            }
Beispiel #4
0
        public static async Task <IEnumerable <IEntityValue> > CreateUIPropertyValueValuesAsync(
            IEntityValue parent,
            IPropertyPageQueryCache cache,
            Rule schema,
            string propertyName,
            IUIPropertyValuePropertiesAvailableStatus requestedProperties)
        {
            ImmutableList <IEntityValue> .Builder builder = ImmutableList.CreateBuilder <IEntityValue>();

            if (await cache.GetKnownConfigurationsAsync() is IImmutableSet <ProjectConfiguration> knownConfigurations)
            {
                foreach (ProjectConfiguration knownConfiguration in knownConfigurations)
                {
                    if (await cache.BindToRule(knownConfiguration, schema.Name) is IRule rule &&
                        rule.GetProperty(propertyName) is ProjectSystem.Properties.IProperty property)
                    {
                        IEntityValue propertyValue = await CreateUIPropertyValueValueAsync(parent, knownConfiguration, property, requestedProperties);

                        builder.Add(propertyValue);
                    }
                }
            }

            return(builder.ToImmutable());
        }
        public static async Task <IEnumerable <IEntityValue> > CreatePropertyPageValuesAsync(
            IQueryExecutionContext queryExecutionContext,
            IEntityValue parent,
            UnconfiguredProject project,
            IProjectStateProvider projectStateProvider,
            IPropertyPagePropertiesAvailableStatus requestedProperties)
        {
            if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog)
            {
                return(createPropertyPageValuesAsync());
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createPropertyPageValuesAsync()
            {
                IProjectState projectState = projectStateProvider.CreateState(project);
                QueryProjectPropertiesContext propertiesContext = new QueryProjectPropertiesContext(isProjectFile: true, project.FullPath, itemType: null, itemName: null);

                foreach (string schemaName in projectCatalog.GetProjectLevelPropertyPagesSchemas())
                {
                    if (projectCatalog.GetSchema(schemaName) is Rule rule &&
                        !rule.PropertyPagesHidden)
                    {
                        IEntityValue propertyPageValue = CreatePropertyPageValue(queryExecutionContext, parent, projectState, propertiesContext, rule, requestedProperties: requestedProperties);
                        yield return(propertyPageValue);
                    }
                }
            }
        }
 protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IEntityValue parent, PropertyValueProviderState providerState)
 {
     return(Task.FromResult(ConfigurationDimensionDataProducer.CreateProjectConfigurationDimensions(
                                parent,
                                providerState.ProjectConfiguration,
                                providerState.Property,
                                _properties)));
 }
 public static IEnumerable <IEntityValue> CreateMetadataValues(IEntityValue parent, ValueEditor editor, IUIEditorMetadataPropertiesAvailableStatus requestedProperties)
 {
     foreach (NameValuePair metadataPair in editor.Metadata)
     {
         IEntityValue metadataValue = CreateMetadataValue(parent.EntityRuntime, metadataPair, requestedProperties);
         yield return(metadataValue);
     }
 }
 public static IEnumerable <IEntityValue> CreateProjectConfigurationDimensions(IEntityRuntimeModel runtimeModel, ProjectConfiguration configuration, IConfigurationDimensionPropertiesAvailableStatus requestedProperties)
 {
     foreach (KeyValuePair <string, string> dimension in configuration.Dimensions)
     {
         IEntityValue projectConfigurationDimension = CreateProjectConfigurationDimension(runtimeModel, dimension, requestedProperties);
         yield return(projectConfigurationDimension);
     }
 }
Beispiel #9
0
        protected override async Task ExecuteAsync(IEntityValue projectEntity, ILaunchSettingsActionService launchSettingsActionService, CancellationToken cancellationToken)
        {
            ILaunchProfile?newLaunchProfile = await launchSettingsActionService.AddLaunchProfileAsync(_executableStep.CommandName, _executableStep.NewProfileName, cancellationToken);

            if (newLaunchProfile is not null)
            {
                AddedLaunchProfiles.Add((projectEntity, newLaunchProfile));
            }
        }
Beispiel #10
0
 protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IEntityValue parent, PropertyProviderState providerState)
 {
     return(UIPropertyValueDataProducer.CreateUIPropertyValueValuesAsync(
                parent,
                providerState.Cache,
                providerState.ContainingRule,
                providerState.PropertyName,
                _properties));
 }
Beispiel #11
0
 public static EntityIdentity CreateLaunchProfileId(IEntityValue parent, string itemType, string itemName)
 {
     return(new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new Dictionary <string, string>
     {
         { ProjectModelIdentityKeys.SourceItemType, itemType },
         { ProjectModelIdentityKeys.SourceItemName, itemName }
     }));
 }
Beispiel #12
0
        public static async Task <IEnumerable <IEntityValue> > CreateUIPropertyValueValuesAsync(
            IQueryExecutionContext queryExecutionContext,
            IEntityValue parent,
            IProjectState cache,
            Rule schema,
            QueryProjectPropertiesContext propertiesContext,
            string propertyName,
            IUIPropertyValuePropertiesAvailableStatus requestedProperties)
        {
            BaseProperty?unboundProperty = schema.GetProperty(propertyName);

            if (unboundProperty is null)
            {
                return(ImmutableList <IEntityValue> .Empty);
            }

            ImmutableList <IEntityValue> .Builder builder = ImmutableList.CreateBuilder <IEntityValue>();

            IEnumerable <ProjectConfiguration> configurations;

            if (unboundProperty.IsConfigurationDependent())
            {
                // Return the values across all configurations.
                configurations = await cache.GetKnownConfigurationsAsync() ?? Enumerable.Empty <ProjectConfiguration>();
            }
            else
            {
                // Return the value from any one configuration.
                if (await cache.GetSuggestedConfigurationAsync() is ProjectConfiguration defaultConfiguration)
                {
                    configurations = CreateSingleItemEnumerable(defaultConfiguration);
                }
                else
                {
                    configurations = Enumerable.Empty <ProjectConfiguration>();
                }
            }

            foreach (ProjectConfiguration configuration in configurations)
            {
                if (await cache.GetDataVersionAsync(configuration) is (string versionKey, long versionNumber))
                {
                    queryExecutionContext.ReportInputDataVersion(versionKey, versionNumber);
                }

                if (await cache.BindToRuleAsync(configuration, schema.Name, propertiesContext) is IRule rule &&
                    rule.GetProperty(propertyName) is ProjectSystem.Properties.IProperty property)
                {
                    IEntityValue propertyValue = await CreateUIPropertyValueValueAsync(parent, configuration, property, requestedProperties);

                    builder.Add(propertyValue);
                }
            }

            return(builder.ToImmutable());
        public static IEntityValue CreateUIPropertyValue(IEntityValue parent, IPropertyPageQueryCache cache, BaseProperty property, int order, IUIPropertyPropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(property, nameof(property));

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new KeyValuePair <string, string>[]
            {
                new(ProjectModelIdentityKeys.UIPropertyName, property.Name)
            });
Beispiel #14
0
        public static IEntityValue CreateEditorValue(IEntityValue parent, ValueEditor editor, IUIPropertyEditorPropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(editor, nameof(editor));

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new KeyValuePair <string, string>[]
            {
                new(ProjectModelIdentityKeys.EditorName, editor.EditorType)
            });
Beispiel #15
0
        private IEntityValue CreateLaunchProfileTypeValue(IEntityValue parent, string commandName, Rule rule)
        {
            EntityIdentity identity = new(
                ((IEntityWithId)parent).Id,
                new Dictionary <string, string>
            {
                { ProjectModelIdentityKeys.LaunchProfileTypeName, commandName }
            });

            return(CreateLaunchProfileTypeValue(parent.EntityRuntime, identity, commandName, rule));
        }
        public static IEntityValue CreatePropertyPageValue(IEntityValue parent, IPropertyPageQueryCache cache, Rule rule, IPropertyPagePropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(rule, nameof(rule));

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new KeyValuePair <string, string>[]
            {
                new(ProjectModelIdentityKeys.PropertyPageName, rule.Name)
            });
        public static IEntityValue CreateCategoryValue(IEntityValue parent, Category category, int order, ICategoryPropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(category, nameof(category));

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new KeyValuePair <string, string>[]
            {
                new(ProjectModelIdentityKeys.CategoryName, category.Name)
            });
Beispiel #18
0
        public static async Task <IEntityValue> CreateUIPropertyValueValueAsync(IEntityValue parent, ProjectConfiguration configuration, ProjectSystem.Properties.IProperty property, IUIPropertyValuePropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(configuration, nameof(configuration));
            Requires.NotNull(property, nameof(property));

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                Enumerable.Empty <KeyValuePair <string, string> >());

            return(await CreateUIPropertyValueValueAsync(parent.EntityRuntime, identity, configuration, property, requestedProperties));
        }
Beispiel #19
0
        public async Task <IEnumerable <IEntityValue> > RetrieveAllLaunchProfileEntitiesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, ILaunchProfilePropertiesAvailableStatus requestedProperties)
        {
            if (await _project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog)
            {
                ILaunchSettings launchSettings = await _launchSettingsProvider.WaitForFirstSnapshot();

                return(createLaunchProfileValues(launchSettings));
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createLaunchProfileValues(ILaunchSettings launchSettings)
            {
                Dictionary <string, Rule> debugRules = new();

                foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog))
                {
                    if (rule.Metadata.TryGetValue(s_commandNameMetadataName, out object?commandNameObj) &&
                        commandNameObj is string commandName)
                    {
                        debugRules[commandName] = rule;
                    }
                }

                if (launchSettings is IVersionedLaunchSettings versionedLaunchSettings)
                {
                    queryExecutionContext.ReportInputDataVersion(_launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);
                }

                IProjectState projectState = new LaunchProfileProjectState(_project, _launchSettingsProvider, _launchSettingsTracker);

                foreach ((int index, ProjectSystem.Debug.ILaunchProfile profile) in launchSettings.Profiles.WithIndices())
                {
                    if (!Strings.IsNullOrEmpty(profile.Name) &&
                        !Strings.IsNullOrEmpty(profile.CommandName) &&
                        debugRules.TryGetValue(profile.CommandName, out Rule rule))
                    {
                        QueryProjectPropertiesContext propertiesContext = new(
                            isProjectFile : true,
                            file : _project.FullPath,
                            itemType : LaunchProfileProjectItemProvider.ItemType,
                            itemName : profile.Name);

                        EntityIdentity id = CreateLaunchProfileId(parent, profile.Name);
                        IEntityValue   launchProfileValue = CreateLaunchProfileValue(queryExecutionContext, id, propertiesContext, rule, index, projectState, requestedProperties);
                        yield return(launchProfileValue);
                    }
                }
            }
        }
        private async Task <IEnumerable <IEntityValue> > CreateLaunchProfileValuesAsync(IQueryExecutionContext queryExecutionContext, IEntityValue parent, UnconfiguredProject project)
        {
            if (project.Services.ExportProvider.GetExportedValueOrDefault <ILaunchSettingsProvider>() is ILaunchSettingsProvider launchSettingsProvider &&
                project.Services.ExportProvider.GetExportedValueOrDefault <LaunchSettingsTracker>() is LaunchSettingsTracker launchSettingsTracker &&
                await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog &&
                await launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite) is ILaunchSettings launchSettings)
            {
                return(createLaunchProfileValues());
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createLaunchProfileValues()
            {
                Dictionary <string, Rule> debugRules = new();

                foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog))
                {
                    if (rule.Metadata.TryGetValue("CommandName", out object?commandNameObj) &&
                        commandNameObj is string commandName)
                    {
                        debugRules[commandName] = rule;
                    }
                }

                if (launchSettings is IVersionedLaunchSettings versionedLaunchSettings)
                {
                    queryExecutionContext.ReportInputDataVersion(launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);
                }

                IProjectState projectState = new LaunchProfileProjectState(project, launchSettingsProvider, launchSettingsTracker);

                foreach ((int index, ProjectSystem.Debug.ILaunchProfile profile) in launchSettings.Profiles.WithIndices())
                {
                    if (!Strings.IsNullOrEmpty(profile.Name) &&
                        !Strings.IsNullOrEmpty(profile.CommandName) &&
                        debugRules.TryGetValue(profile.CommandName, out Rule rule))
                    {
                        QueryProjectPropertiesContext propertiesContext = new(
                            isProjectFile : true,
                            file : project.FullPath,
                            itemType : LaunchProfileProjectItemProvider.ItemType,
                            itemName : profile.Name);

                        IEntityValue launchProfileValue = CreateLaunchProfileValue(queryExecutionContext, parent, propertiesContext, rule, index, projectState);
                        yield return(launchProfileValue);
                    }
                }
            }
        }
Beispiel #21
0
        public async Task <IEntityValue?> RetrieveLaunchProfileEntityAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id, ILaunchProfilePropertiesAvailableStatus requestedProperties)
        {
            string desiredProfileName = ValidateIdAndExtractProfileName(id);

            if (await _project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog)
            {
                ILaunchSettings launchSettings = await _launchSettingsProvider.WaitForFirstSnapshot();

                if (launchSettings is IVersionedLaunchSettings versionedLaunchSettings)
                {
                    queryExecutionContext.ReportInputDataVersion(_launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);

                    IProjectState projectState = new LaunchProfileProjectState(_project, _launchSettingsProvider, _launchSettingsTracker);

                    foreach ((int index, ProjectSystem.Debug.ILaunchProfile profile) in launchSettings.Profiles.WithIndices())
                    {
                        if (StringComparers.LaunchProfileNames.Equals(profile.Name, desiredProfileName) &&
                            !Strings.IsNullOrEmpty(profile.CommandName))
                        {
                            foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog))
                            {
                                if (rule.Metadata.TryGetValue(s_commandNameMetadataName, out object?commandNameObj) &&
                                    commandNameObj is string commandName &&
                                    StringComparers.LaunchProfileCommandNames.Equals(commandName, profile.CommandName))
                                {
                                    QueryProjectPropertiesContext propertiesContext = new(
                                        isProjectFile : true,
                                        file : _project.FullPath,
                                        itemType : LaunchProfileProjectItemProvider.ItemType,
                                        itemName : profile.Name);

                                    IEntityValue launchProfileValue = CreateLaunchProfileValue(
                                        queryExecutionContext,
                                        id,
                                        propertiesContext,
                                        rule,
                                        index,
                                        projectState,
                                        requestedProperties);
                                    return(launchProfileValue);
                                }
                            }
                        }
                    }
                }
            }

            return(null);
        }
Beispiel #22
0
        public static IEnumerable <IEntityValue> CreateProjectConfigurationDimensions(IEntityValue parent, ProjectConfiguration configuration, ProjectSystem.Properties.IProperty property, IConfigurationDimensionPropertiesAvailableStatus requestedProperties)
        {
            // If the property is configuration-independent then report no dimensions;
            // the parent property value applies to all configurations.
            if (!property.DataSource.HasConfigurationCondition)
            {
                yield break;
            }

            foreach (KeyValuePair <string, string> dimension in configuration.Dimensions)
            {
                IEntityValue projectConfigurationDimension = CreateProjectConfigurationDimension(parent.EntityRuntime, dimension, requestedProperties);
                yield return(projectConfigurationDimension);
            }
        }
        public static IEntityValue CreatePropertyPageValue(IEntityValue parent, IPropertyPageQueryCache cache, Rule rule, List <Rule>?debugChildRules, IPropertyPagePropertiesAvailableStatus requestedProperties)
        {
            Requires.NotNull(parent, nameof(parent));
            Requires.NotNull(rule, nameof(rule));

            string name = rule.PageTemplate == "debuggerParent"
                ? DebugUtilities.ConvertRealPageNameToDebugPageName(rule.Name)
                : rule.Name;

            var identity = new EntityIdentity(
                ((IEntityWithId)parent).Id,
                new KeyValuePair <string, string>[]
            {
                new(ProjectModelIdentityKeys.PropertyPageName, name)
            });
        public static async Task <IEnumerable <IEntityValue> > CreateSupportedValuesAsync(IEntityRuntimeModel runtimeModel, ProjectSystem.Properties.IEnumProperty enumProperty, ISupportedValuePropertiesAvailableStatus requestedProperties)
        {
            ReadOnlyCollection <ProjectSystem.Properties.IEnumValue> enumValues = await enumProperty.GetAdmissibleValuesAsync();

            return(createSupportedValues());

            IEnumerable <IEntityValue> createSupportedValues()
            {
                foreach (ProjectSystem.Properties.IEnumValue value in enumValues)
                {
                    IEntityValue supportedValue = CreateSupportedValue(runtimeModel, value, requestedProperties);
                    yield return(supportedValue);
                }
            }
        }
Beispiel #25
0
        private async Task <IEntityValue?> CreateLaunchProfileValueAsync(IQueryExecutionContext queryExecutionContext, EntityIdentity id, QueryProjectPropertiesContext propertiesContext)
        {
            if (_projectService.GetLoadedProject(propertiesContext.File) is UnconfiguredProject project &&
                project.Services.ExportProvider.GetExportedValueOrDefault <ILaunchSettingsProvider>() is ILaunchSettingsProvider launchSettingsProvider &&
                project.Services.ExportProvider.GetExportedValueOrDefault <LaunchSettingsTracker>() is LaunchSettingsTracker launchSettingsTracker &&
                await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog &&
                await launchSettingsProvider.WaitForFirstSnapshot(Timeout.Infinite) is ILaunchSettings launchSettings)
            {
                if (launchSettings is IVersionedLaunchSettings versionedLaunchSettings)
                {
                    queryExecutionContext.ReportInputDataVersion(launchSettingsTracker.VersionKey, versionedLaunchSettings.Version);
                }

                IProjectState projectState = new LaunchProfileProjectState(project, launchSettingsProvider, launchSettingsTracker);

                foreach ((int index, ProjectSystem.Debug.ILaunchProfile profile) in launchSettings.Profiles.WithIndices())
                {
                    if (StringComparers.LaunchProfileNames.Equals(profile.Name, propertiesContext.ItemName) &&
                        !Strings.IsNullOrEmpty(profile.CommandName))
                    {
                        foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog))
                        {
                            if (rule.Metadata.TryGetValue("CommandName", out object?commandNameObj) &&
                                commandNameObj is string commandName &&
                                StringComparers.LaunchProfileCommandNames.Equals(commandName, profile.CommandName))
                            {
                                IEntityValue launchProfileValue = LaunchProfileDataProducer.CreateLaunchProfileValue(
                                    queryExecutionContext,
                                    id,
                                    propertiesContext,
                                    rule,
                                    index,
                                    projectState,
                                    _properties);
                                return(launchProfileValue);
                            }
                        }
                    }
                }
            }

            return(null);
        }
Beispiel #26
0
        public static async Task <IEnumerable <IEntityValue> > CreateSupportedValuesAsync(IEntityValue parent, ProjectSystem.Properties.IProperty property, ISupportedValuePropertiesAvailableStatus requestedProperties)
        {
            if (property is ProjectSystem.Properties.IEnumProperty enumProperty)
            {
                ReadOnlyCollection <ProjectSystem.Properties.IEnumValue> enumValues = await enumProperty.GetAdmissibleValuesAsync();

                return(createSupportedValues(enumValues));
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createSupportedValues(ReadOnlyCollection <ProjectSystem.Properties.IEnumValue> enumValues)
            {
                foreach (ProjectSystem.Properties.IEnumValue value in enumValues)
                {
                    IEntityValue supportedValue = CreateSupportedValue(parent.EntityRuntime, value, requestedProperties);
                    yield return(supportedValue);
                }
            }
        }
Beispiel #27
0
        public static async Task <IEnumerable <IEntityValue> > CreatePropertyPageValuesAsync(
            IQueryExecutionContext queryExecutionContext,
            IEntityValue parent,
            UnconfiguredProject project,
            IPropertyPagePropertiesAvailableStatus requestedProperties)
        {
            if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog)
            {
                return(createPropertyPageValuesAsync());
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createPropertyPageValuesAsync()
            {
                IProjectState projectState = new PropertyPageProjectState(project);
                QueryProjectPropertiesContext propertiesContext = new QueryProjectPropertiesContext(isProjectFile: true, project.FullPath, itemType: null, itemName: null);

                foreach (string schemaName in projectCatalog.GetProjectLevelPropertyPagesSchemas())
                {
                    if (projectCatalog.GetSchema(schemaName) is Rule rule &&
                        !rule.PropertyPagesHidden)
                    {
                        if (rule.Name == "RazorGeneral" || rule.Name == "RazorExtension")
                        {
                            // Some versions of the .NET SDK include a Razor property page that appears
                            // in the UI. This page is not intended for display.
                            //
                            // We cannot remove this page from existing versions of the SDK, so have to
                            // explicitly exclude it from query results so that it doesn't appear in any
                            // UI.

                            continue;
                        }

                        IEntityValue propertyPageValue = CreatePropertyPageValue(queryExecutionContext, parent, projectState, propertiesContext, rule, requestedProperties: requestedProperties);
                        yield return(propertyPageValue);
                    }
                }
            }
        }
Beispiel #28
0
        private async Task <IEnumerable <IEntityValue> > CreateLaunchProfileTypeValuesAsync(IEntityValue parent, UnconfiguredProject project)
        {
            if (await project.GetProjectLevelPropertyPagesCatalogAsync() is IPropertyPagesCatalog projectCatalog)
            {
                return(createLaunchProfileTypeValues());
            }

            return(Enumerable.Empty <IEntityValue>());

            IEnumerable <IEntityValue> createLaunchProfileTypeValues()
            {
                foreach (Rule rule in DebugUtilities.GetDebugChildRules(projectCatalog))
                {
                    if (rule.Metadata.TryGetValue("CommandName", out object?commandNameObj) &&
                        commandNameObj is string commandName)
                    {
                        IEntityValue launchProfileTypeValue = CreateLaunchProfileTypeValue(parent, commandName, rule);
                        yield return(launchProfileTypeValue);
                    }
                }
            }
        }
Beispiel #29
0
            static void assertEqual(IEntityValue entity, string expectedName)
            {
                var propertyEntity = (UIPropertyValue)entity;

                Assert.Equal(expectedName, propertyEntity.Name);
            }
Beispiel #30
0
 protected override Task <IEnumerable <IEntityValue> > CreateValuesAsync(IEntityValue parent, PropertyPageProviderState providerState)
 {
     return(Task.FromResult(UIPropertyDataProducer.CreateUIPropertyValues(parent, providerState.Cache, providerState.Rule, _properties)));
 }