0.514.0.5140398 + Enum XML encoding bugfix

This commit is contained in:
Max
2022-02-18 15:45:42 -06:00
parent 034799a4de
commit cff4b1ad5c
5 changed files with 70 additions and 26 deletions

View File

@ -42,8 +42,21 @@ namespace RobloxFiles.Tokens
Contract.Requires(prop != null && node != null);
object rawValue = prop.Value;
int signed = (int)rawValue;
uint value = (uint)signed;
if (!(rawValue is uint value))
{
Type type = rawValue.GetType();
if (type.IsEnum)
{
var signed = (int)rawValue;
value = (uint)signed;
}
else
{
value = 0;
RobloxFile.LogError($"Raw value for enum property {prop} could not be casted to uint!");
}
}
node.InnerText = value.ToInvariantString();
}