Added filenames to enum documentation
This commit is contained in:
committed by
Gustas Kažukauskas
parent
3f53abc4c4
commit
f590e806a1
@@ -68,12 +68,14 @@ namespace OpenRA.Mods.Common.UtilityCommands.Documentation
|
||||
});
|
||||
}
|
||||
|
||||
public static IEnumerable<ExtractedEnumInfo> GetRelatedEnumInfos(HashSet<Type> relatedEnumTypes)
|
||||
public static IEnumerable<ExtractedEnumInfo> GetRelatedEnumInfos(
|
||||
HashSet<Type> relatedEnumTypes, Cache<string, IReadOnlyDictionary<string, ImmutableArray<string>>> pdbTypesCache)
|
||||
{
|
||||
return relatedEnumTypes.OrderBy(t => t.Name).Select(type => new ExtractedEnumInfo
|
||||
{
|
||||
Namespace = type.Namespace,
|
||||
Name = type.Name,
|
||||
Filename = GetSourceFilenameForType(type, pdbTypesCache),
|
||||
Values = Enum.GetNames(type).ToDictionary(x => Convert.ToInt32(Enum.Parse(type, x), NumberFormatInfo.InvariantInfo), y => y)
|
||||
});
|
||||
}
|
||||
|
||||
@@ -94,7 +94,7 @@ namespace OpenRA.Mods.Common.UtilityCommands.Documentation
|
||||
{
|
||||
Version = version,
|
||||
SpriteSequenceTypes = sequenceTypesInfo,
|
||||
RelatedEnums = DocumentationHelpers.GetRelatedEnumInfos(relatedEnumTypes)
|
||||
RelatedEnums = DocumentationHelpers.GetRelatedEnumInfos(relatedEnumTypes, pdbTypesCache)
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(result);
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace OpenRA.Mods.Common.UtilityCommands.Documentation
|
||||
{
|
||||
Version = version,
|
||||
TraitInfos = traitTypesInfo,
|
||||
RelatedEnums = DocumentationHelpers.GetRelatedEnumInfos(relatedEnumTypes)
|
||||
RelatedEnums = DocumentationHelpers.GetRelatedEnumInfos(relatedEnumTypes, pdbTypesCache)
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(result);
|
||||
|
||||
@@ -76,7 +76,7 @@ namespace OpenRA.Mods.Common.UtilityCommands.Documentation
|
||||
{
|
||||
Version = version,
|
||||
WeaponTypes = weaponTypesInfo,
|
||||
RelatedEnums = DocumentationHelpers.GetRelatedEnumInfos(relatedEnumTypes)
|
||||
RelatedEnums = DocumentationHelpers.GetRelatedEnumInfos(relatedEnumTypes, pdbTypesCache)
|
||||
};
|
||||
|
||||
return JsonSerializer.Serialize(result);
|
||||
|
||||
@@ -19,6 +19,8 @@ namespace OpenRA.Mods.Common.UtilityCommands.Documentation.Objects
|
||||
|
||||
public string Name { get; set; }
|
||||
|
||||
public string Filename { get; set; }
|
||||
|
||||
public IDictionary<int, string> Values { get; set; }
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user