// MonoGame - Copyright (C) The MonoGame Team // This file is subject to the terms and conditions defined in // file 'LICENSE.txt', which is part of this source code package. using System; using System.Collections.ObjectModel; using System.Reflection; namespace Microsoft.Xna.Framework.Content.Pipeline { /// /// Represents a processor parameter. Processor parameters are automatically discovered by the content pipeline. Therefore, only custom processor developers should use this class directly. /// [SerializableAttribute] public sealed class ProcessorParameter { PropertyInfo propInfo; ReadOnlyCollection enumValues; /// /// Default value of the processor parameter. /// public Object DefaultValue { get; set; } /// /// Description of the parameter, as specified by the [Description] attribute. /// public string Description { get; set; } /// /// Name of the parameter displayed in the designer, as specified by the [DisplayName] attribute. /// public string DisplayName { get; set; } /// /// Gets a value indicating whether the parameter is an enumeration. /// public bool IsEnum { get { return enumValues != null; } } /// /// Available options for enumerated type parameters. For parameters of other types, this value is null. /// public ReadOnlyCollection PossibleEnumValues { get { return enumValues; } } /// /// Name of the property, as defined in the C# code. /// public string PropertyName { get { return propInfo.Name; } } /// /// Type of the parameter. /// public string PropertyType { get { return propInfo.PropertyType.Name; } } /// /// Constructs a ProcessorParameter instance. /// /// The info for the property. internal ProcessorParameter(PropertyInfo propertyInfo) { propInfo = propertyInfo; if (propInfo.PropertyType.IsEnum) enumValues = new ReadOnlyCollection(propInfo.PropertyType.GetEnumNames()); } } }