0.462.0.416719

This commit is contained in:
CloneTrooper1019 2021-01-20 14:45:58 -06:00
parent 1a34e9c849
commit 1acb895eaf
17 changed files with 63 additions and 70 deletions

View File

@ -33,9 +33,7 @@ namespace RobloxFiles.BinaryFormat.Chunks
if (instType == null)
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine($"INST - Unknown class: {ClassName} while reading INST chunk.");
RobloxFile.LogError($"INST - Unknown class: {ClassName} while reading INST chunk.");
return;
}

View File

@ -33,17 +33,13 @@ namespace RobloxFiles.BinaryFormat.Chunks
if (child == null)
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine($"PRNT: could not parent {childId} to {parentId} because child {childId} was null.");
RobloxFile.LogError($"PRNT: could not parent {childId} to {parentId} because child {childId} was null.");
continue;
}
if (parentId >= 0 && parent == null)
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine($"PRNT: could not parent {childId} to {parentId} because parent {parentId} was null.");
RobloxFile.LogError($"PRNT: could not parent {childId} to {parentId} because parent {parentId} was null.");
continue;
}

View File

@ -58,9 +58,7 @@ namespace RobloxFiles.BinaryFormat.Chunks
if (instance == null)
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine($"PROP: No instance @{id} for property {ClassName}.{Name}");
RobloxFile.LogError($"PROP: No instance @{id} for property {ClassName}.{Name}");
continue;
}
@ -368,9 +366,7 @@ namespace RobloxFiles.BinaryFormat.Chunks
if (info == null)
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine($"Enum cast failed for {inst.ClassName}.{Name} using value {value}!");
RobloxFile.LogError($"Enum cast failed for {inst.ClassName}.{Name} using value {value}!");
return value;
}
@ -378,9 +374,7 @@ namespace RobloxFiles.BinaryFormat.Chunks
}
catch
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine($"Enum cast failed for {inst.ClassName}.{Name} using value {value}!");
RobloxFile.LogError($"Enum cast failed for {inst.ClassName}.{Name} using value {value}!");
return value;
}
});
@ -545,9 +539,7 @@ namespace RobloxFiles.BinaryFormat.Chunks
break;
default:
if (RobloxFile.LogErrors)
Console.Error.WriteLine("Unhandled property type: {0}!", Type);
RobloxFile.LogError($"Unhandled property type: {Type}!");
break;
//
}

View File

