Fixed a few encoding errors.

This commit is contained in:
Max 2021-05-03 17:26:55 -05:00
parent 81b28a2d63
commit 2050723dbd
3 changed files with 24 additions and 12 deletions

Binary file not shown.

View File

@ -91,13 +91,12 @@ namespace RobloxFiles
{ {
get get
{ {
string fullString = string.Join("\0", Tags.ToArray()); if (Tags.Count == 0)
return null;
byte[] buffer = fullString.ToCharArray() string fullString = string.Join("\0", Tags);
.Select(ch => (byte)ch) char[] buffer = fullString.ToCharArray();
.ToArray(); return Encoding.UTF8.GetBytes(buffer);
return buffer;
} }
set set
{ {
@ -587,11 +586,7 @@ namespace RobloxFiles
string fieldName = field.Name; string fieldName = field.Name;
Type fieldType = field.FieldType; Type fieldType = field.FieldType;
if (field.GetCustomAttribute<ObsoleteAttribute>() != null)
continue;
// A few specific edge case hacks. I wish these didn't need to exist :( // A few specific edge case hacks. I wish these didn't need to exist :(
if (fieldName == "Archivable" || fieldName.EndsWith("k__BackingField")) if (fieldName == "Archivable" || fieldName.EndsWith("k__BackingField"))
continue; continue;
else if (fieldName == "Bevel_Roundness") else if (fieldName == "Bevel_Roundness")

View File

@ -68,25 +68,42 @@ namespace RobloxFiles.XmlFormat
{ {
case PropertyType.CFrame: case PropertyType.CFrame:
case PropertyType.Quaternion: case PropertyType.Quaternion:
{
propType = "CoordinateFrame"; propType = "CoordinateFrame";
break; break;
}
case PropertyType.Enum: case PropertyType.Enum:
{
propType = "token"; propType = "token";
break; break;
}
case PropertyType.Rect: case PropertyType.Rect:
{
propType = "Rect2D"; propType = "Rect2D";
break; break;
}
case PropertyType.Int: case PropertyType.Int:
case PropertyType.Bool: case PropertyType.Bool:
case PropertyType.Float: case PropertyType.Float:
case PropertyType.Int64: case PropertyType.Int64:
case PropertyType.Double: case PropertyType.Double:
{
propType = propType.ToLower(CultureInfo.InvariantCulture); propType = propType.ToLower(CultureInfo.InvariantCulture);
break; break;
}
case PropertyType.String: case PropertyType.String:
propType = (prop.HasRawBuffer ? "BinaryString" : "string"); {
if (prop.Value is Content)
propType = "Content";
else if (prop.Value is ProtectedString)
propType = "ProtectedString";
else if (prop.Value is byte[])
propType = "BinaryString";
else
propType = "string";
break; break;
default: break; }
} }
} }