Small enhancements introduced from Rbx2Source migration.

This commit is contained in:
CloneTrooper1019
2020-09-21 13:29:31 -05:00
parent 7252e96c03
commit d1535c9a15
9 changed files with 78 additions and 33 deletions

View File

@ -114,7 +114,7 @@ namespace RobloxFiles.XmlFormat
}
else if (RobloxFile.LogErrors)
{
Console.WriteLine("No IXmlPropertyToken found for property type: " + propType + '!');
Console.Error.WriteLine("No IXmlPropertyToken found for property type: " + propType + '!');
}
}
}

View File

@ -7,7 +7,7 @@ namespace RobloxFiles.XmlFormat.PropertyTokens
public class Color3Token : IXmlPropertyToken
{
public string Token => "Color3";
private string[] Fields = new string[3] { "R", "G", "B" };
private readonly string[] Fields = new string[3] { "R", "G", "B" };
public bool ReadProperty(Property prop, XmlNode token)
{
@ -21,7 +21,15 @@ namespace RobloxFiles.XmlFormat.PropertyTokens
try
{
var coord = token[key];
fields[i] = Formatting.ParseFloat(coord.InnerText);
string text = coord?.InnerText;
if (text == null)
{
text = "0";
success = false;
}
fields[i] = Formatting.ParseFloat(text);
}
catch
{

View File

@ -33,7 +33,7 @@ namespace RobloxFiles.XmlFormat.PropertyTokens
if (!RobloxFile.LogErrors)
return true;
Console.WriteLine("ContentToken: Got illegal base64 string: {0}", data);
Console.Error.WriteLine("ContentToken: Got illegal base64 string: {0}", data);
}
}
}