@ -181,7 +181,7 @@ namespace RobloxFiles.DataTypes
internal CFrame(Attribute attr)
{
Vector3 pos = new Vector3(attr);
byte rawOrientId = attr.readByte();
byte rawOrientId = attr.ReadByte();
if (rawOrientId > 0)
{

View File

@ -21,8 +21,8 @@ namespace RobloxFiles.DataTypes
internal Vector2int16(Attribute attr)
{
X = attr.readShort();
Y = attr.readShort();
X = attr.ReadShort();
Y = attr.ReadShort();
}
private delegate Vector2int16 Operator(Vector2int16 a, Vector2int16 b);

View File

@ -27,9 +27,9 @@ namespace RobloxFiles.DataTypes
internal Vector3int16(Attribute attr)
{
X = attr.readShort();
Y = attr.readShort();
Z = attr.readShort();
X = attr.ReadShort();
Y = attr.ReadShort();
Z = attr.ReadShort();
}
private delegate Vector3int16 Operator(Vector3int16 a, Vector3int16 b);

View File

@ -1,5 +1,5 @@
// Auto-generated list of creatable Roblox classes.
// Updated as of 0.460.0.416222
// Updated as of 0.462.0.416719
using System;
@ -732,6 +732,14 @@ namespace RobloxFiles
public Vector3 Torque_ = new Vector3();
}
public class UniversalConstraint : Constraint
{
public bool LimitsEnabled;
public float MaxAngle = 45;
public float Radius = 0.2f;
public float Restitution;
}
public class VectorForce : Constraint
{
public bool ApplyAtCenterOfMass;

View File

@ -1,5 +1,5 @@
// Auto-generated list of Roblox enums.
// Updated as of 0.460.0.416222
// Updated as of 0.462.0.416719
namespace RobloxFiles.Enums
{

View File

@ -137,5 +137,17 @@ namespace RobloxFiles
{
return Task.Run(() => Save(filePath));
}
/// <summary>
/// Logs an error that occurred while opening a RobloxFile if logs are enabled.
/// </summary>
/// <param name="message"></param>
internal static void LogError(string message)
{
if (!LogErrors)
return;
Console.Error.WriteLine(message);
}
}
}

Binary file not shown.

View File

@ -57,9 +57,9 @@ namespace RobloxFiles
// internal BinaryWriter writer;
internal int ReadInt() => reader.ReadInt32();
internal byte readByte() => reader.ReadByte();
internal bool readBool() => reader.ReadBoolean();
internal short readShort() => reader.ReadInt16();
internal byte ReadByte() => reader.ReadByte();
internal bool ReadBool() => reader.ReadBoolean();
internal short ReadShort() => reader.ReadInt16();
internal float ReadFloat() => reader.ReadSingle();
internal double ReadDouble() => reader.ReadDouble();
internal string ReadString() => reader.ReadString(true);
@ -103,14 +103,13 @@ namespace RobloxFiles
switch (DataType)
{
//////////////////////////
case AttributeType.Null:
break;
case AttributeType.String:
Value = ReadString();
break;
case AttributeType.Bool:
Value = readBool();
Value = ReadBool();
break;
case AttributeType.Int:
Value = ReadInt();
@ -185,7 +184,7 @@ namespace RobloxFiles
Value = new Rect(this);
break;
case AttributeType.PhysicalProperties:
bool custom = readBool();
bool custom = ReadBool();
if (custom)
Value = new PhysicalProperties(this);
@ -197,9 +196,7 @@ namespace RobloxFiles
case AttributeType.Region3int16:
Value = new Region3int16(this);
break;
default:
throw new InvalidDataException($"Cannot handle AttributeType {DataType}!");
//////////////////////////
default: throw new InvalidDataException($"Cannot handle AttributeType {DataType}!");
}
reader = null;

View File

@ -18,6 +18,7 @@ namespace RobloxFiles
public Instance()
{
Name = ClassName;
RefreshProperties();
}
/// <summary>The ClassName of this Instance.</summary>
@ -506,12 +507,11 @@ namespace RobloxFiles
/// <param name="prop">A reference to the property that will be added.</param>
internal void AddProperty(ref Property prop)
{
string name = prop.Name;
RemoveProperty(name);
prop.Instance = this;
if (props.ContainsKey(prop.Name))
props.Remove(prop.Name);
props.Add(prop.Name, prop);
props.Add(name, prop);
}
/// <summary>

View File

@ -211,10 +211,7 @@ namespace RobloxFiles
}
else
{
if (!RobloxFile.LogErrors)
return false;
Console.Error.WriteLine($"RobloxFiles.Property - Property {Instance.ClassName}.{Name} does not exist!");
RobloxFile.LogError($"RobloxFiles.Property - Property {Instance.ClassName}.{Name} does not exist!");
}
}
}
@ -248,10 +245,7 @@ namespace RobloxFiles
}
catch
{
if (!RobloxFile.LogErrors)
return;
Console.Error.WriteLine($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
RobloxFile.LogError($"RobloxFiles.Property - Failed to cast value {value} into property {Instance.ClassName}.{Name}");
}
}
else if (valueType != null)
@ -267,10 +261,7 @@ namespace RobloxFiles
}
catch
{
if (!RobloxFile.LogErrors)
return;
Console.Error.WriteLine($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}");
RobloxFile.LogError($"RobloxFiles.Property - Failed to implicitly cast value {value} into property {Instance.ClassName}.{Name}");
}
}
}

View File

@ -109,7 +109,7 @@ namespace RobloxFiles.XmlFormat
if (!tokenHandler.ReadProperty(prop, propNode) && RobloxFile.LogErrors)
{
var readError = error($"Could not read property: {prop.GetFullName()}!");
Console.Error.WriteLine(readError.Message);
RobloxFile.LogError(readError.Message);
}
instance.AddProperty(ref prop);
@ -117,7 +117,7 @@ namespace RobloxFiles.XmlFormat
else if (RobloxFile.LogErrors)
{
var tokenError = error($"No {nameof(IXmlPropertyToken)} found for property type: {propType}!");
Console.Error.WriteLine(tokenError.Message);
RobloxFile.LogError(tokenError.Message);
}
}
}
@ -142,7 +142,7 @@ namespace RobloxFiles.XmlFormat
if (RobloxFile.LogErrors)
{
var typeError = error($"Unknown class {className} while reading Item.");
Console.Error.WriteLine(typeError.Message);
RobloxFile.LogError(typeError.Message);
}
return null;

View File

@ -94,9 +94,7 @@ namespace RobloxFiles.XmlFormat
if (handler == null)
{
if (RobloxFile.LogErrors)
Console.Error.WriteLine("XmlDataWriter.WriteProperty: No token handler found for property type: {0}", propType);
RobloxFile.LogError($"XmlRobloxFileWriter.WriteProperty: No token handler found for property type: {propType}");
return null;
}

View File

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

View File

@ -97,11 +97,7 @@ namespace RobloxFiles
}
else if (refId != "null")
{
string name = refProp.GetFullName();
if (LogErrors)
Console.Error.WriteLine("XmlRobloxFile: Could not resolve reference for {0}", name);
LogError($"XmlRobloxFile: Could not resolve reference for {refProp.GetFullName()}");
refProp.Value = null;
}
}
@ -112,6 +108,14 @@ namespace RobloxFiles
foreach (Property sharedProp in sharedProps)
{
SharedString shared = sharedProp.CastValue<SharedString>();
if (shared == null)
{
var nullBuffer = Array.Empty<byte>();
shared = SharedString.FromBuffer(nullBuffer);
sharedProp.Value = shared;
}
SharedStrings.Add(shared.Key);
}
}