示例#1
0
 public ItemInfo(
     string name, DisplayText description, string includeDescription = null,
     MSBuildValueKind valueKind = MSBuildValueKind.Unknown, CustomTypeInfo customType = null,
     Dictionary <string, MetadataInfo> metadata = null,
     bool isDeprecated = false, string deprecationMessage = null)
     : base(name, description, valueKind, customType, null, isDeprecated, deprecationMessage)
 {
     Metadata           = metadata ?? new Dictionary <string, MetadataInfo> (System.StringComparer.OrdinalIgnoreCase);
     IncludeDescription = includeDescription;
 }
示例#2
0
 public MetadataInfo(
     string name, DisplayText description,
     bool reserved       = false, bool required            = false, MSBuildValueKind valueKind = MSBuildValueKind.Unknown,
     ItemInfo item       = null, CustomTypeInfo customType = null,
     string defaultValue = null, bool isDeprecated         = false, string deprecationMessage = null)
     : base(name, description, valueKind, customType, defaultValue, isDeprecated, deprecationMessage)
 {
     Item     = item;
     Required = required;
     Reserved = reserved;
 }
        protected VariableInfo(
            string name, DisplayText description, MSBuildValueKind valueKind = MSBuildValueKind.Unknown,
            CustomTypeInfo customType = null, string defaultValue = null, bool isDeprecated = false, string deprecationMessage = null)
            : base(name, description)
        {
            if (valueKind.IsCustomType() && customType == null)
            {
                throw new ArgumentException($"When {nameof(valueKind)} is {nameof(MSBuildValueKind.CustomType)}, {nameof (customType)} cannot be null");
            }

            // HACK: NuGetID stores PackageType on the CustomType
            if (customType != null && !(valueKind.IsCustomType() || valueKind.GetScalarType() == MSBuildValueKind.NuGetID))
            {
                throw new ArgumentException($"When {nameof(customType)} is provided, {nameof(valueKind)} must be {nameof(MSBuildValueKind.CustomType)}");
            }

            CustomType         = customType;
            DefaultValue       = defaultValue;
            IsDeprecated       = isDeprecated || !string.IsNullOrEmpty(deprecationMessage);
            DeprecationMessage = deprecationMessage;
            ValueKind          = valueKind;
        }