Fixed some minor issues.
This commit is contained in:
parent
9c3a673d95
commit
cb063d1ada
@ -40,7 +40,7 @@ namespace RobloxFiles.XmlFormat
|
||||
foreach (Instance child in inst.GetChildren())
|
||||
RecordInstances(file, child);
|
||||
|
||||
if (inst.XmlReferent == "")
|
||||
if (inst.XmlReferent.Length < 35)
|
||||
inst.XmlReferent = CreateReferent();
|
||||
|
||||
file.Instances.Add(inst.XmlReferent, inst);
|
||||
|
@ -20,9 +20,16 @@ namespace RobloxFiles.XmlFormat.PropertyTokens
|
||||
|
||||
if (contentType.StartsWith("binary") || contentType == "hash")
|
||||
{
|
||||
// Roblox technically doesn't support this anymore, but load it anyway :P
|
||||
byte[] buffer = Convert.FromBase64String(content);
|
||||
prop.RawBuffer = buffer;
|
||||
try
|
||||
{
|
||||
// Roblox technically doesn't support this anymore, but load it anyway :P
|
||||
byte[] buffer = Convert.FromBase64String(content);
|
||||
prop.RawBuffer = buffer;
|
||||
}
|
||||
catch
|
||||
{
|
||||
Console.WriteLine("ContentToken: Got illegal base64 string: {0}", content);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -40,8 +47,17 @@ namespace RobloxFiles.XmlFormat.PropertyTokens
|
||||
type = "url";
|
||||
|
||||
XmlElement contentType = doc.CreateElement(type);
|
||||
contentType.InnerText = content;
|
||||
|
||||
if (type == "binary")
|
||||
{
|
||||
XmlCDataSection cdata = doc.CreateCDataSection(content);
|
||||
contentType.AppendChild(cdata);
|
||||
}
|
||||
else
|
||||
{
|
||||
contentType.InnerText = content;
|
||||
}
|
||||
|
||||
node.AppendChild(contentType);
|
||||
}
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ namespace RobloxFiles.XmlFormat
|
||||
string xml = Encoding.UTF8.GetString(buffer);
|
||||
Root.LoadXml(xml);
|
||||
}
|
||||
catch
|
||||
catch (Exception e)
|
||||
{
|
||||
throw new Exception("XmlRobloxFile: Could not read provided buffer as XML!");
|
||||
}
|
||||
@ -82,6 +82,7 @@ namespace RobloxFiles.XmlFormat
|
||||
{
|
||||
string name = refProp.GetFullName();
|
||||
Console.WriteLine("XmlRobloxFile: Could not resolve reference for {0}", name);
|
||||
refProp.Value = null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -158,6 +159,7 @@ namespace RobloxFiles.XmlFormat
|
||||
using (BinaryWriter writer = new BinaryWriter(stream))
|
||||
{
|
||||
byte[] data = Encoding.UTF8.GetBytes(result);
|
||||
stream.SetLength(0);
|
||||
writer.Write(data);
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user