Fixed some encoding errors.
This commit is contained in:
parent
32399a692c
commit
2e02c2e7ef
@ -463,6 +463,13 @@ namespace RobloxFiles.BinaryFormat.Chunks
|
|||||||
readProperties(i =>
|
readProperties(i =>
|
||||||
{
|
{
|
||||||
int instId = instIds[i];
|
int instId = instIds[i];
|
||||||
|
|
||||||
|
if (instId >= File.NumInstances)
|
||||||
|
{
|
||||||
|
RobloxFile.LogError($"Got out of bounds referent index in {ClassName}.{Name}!");
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
return instId >= 0 ? File.Instances[instId] : null;
|
return instId >= 0 ? File.Instances[instId] : null;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -1015,7 +1022,12 @@ namespace RobloxFiles.BinaryFormat.Chunks
|
|||||||
if (prop.Value != null)
|
if (prop.Value != null)
|
||||||
{
|
{
|
||||||
Instance value = prop.CastValue<Instance>();
|
Instance value = prop.CastValue<Instance>();
|
||||||
referent = int.Parse(value.Referent);
|
|
||||||
|
if (value.IsDescendantOf(File))
|
||||||
|
{
|
||||||
|
string refValue = value.Referent;
|
||||||
|
int.TryParse(refValue, out referent);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
InstanceIds.Add(referent);
|
InstanceIds.Add(referent);
|
||||||
|
Binary file not shown.
@ -22,6 +22,9 @@ namespace RobloxFiles.Tokens
|
|||||||
|
|
||||||
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
|
public void WriteProperty(Property prop, XmlDocument doc, XmlNode node)
|
||||||
{
|
{
|
||||||
|
if (!prop.HasRawBuffer)
|
||||||
|
return;
|
||||||
|
|
||||||
byte[] data = prop.RawBuffer;
|
byte[] data = prop.RawBuffer;
|
||||||
string value = Convert.ToBase64String(data);
|
string value = Convert.ToBase64String(data);
|
||||||
|
|
||||||
|
@ -158,10 +158,8 @@ namespace RobloxFiles
|
|||||||
|
|
||||||
internal void WriteString(string value)
|
internal void WriteString(string value)
|
||||||
{
|
{
|
||||||
int length = value.Length;
|
|
||||||
Writer.Write(length);
|
|
||||||
|
|
||||||
byte[] utf8 = Encoding.UTF8.GetBytes(value);
|
byte[] utf8 = Encoding.UTF8.GetBytes(value);
|
||||||
|
Writer.Write(utf8.Length);
|
||||||
Writer.Write(utf8);
|
Writer.Write(utf8);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -239,6 +237,10 @@ namespace RobloxFiles
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public Attributes() : base()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
internal Attributes(BinaryReader reader)
|
internal Attributes(BinaryReader reader)
|
||||||
{
|
{
|
||||||
Initialize(reader);
|
Initialize(reader);
|
||||||
|
@ -64,7 +64,7 @@ namespace RobloxFiles
|
|||||||
public HashSet<string> Tags { get; } = new HashSet<string>();
|
public HashSet<string> Tags { get; } = new HashSet<string>();
|
||||||
|
|
||||||
/// <summary>The attributes defined for this Instance.</summary>
|
/// <summary>The attributes defined for this Instance.</summary>
|
||||||
private Attributes AttributesImpl;
|
private Attributes AttributesImpl = new Attributes();
|
||||||
|
|
||||||
/// <summary>The public readonly access point of the attributes on this Instance.</summary>
|
/// <summary>The public readonly access point of the attributes on this Instance.</summary>
|
||||||
public IReadOnlyDictionary<string, Attribute> Attributes => AttributesImpl;
|
public IReadOnlyDictionary<string, Attribute> Attributes => AttributesImpl;
|
||||||
@ -161,7 +161,9 @@ namespace RobloxFiles
|
|||||||
if (key.Length > 100)
|
if (key.Length > 100)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (!Attribute.SupportsType<T>())
|
Type type = value.GetType();
|
||||||
|
|
||||||
|
if (!Attribute.SupportsType(type))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
var attr = new Attribute(value);
|
var attr = new Attribute(value);
|
||||||
@ -170,7 +172,6 @@ namespace RobloxFiles
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>Returns true if this Instance is an ancestor to the provided Instance.</summary>
|
/// <summary>Returns true if this Instance is an ancestor to the provided Instance.</summary>
|
||||||
/// <param name="descendant">The instance whose descendance will be tested against this Instance.</param>
|
/// <param name="descendant">The instance whose descendance will be tested against this Instance.</param>
|
||||||
public bool IsAncestorOf(Instance descendant)
|
public bool IsAncestorOf(Instance descendant)
|
||||||
|
Loading…
Reference in New Issue
Block a user