General Misc Patches

This commit is contained in:
CloneTrooper1019
2020-08-17 20:12:24 -05:00
parent 297426bdb5
commit f4899b4ce6
18 changed files with 267 additions and 47 deletions

View File

@ -530,11 +530,44 @@ namespace RobloxFiles
if (fieldName.EndsWith("_"))
fieldName = instType.Name;
string xmlToken = fieldType.Name;
if (fieldType.IsEnum)
xmlToken = "token";
switch (xmlToken)
{
case "String":
case "Double":
xmlToken = xmlToken.ToLowerInvariant();
break;
case "Boolean":
xmlToken = "bool";
break;
case "Single":
xmlToken = "float";
break;
case "Int32":
xmlToken = "int";
break;
case "Int64":
xmlToken = "int64";
break;
case "Rect":
xmlToken = "Rect2D";
break;
case "CFrame":
xmlToken = "CoordinateFrame";
break;
default: break;
}
if (!props.ContainsKey(fieldName))
{
Property newProp = new Property()
{
Value = field.GetValue(this),
XmlToken = xmlToken,
Name = fieldName,
Type = propType,
Instance = this
@ -546,6 +579,7 @@ namespace RobloxFiles
{
Property prop = props[fieldName];
prop.Value = field.GetValue(this);
prop.XmlToken = xmlToken;
prop.Type = propType;
}
}

View File

@ -100,35 +100,45 @@ namespace RobloxFiles
private void ImproviseRawBuffer()
{
if (RawValue is SharedString)
{
var sharedString = CastValue<SharedString>();
RawBuffer = sharedString.SharedValue;
return;
}
else if (RawValue is ProtectedString)
{
var protectedString = CastValue<ProtectedString>();
RawBuffer = protectedString.RawBuffer;
return;
}
else if (RawValue is byte[])
if (RawValue is byte[])
{
RawBuffer = RawValue as byte[];
return;
}
if (RawValue is SharedString)
{
var sharedString = CastValue<SharedString>();
if (sharedString != null)
{
RawBuffer = sharedString.SharedValue;
return;
}
}
if (RawValue is ProtectedString)
{
var protectedString = CastValue<ProtectedString>();
if (protectedString != null)
{
RawBuffer = protectedString.RawBuffer;
return;
}
}
switch (Type)
{
case PropertyType.Int:
RawBuffer = BitConverter.GetBytes((int)Value);
break;
case PropertyType.Int64:
RawBuffer = BitConverter.GetBytes((long)Value);
break;
case PropertyType.Bool:
RawBuffer = BitConverter.GetBytes((bool)Value);
break;
case PropertyType.Int64:
RawBuffer = BitConverter.GetBytes((long)Value);
break;
case PropertyType.Float:
RawBuffer = BitConverter.GetBytes((float)Value);
break;