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 ValueInfo( 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"); } if (customType != null && !valueKind.IsCustomType()) { 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; }
public static List <string> GetTypeDescription(this MSBuildValueKind kind, CustomTypeInfo customTypeInfo = null) { var modifierList = new List <string> (); string kindName = FormatKind(kind, customTypeInfo); if (kindName != null) { modifierList.Add(kindName); if (kind.AllowLists()) { modifierList.Add("list"); } else if (kind.AllowCommaLists()) { modifierList.Add("comma-list"); } if (!kind.AllowExpressions()) { modifierList.Add("literal"); } } return(modifierList); }
static string FormatKind(MSBuildValueKind kind, CustomTypeInfo customTypeInfo) { switch (kind.GetScalarType()) { case MSBuildValueKind.Bool: return("bool"); case MSBuildValueKind.Int: return("int"); case MSBuildValueKind.String: return("string"); case MSBuildValueKind.Guid: return("guid"); case MSBuildValueKind.Url: return("url"); case MSBuildValueKind.Version: return("version"); case MSBuildValueKind.SuffixedVersion: return("version-suffixed"); case MSBuildValueKind.Lcid: return("lcid"); case MSBuildValueKind.DateTime: return("datetime"); case MSBuildValueKind.Char: return("char"); case MSBuildValueKind.Object: return("object"); case MSBuildValueKind.Float: return("float"); case MSBuildValueKind.TargetName: return("target-name"); case MSBuildValueKind.ItemName: return("item-name"); case MSBuildValueKind.PropertyName: return("property-name"); case MSBuildValueKind.MetadataName: return("metadata-name"); case MSBuildValueKind.TaskName: return("type-name"); case MSBuildValueKind.TaskAssemblyName: return("assembly-name"); case MSBuildValueKind.TaskAssemblyFile: return("file-path"); case MSBuildValueKind.TaskFactory: case MSBuildValueKind.TaskArchitecture: case MSBuildValueKind.TaskRuntime: return("enum"); case MSBuildValueKind.TaskOutputParameterName: return(null); case MSBuildValueKind.TaskParameterType: return("type-name"); case MSBuildValueKind.Sdk: return("sdk-id"); case MSBuildValueKind.SdkVersion: return("sdk-version"); case MSBuildValueKind.SdkWithVersion: return("sdk-id-version"); case MSBuildValueKind.Xmlns: case MSBuildValueKind.Label: return(null); case MSBuildValueKind.ToolsVersion: case MSBuildValueKind.Importance: case MSBuildValueKind.ContinueOnError: case MSBuildValueKind.HostOS: case MSBuildValueKind.HostRuntime: return("enum"); case MSBuildValueKind.Configuration: return("configuration"); case MSBuildValueKind.Platform: return("platform"); case MSBuildValueKind.RuntimeID: return("rid"); case MSBuildValueKind.TargetFramework: return("framework"); case MSBuildValueKind.TargetFrameworkIdentifier: return("framework-id"); case MSBuildValueKind.TargetFrameworkVersion: return("framework-version"); case MSBuildValueKind.TargetFrameworkProfile: return("framework-profile"); case MSBuildValueKind.TargetFrameworkMoniker: return("framework-moniker"); case MSBuildValueKind.ProjectFile: return("file-path"); case MSBuildValueKind.File: return("file-path"); case MSBuildValueKind.Folder: return("directory-path"); case MSBuildValueKind.FolderWithSlash: return("directory-path-trailing-slash"); case MSBuildValueKind.FileOrFolder: return("file-or-folder"); case MSBuildValueKind.Extension: return("file-extension"); case MSBuildValueKind.Filename: return("file-name"); case MSBuildValueKind.MatchItem: case MSBuildValueKind.UnknownItem: return("item"); case MSBuildValueKind.NuGetID: return("nuget-id"); case MSBuildValueKind.NuGetVersion: return("nuget-version"); case MSBuildValueKind.ProjectKindGuid: return("flavor-guid"); case MSBuildValueKind.CustomType: if (customTypeInfo != null && customTypeInfo.Name != null) { return(customTypeInfo.Name); } return("enum"); } return(null); }
internal void SetParent(CustomTypeInfo parent) => TypeInfo = parent;